[Bash-completion-devel] Hardcoded /sbin/lsmod

Mark Rosenstand rosenstand at gmail.com
Fri Jun 19 23:41:49 UTC 2009


On Thu, Jun 18, 2009 at 9:29 PM, Raph<r4ph at no-log.org> wrote:
> Seriously I don't know, but maybe to avoid the problem hitted
> when you do, as unprivilieged user (U.P.):
> /sbin/iptables -j <TAB>
> I think it's a deep problem I don't remember having heard about :
> the completion of commands which :
> 1) are in {,/usr}/sbin
> 2) but are usable "read-only" by an U.P.
> It's sometimes usefull for a U.P. to use modprobe <TAB>
> (Notice the $PATH and ifconfig in ubuntu for example)
>
> That's why I think the current have() is not enough if the
> current behavior is considered as a problem.
> What about this kind of have() :
> - return 0 if found
> - return 1 if not found
> - return 2 if we needs another $PATH than the user's original one
> In this later case, we may use something like $(have -p $cmd) to get the
> absolute path echoed and use it if needed.
>
> Or a backward compatible solution :
> - echo the absolute path of the command if found
> - return 1 otherwise

Forgot to say that the problem is that module-init-tools by default installs
lsmod in /bin and not /sbin. The failing completion is "modprobe -r" as root.



More information about the Bash-completion-devel mailing list