Bugs item #313065, was changed at 2011-03-31 03:19 by James You can respond by visiting: https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313065&group_id=100114
Status: Closed Priority: 3 Submitted By: Nobody (None) Assigned to: Ville Skyttä (scop-guest) Summary: bash-completion-1.3 doesn't work for "sudo /etc/init.d/xxx <TAB>" Distribution: Gentoo Originally reported in: Gentoo Bugzilla Milestone: 2.0 Status: Fix Committed Original bug number: 360083 Initial Comment: After typing "sudo /etc/init.d/sshd <TAB>", local files instead of command options(start, stop, etc.) are listed. The old version 1.2 works fine. I noticed that the code "complete -p $cmd" has been changed to "complete -p ${cmd##*/}". Maybe you can check twice: first "complete -p $cmd", and if it fails, run "complete -p ${cmd##*/}"? James ---------------------------------------------------------------------- Comment By: James (jamesjjx-guest) Date: 2011-04-13 02:16 Message: Just tried and it worked fine. Thanks for your effort. James ---------------------------------------------------------------------- Comment By: Ville Skyttä (scop-guest) Date: 2011-04-13 01:31 Message: It did indeed. Current git has series of patches to fix this. ---------------------------------------------------------------------- Comment By: Ville Skyttä (scop-guest) Date: 2011-04-12 23:50 Message: Well, as said, it works for me on Fedora 14 both with current git and the 1.3 release. But then again, I do think it's a bug that we register completion for plain "foo" for /etc/init.d/foo and will look into changing that in git to register only the full path /etc/init.d/foo and /etc/rc.d/init.d/foo (and "service foo"); maybe that'll uncover the issue you see for me too. ---------------------------------------------------------------------- Comment By: James (jamesjjx-guest) Date: 2011-04-12 14:46 Message: well... my point is: it is a bug of _root_command, which is the completion function for sudo. Actually, the function _gentoo_style_init is never called! Gentoo registers a completion function _gentoo_style_init for the commands like /etc/init.d/XXX. After typing "sudo /etc/init.d/XXX <TAB>", _root_command should complete "/etc/init.d/XXX" by calling _gentoo_style_init. Right? But the version 1.3 code first extracts the command, in this case, "/etc/init.d/XXX", strips away the path and gets the filename, which is XXX, and then seeks for the completion function for XXX. But XXX is not registered, instead, /etc/init.d/XXX is. James ---------------------------------------------------------------------- Comment By: Ville Skyttä (scop-guest) Date: 2011-04-12 14:24 Message: _gentoo_style_init is not our function, so I suggest investigating this with Gentoo. If anybody can reproduce this with the completions shipped by us, feel free to reopen. ---------------------------------------------------------------------- Comment By: James (jamesjjx-guest) Date: 2011-04-11 03:52 Message: james@localhost ~ $ complete | grep sshd complete -F _gentoo_style_init /etc/init.d/sshd So I only have completion for /etc/init.d/sshd, no completion for sshd. Let me make it clearer: for any service(not only sshd) in the directory of /etc/init.d 1. "/etc/init.d/XXX <TAB>" works correctly by listing options like start, stop, etc. 2. "sudo /etc/init.d/XXX <TAB>" lists local files James ---------------------------------------------------------------------- Comment By: Ville Skyttä (scop-guest) Date: 2011-03-31 04:27 Message: Works fine for me. Do you have a separate completion for sshd installed - what does "complete -p sshd" output for you? ---------------------------------------------------------------------- You can respond by visiting: https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313065&group_id=100114 _______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel