Bug 385271
Summary: | /etc/bash_completion silently crashes, stopping execution of sourced .bashrc and .bash_profile scripts | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Need Real Name <bugzilla> |
Component: | bash-completion | Assignee: | Ville Skyttä <ville.skytta> |
Status: | CLOSED WORKSFORME | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | high | Docs Contact: | |
Priority: | low | ||
Version: | 8 | CC: | axel.thimm, sheltren |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2007-11-19 18:20:14 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Need Real Name
2007-11-15 18:55:49 UTC
I can't reproduce. When I source my (also based on Fedora defaults) ~/.bash_profile manually, /etc/bash_completion is never even read because the first check in /etc/profile.d/bash_completion.sh notices that it has already been sourced. How have you determined that /etc/bash_completion is sourced when you (re)source ~/.bash_profile and that those two lines are causing problems? Yes... by trial-and-error (using echo statements), I followed the chain as above. Everything gets sourced down the chain. Each of the lines noted above caused the crash -- and everything loaded smoothly when I commented them out. I (obviously) get the same problem when I just source /etc/bash_completion directly or when I run the lines directly from the bash prompt. The errors I get are: bash: BASH_COMPLETION: readonly variable bash: BASH_COMPLETION_DIR: readonly variable I don't understand what you mean by "the first check in /etc/profile.d/bash_completion.sh notices that it has already been sourced. The first check is a return if $BASH_VERSION is not set (which it is), so nothing happens. The second check is whether $BASH_VERSION > 2.04, which it is so it proceeds to the third check which checks whether /etc/bash_completion is readable, which it is. So, the file /etc/bash_completion is then sourced. (In reply to comment #2) > Yes... by trial-and-error (using echo statements), I followed the chain as > above. Everything gets sourced down the chain. I used the same method, and it does *not* get sourced for me. Additionally, directly sourcing /etc/bash_completion multiple times in a row causes no "crashes" either. > I don't understand what you mean by "the first check in > /etc/profile.d/bash_completion.sh notices that it has already > been sourced. > > The first check is a return if $BASH_VERSION is not set (which it is), so > nothing happens. The first check additionally checks if $BASH_COMPLETION is nonempty: # Check for bash (and that we haven't already been sourced). [ -z "$BASH_VERSION" -o -n "$BASH_COMPLETION" ] && return (In reply to comment #3) > directly sourcing /etc/bash_completion multiple times in a row causes no > "crashes" either. However I do see that some debug "echo foo >> /tmp/foo" do stop printing when repeatedly sourcing bash_completion in the section you mentioned. Changes further down bash_completion do take effect despite of this. OK - I see what's wrong. My version of bash_completion.sh doesn't have the second part of the test (-o -n "$BASH_COMPLETION"). When I looked closely, I noticed that yum had pulled in the version of bash-completion from the atrpms repo. I will 'cc' Axel Thimm on this to allow him to fix his version. Axel: you may want to update your version by making sure it has the line: # Check for bash (and that we haven't already been sourced). [ -z "$BASH_VERSION" -o -n "$BASH_COMPLETION" ] && return Sorry for the confusion - I wish there were a way to more explicitly know when one of the other repos overrides a standard fedora rpm :) Thanks for the info. Not sure why ATrpms ships a bash-completion package for Fedora in the first place though. |