-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bugSomething that's not working as intendedSomething that's not working as intended
Milestone
Description
In fish 3.6.1 as well as 3.3.1 at least, when running as root, commands (scripts or binaries) that are in $PATH, not owned by user root and/or group root, and are not world-executable will not be offered as completions, even though they are executable by root. This appears to affect Enterprise Linux (RHEL, CentOS, and Oracle Linux) 7 and 8, but does not affect macOS (any version). This happens whether ssh-ing to the Linux system via Apple Terminal or connecting directly to the machine's console. Running without third-party customizations does not affect the behavior.
How to reproduce:
- Ensure your user account on the Linux system can sudo to root and that /usr/local/bin is in your $PATH
- Create /usr/local/bin/testprog, using sudo if needed, containing something that could execute. An example:
#!/usr/bin/env fish
echo "Hello World"- Set the owner and group of testprog to something OTHER than root:root. For full effect, make sure your user account is either the owner or belongs to the group.
- Set the permissions of testprog to 0550, 0750, or 0770
- Attempt to auto-complete or tab-complete the command
testprog(without typing it fully) and notice that fish will happily - Change to a root session running fish and ensure that /usr/local/bin is in your path as root
- Attempt to auto-complete or tab-complete the command
testprog(without typing it fully) and notice that fish will not - Run the command
testprog(notice that fish will color the command as valid once it's typed fully) - Attempt to auto-complete or tab-complete the command
testprog(without typing it fully) and notice that fish will now suggest it, since it's in your command history, but will not tab-complete it. - Switch to a root shell running bash
- Attempt to tab-complete the command
testprog(without typing it fully) and notice that bash will happily - Do any one of the following: change the owner of testprog to root, change the group of testprog to root, or set testprog's permissions to 0555, 0750, 0775, or 0777
- Switching back to a fish root prompt, try tab-completing
testprogagain. Note that fish will happily tab-complete it now.
What should happen:
- If a command is executable at all, it's executable by root, and should be offered as a completion
What does happen:
- Fish only seems to offer commands for completion when the following are true: it is executable by anyone OR it is executable specifically by you OR it is executable by a group you belong to OR it's in your command history
Metadata
Metadata
Assignees
Labels
bugSomething that's not working as intendedSomething that's not working as intended