dotnet / dotnet/command-line-api

Completions don't work for symlinked executables

オープン
#2,201 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

Area-Completions bug
主要言語
C#
スター
3.7k
フォーク
428
PR マージ指標
30日以内にマージされた PR はありません

説明

It's pretty common to "install" executables on Linux by symlinking them into `$XDG_BIN_DIR`, e.g. `ln --symbolic "$XDG_DATA_HOME/go/bin/go" "$XDG_BIN_DIR/go"`

I tried something similar with a dotnet CLI I created using System.CommandLine, but I couldn't get completions to work. I tracked it down to [this line](https://github.com/dotnet/command-line-api/blob/7058640c8f0c472c399bc063e14410a04cbe5ffd/src/System.CommandLine.Suggest/dotnet-suggest-shim.zsh#LL12C11-L12C11)

```
# Get full path to script because dotnet-suggest needs it
# NOTE: this requires a command registered with dotnet-suggest be
# on the PATH
full_path=`which ${words[1]}` # zsh arrays are 1-indexed
```

Switching this to `full_path=$(realpath $(which ${words[1]}))` fixed the issue.

Would be nice for the official shims (or dotnet-suggest itself if the fix is more appropriate there) to support symlinked executables.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

src/System.CommandLine.Suggest/dotnet-suggest-shim.zsh のリンク先の full_path 代入から始め、直接呼び出された実行可能ファイルとシンボリックリンクされた実行可能ファイルをどのように解決するかを比較します。シンボリックリンクを通じてインストールされたコマンドの補完を再現し、その後、公式の shim または dotnet-suggest が解決済みの実行可能ファイルのパスを正しく処理することを確認します。

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

評価

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

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

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