[Bug 811030] New: ~/.bash_completion overrides instead of augments system completions
https://bugzilla.novell.com/show_bug.cgi?id=811030 https://bugzilla.novell.com/show_bug.cgi?id=811030#c0 Summary: ~/.bash_completion overrides instead of augments system completions Classification: openSUSE Product: openSUSE 12.3 Version: Final Platform: All OS/Version: openSUSE 12.2 Status: NEW Severity: Normal Priority: P5 - None Component: Other AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: psychonaut@nothingisreal.com QAContact: qa-bugs@suse.de Found By: --- Blocker: --- Created an attachment (id=531218) --> (http://bugzilla.novell.com/attachment.cgi?id=531218) Patch to /etc/bash.bashrc which restores custom completions User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0 SeaMonkey/2.16.1 According to the documentation for bash-completions at /usr/share/doc/packages/bash-completion/README, the user should put any additional completions (over and above the ones provided by the distribution) in ~/.bash_completion: Q. How can I insert my own local completions without having to reinsert them every time you issue a new release? A. Put them in ~/.bash_completion, which is parsed at the end of the main completion script. And indeed, if you read the source code at /usr/share/bash-completion/bash_completion, you'll see that it first applies its own completions, and then sources the user's ~/.bash_completion. However, openSUSE's /etc/bash.bashrc overrides this behaviour. That script first checks for ~/.bash_completion, and executes it if present. Only if it is *not* present does it run /usr/share/bash-completion/bash_completion (via /etc/profile.d/bash_completion.sh). This makes it impossible for the user to specify additional completions in accordance with the bash-completion manual. If he tries to do so, none of the "official" completions get loaded. Reproducible: Always I attach a patch for /etc/bash.bashrc which puts the test for ~/.bash_completion after the one for /etc/profile.d/bash_completion.sh. This solves the problem in my case. I note, however, that /etc/bash.bashrc checks for a lot of other scripts here (/etc/bash_completion and /etc/profile.d/complete.bash) which on a stock openSUSE 12.3 system should never exist in the first place. I'm not sure why these tests exists -- perhaps for backward compatibility? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=811030 https://bugzilla.novell.com/show_bug.cgi?id=811030#c Xiaolong Li <xlli@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xlli@suse.com AssignedTo|bnc-team-screening@forge.pr |mkoenig@novell.com |ovo.novell.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=811030 https://bugzilla.novell.com/show_bug.cgi?id=811030#c2 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |psychonaut@nothingisreal.co | |m Severity|Normal |Enhancement --- Comment #2 from Dr. Werner Fink <werner@suse.com> 2013-04-08 07:50:03 UTC --- (In reply to comment #0) IMHO the `elif' does not help so much as you want that $HOME/.bash_completion overrides the system defaults including all cases above. Now if one of the former `if' or `elif' matches your personal $HOME/.bash_completion is not read in any case. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=811030 https://bugzilla.novell.com/show_bug.cgi?id=811030#c3 --- Comment #3 from Tristan Miller <psychonaut@nothingisreal.com> 2013-04-08 09:29:39 BST --- (In reply to comment #2) It's difficult to properly construct an if-else chain without knowing what all those other completion scripts are. We know that /etc/profile.d/bash_completion.sh calls /usr/share/bash-completion/bash_completion which in turn calls ~/.bash_completion, so we must first test for the presence of /etc/profile.d/bash_completion.sh, and execute ~/.bash_completion only if it's not found. However, as I mentioned, it's not clear to me what /etc/bash_completion and /etc/profile.d/complete.bash are for. These files don't appear to be installed as part of the bash-completion RPM. Perhaps previous versions of openSUSE used them. If so, we need to know whether or not they called ~/.bash_completion. If they did, then my patch works as-is. If they didn't, then my patch needs to be changed. If these files were never used by previous versions of openSUSE, and there's no other reason to keep them, then references to them should be removed from /etc/bash.bashrc. We could simplify it to a single if: if test -e /etc/bash_completion ; then . /etc/bash_completion fi -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=811030 https://bugzilla.novell.com/show_bug.cgi?id=811030#c4 --- Comment #4 from Tristan Miller <psychonaut@nothingisreal.com> 2013-04-08 09:30:29 BST --- Oops... ignore the last three lines of my last comment. They should instead be as follows: if test -s /etc/profile.d/complete.bash ; then . /etc/profile.d/complete.bash fi -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=811030 https://bugzilla.novell.com/show_bug.cgi?id=811030#c5 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |RESOLVED InfoProvider|psychonaut@nothingisreal.co | |m | Resolution| |FIXED --- Comment #5 from Dr. Werner Fink <werner@suse.com> 2013-04-23 15:55:24 UTC --- Just fixed this for factory -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com