Bash completion: apt install ./file.deb does not complete local .deb files
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- bash, linux
- 領域
- cli
調査の方向性
issue では、/etc/bash_completion.d/apt-linux-mint とパッケージ名 _apt のケースを調査の出発点として示しています。そのケースを読み、Debian の apt 補完での処理と比較してください。issue にはテスト済みの条件と期待される動作が記載されています。apt install でローカルの .deb パスが補完され、パッケージ名の補完も引き続き機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
Tab completion does not work for local .deb files with apt install:
$ ls
slack-desktop-4.53.287-amd64.deb
$ sudo apt install ./slack<Tab>
Nothing completes. The same thing happens without sudo.
Cause
/etc/bash_completion.d/apt-linux-mint defines its own _apt function, which replaces the one from Debian's /usr/share/bash-completion/completions/apt. In Mint's version, install is grouped with the commands that take a package name, so the current word is always passed to apt-cache --no-generate pkgnames and never to file completion.
Debian's completion switches to .deb file completion when the word starts with ., /, or ~. That was added for Ubuntu in LP #1645815 (apt 1.4~beta2). Mint's script was written before apt install ./file.deb was supported and never picked up that change.
Environment
- Linux Mint 22.3 (Zena)
- mintsystem 8.6.5 (the installed
apt-linux-mintis identical tomaster) - apt 2.8.4ubuntu0.1
- bash-completion 1:2.11-8
Suggested fix
Add the same check Debian uses at the start of the package-name case:
"build"|"build-dep"|"changelog"|"depends"|"download"|"install"|"list"|\
"policy"|"recommends"|"rdepends"|"show"|"source")
+ if [[ "$opt" == "install" && ( "$cur" == .* || "$cur" == /* || "$cur" == ~* ) ]]; then
+ _filedir '?(u)deb'
+ return 0
+ fi
COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \
2> /dev/null ) )
return 0
;;
I tested this locally. apt install ./slack<Tab> completes to ./slack-desktop-4.53.287-amd64.deb, and apt install slac<Tab> still completes package names.
Longer-term idea
A more durable option would be for this script to handle only the Mint-specific commands (deb, add-repository, held, contains, and so on) and fall back to Debian's _apt for the standard subcommands. Then Mint would get upstream completion fixes automatically, which would also address the drift reported in #73. Rewriting the script would also be a chance to drop the deprecated have call reported in #138.
- 主要言語
- Python
- スター
- 58
- フォーク
- 43
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
linuxmint/mintsystem のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
linuxmint/mintsystem#151 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
linuxmint/mintsystem#152 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
linuxmint/mintsystem#150 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
linuxmint/mintsystem#144 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
linuxmint/mintsystem#140 ·
linuxmint/mintsystem の issue をすべて見る
似ている issue
-
Task select patterns with uppercase letters never match対応中かも @manobhisriram が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
app: scripts status: backlog type: housekeeping
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
netbox-community/netbox-scripts#239 ·
メンテナーはふだん 1 日以内に返信
-
Lambda deploys fail once the bundle grows by about 254 KB対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
developmentseed/titiler-cmr#341 ·
メンテナーはふだん 1 日以内に返信
-
Card tables add "..." to every value in a DataFrame column when any value is longer than 30 characters対応中かも @omkarbandikatte が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信