Skip to content

Comments

Do not source /* if BASH_COMPLETION_COMPAT_DIR is unset#49

Open
Syphdias wants to merge 1 commit intomchav:masterfrom
Syphdias:fix-completion
Open

Do not source /* if BASH_COMPLETION_COMPAT_DIR is unset#49
Syphdias wants to merge 1 commit intomchav:masterfrom
Syphdias:fix-completion

Conversation

@Syphdias
Copy link

If BASH_COMPLETION_COMPAT_DIR was unset it tried to source /*
wich lead to repl not showing up if there were files in / that
lead no termination of sourcing. This could potentially do harm
if there is a harmful script in /.

$BASH_COMPLETION_DEFAULT_DIR/* will now only be sourced if
BASH_COMPLETION_DEFAULT_DIR is set and is not empty.

If BASH_COMPLETION_COMPAT_DIR was unset it tried to source /*
wich lead to repl not showing up if there were files in / that
lead no termination of sourcing. This could potentially do harm
if there is a harmful script in /.

$BASH_COMPLETION_DEFAULT_DIR/* will now only be sourced if
BASH_COMPLETION_DEFAULT_DIR is set and is not empty.
@Syphdias
Copy link
Author

Pinging @dragonator since he original implemented these lines

@Syphdias
Copy link
Author

Example what cause the problem for me:

❯ ls /*(.) -l
-rw-r--r-- 1 root root 19004 Sep 12  2019 /desktopfs-pkgs.txt
-rw-r--r-- 1 root root  4069 Sep 12  2019 /rootfs-pkgs.txt
❯ head /*(.)
==> /desktopfs-pkgs.txt <==
a52dec 0.7.4-10
aalib 1.4rc5-13
accountsservice 0.6.55-1
acl 2.2.53-1
acpi 1.7-2
acpid 2.0.31-1
adapta-maia-theme 3.94.0.149-2
adobe-source-code-pro-fonts 2.030ro+1.050it-5
adwaita-icon-theme 3.32.0-1
alsa-firmware 1.0.29-2

==> /rootfs-pkgs.txt <==
acl 2.2.53-1
acpi 1.7-2
acpid 2.0.31-1
amd-ucode 20190815.07b925b-1
archlinux-keyring 20190827-1
argon2 20190702-1
attr 2.4.48-1
audit 2.8.5-3
b43-fwcutter 019-2
bash 5.0.009-1

PS: This uses zsh globbing, ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant