Bash completion: apt install ./file.deb does not complete local .deb files
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 85/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- bash, linux
- Bereich
- cli
Rechercherichtung
Das Issue nennt /etc/bash_completion.d/apt-linux-mint und den Fall des Paketnamens _apt als Einstiegspunkt. Lies diesen Fall und vergleiche seine Behandlung mit der apt-Vervollständigung von Debian; das Issue enthält eine getestete Bedingung und das erwartete Verhalten. Fertig ist die Arbeit, wenn lokale .deb-Pfade für apt install vervollständigt werden und die Vervollständigung von Paketnamen weiterhin funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 58
- Forks
- 43
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus linuxmint/mintsystem
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
linuxmint/mintsystem#151 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 57/100
linuxmint/mintsystem#152 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
linuxmint/mintsystem#150 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
linuxmint/mintsystem#144 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
linuxmint/mintsystem#140 ·
Alle Issues in linuxmint/mintsystem
Ähnliche Issues
-
Task select patterns with uppercase letters never matchEvtl. vergeben @manobhisriram hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
app: scripts status: backlog type: housekeeping
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
netbox-community/netbox-scripts#239 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Lambda deploys fail once the bundle grows by about 254 KBEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
developmentseed/titiler-cmr#341 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Card tables add "..." to every value in a DataFrame column when any value is longer than 30 charactersEvtl. vergeben @omkarbandikatte hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag