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

オープン 初心者向け
#825 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
cli

調査の方向性

internal/pathmeta/path_meta.go の143〜146行目付近から始めてください。ここでは $HOME/.vfox/tmp が os.MkdirAll で作成されていますが、VFOX_HOME 配下のインストール先とプラグインのディレクトリは os.Mkdir で作成され、エラーは無視されています。エラーは internal/manager.go:563 を経由して表面化します。再現するには、VFOX_HOME を存在しないディレクトリに設定し、プラグインの zip に対して vfox add --source を実行します。VFOX_HOME が MkdirAll で作成されるか、VFOX_HOME の名前を含むメッセージで add が早期に失敗するようになり、エラーが破棄されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Go
スター
4k
フォーク
177
平均マージ
1日 20時間
マージ済み PR(30日)
31

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

version-fox/vfox のほかの issue

version-fox/vfox の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。