Bug 10894 - can't set GROUPS until after it's echoed
Summary: can't set GROUPS until after it's echoed
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash   
(Show other bugs)
Version: 6.2
Hardware: All Linux
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-04-18 16:45 UTC by Jonathan Kamens
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-08-03 12:39:41 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Jonathan Kamens 2000-04-18 16:45:25 UTC
> bash -c 'GROUPS=foo; echo $GROUPS'
> bash -c 'echo $GROUPS; GROUPS=foo; echo $GROUPS'

Comment 1 Bernhard Rosenkraenzer 2000-08-03 11:31:22 UTC
Why do you want to set a read-only variable?

Comment 2 Jonathan Kamens 2000-08-03 12:39:41 UTC
1) It wasn't me, it was a shell script I inherited.  I patched around the
problem by changing the variable name, but still, a shell script shouldn't break
in indetermine ways simply because it has the bad luck of choosing a variable
name that bash reserves (speaking of which, where does bash get off reserving
variable names without putting underscores in front of their names or something
to protect the namespace?  but I digress).

2) The bash man page (at least in bash-2.04-4) does not document that GROUPS is
a read-only variable.

3) Well, OK, it *sort of* documents this, since it says that assignments to the
variable are silently discarded (that's really broken; if bash is going to
reserve a variable and not allow its value to be changed, and a shell script
tries to change the variable, bash should immediately crap out, or at least
print an error message, so you have some idea of what's going wrong).  But in
that case, the bug is that I *was* able to change the value of the variable
after echoing it.  That's clearly broken.

Comment 3 Bernhard Rosenkraenzer 2000-11-03 09:51:27 UTC
Please discuss this with bug-bash@gnu.org - we can't just change bash's behavior for compatibility reasons with other distributions/OSes using bash.

Note You need to log in before you can comment on or make changes to this bug.