vfox add --source fails with a raw rename error when VFOX_HOME does not exist

Aperta Adatta ai principianti
#825 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli

Direzione di ricerca

Inizia da internal/pathmeta/path_meta.go, intorno alle righe 143-146, dove $HOME/.vfox/tmp viene creata con os.MkdirAll, mentre le directory di installazioni e plugin di VFOX_HOME usano os.Mkdir e gli errori vengono ignorati. L'errore emerge da internal/manager.go:563. Per riprodurlo, imposta VFOX_HOME su una directory mancante ed esegui vfox add --source su uno zip di un plugin. È completato quando VFOX_HOME viene creata con MkdirAll, oppure quando add fallisce subito con un messaggio che nomina VFOX_HOME, e gli errori non vengono più scartati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

With VFOX_HOME set to a directory that does not exist, vfox add --source validates the plugin, then fails with an operating system error. docs/guides/multi-user-sharing.md asks users to create the directory first (mkdir -p /opt/vfox, then export VFOX_HOME=/opt/vfox). The error does not name VFOX_HOME, and the code that should create the directories ignores its errors.

Reproduction on a GitHub-hosted runner (Ubuntu 26.04.1, x86_64) with the vfox 1.1.0 release archive (checksum verified) and the zip archive of the vfox-etcd v0.2.3 tag. Run: https://github.com/version-fox/vfox-plus/actions/runs/45056971190

VFOX_HOME="$W/no-such-dir/vfox-home" vfox add --source vfox-etcd-v0.2.3.zip
# exit 1
# stdout: Validating .../vfox-etcd-v0.2.3.zip ...
# stderr: install plugin error: rename .../.vfox/tmp/vfox-4056581461 .../no-such-dir/vfox-home/plugin/etcd: no such file or directory

mkdir -p "$W/no-such-dir/vfox-home"
VFOX_HOME="$W/no-such-dir/vfox-home" vfox add --source vfox-etcd-v0.2.3.zip
# exit 0

The same error occurs when only VFOX_HOME itself is missing and its parent exists (checked on Linux with vfox 1.1.0).

Without VFOX_HOME, a HOME that has no .vfox yet works: vfox add --source exits 0, because $HOME/.vfox is created.

With the same missing VFOX_HOME, vfox list exits 1 with you don't have any sdk installed yet, which does not say that the directory is missing.

Cause: internal/pathmeta/path_meta.go:143 creates $HOME/.vfox/tmp with os.MkdirAll, but path_meta.go:145-146 create the installs and plugin directories of VFOX_HOME with os.Mkdir, which does not create parents, and ignore its error (_ = os.Mkdir(...)). The rename of the validated plugin into plugin/ then fails, and internal/manager.go:563 wraps it as install plugin error.

Expected: VFOX_HOME is created, or add stops before the download with a message that names VFOX_HOME.

Severity: low. The directory is a documented step, so this concerns the error message and the ignored errors.

Lingua principale
Go
Stelle
4k
Fork
177
Merge medio
1g 20h
PR unite (30g)
31

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di version-fox/vfox

Tutte le issue di version-fox/vfox

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.