Re: GROUPS

2021-08-20 Thread Dale R. Worley
Robert Elz writes: > | What seems to be the case with sh-style shells and Posix is that > | all-caps variable names are subject to implementation-specific use, and > | so users should not use them except when using them in the way that is > | specific to the implementation the script is to

Re: GROUPS

2021-08-16 Thread Robert Elz
Date:Mon, 16 Aug 2021 22:16:29 -0400 From:"Dale R. Worley" Message-ID: <878s10yfwi@hobgoblin.ariadne.com> | What seems to be the case with sh-style shells and Posix is that | all-caps variable names are subject to implementation-specific use, and | so users

Re: GROUPS

2021-08-16 Thread Dale R. Worley
It seems to me that people are avoiding both the core issue and its solution. A standard is what allows people to write software that can be ported without having to reassess every detail of the program. To take C as an example, the standard defines what identifiers look like, which identifiers a

Re: GROUPS

2021-08-13 Thread Franklin, Jason
On Fri, 2021-08-13 at 10:10 -0400, Chet Ramey wrote: > As long as you stick to things POSIX standardizes. Relevant here, the > standard even includes a list of variables you should avoid using because > various shells and applications use them. GROUPS is not on this list that I can tell. It would

Re: GROUPS

2021-08-13 Thread Chet Ramey
On 8/13/21 10:32 AM, Greg Wooledge wrote: On Fri, Aug 13, 2021 at 10:10:42AM -0400, Chet Ramey wrote: As long as you stick to things POSIX standardizes. Relevant here, the standard even includes a list of variables you should avoid using because various shells and applications use them. Just o

Re: GROUPS

2021-08-13 Thread Greg Wooledge
On Fri, Aug 13, 2021 at 10:10:42AM -0400, Chet Ramey wrote: > As long as you stick to things POSIX standardizes. Relevant here, the > standard even includes a list of variables you should avoid using because > various shells and applications use them. Just out of curiosity, where is that? It's no

Re: GROUPS

2021-08-13 Thread Chet Ramey
On 8/11/21 8:00 PM, Franklin, Jason wrote: Chet: My apologies in advance for not responding in thread. The bug-bash archive interface doesn't expose the "Message-ID" header anywhere I can find, and I am not a subscriber. I suppose I should become one. :) I believe I'd rather have variables

Re: GROUPS

2021-08-12 Thread Robert Elz
Date:Wed, 11 Aug 2021 15:31:08 -0400 From:Chet Ramey Message-ID: <87b7cb49-444f-aa06-198d-57f4071a0...@case.edu> | I believe I'd rather have variables behave as they're documented. It's more | predictable. I'm not sure I follow the logic that leads to that conclu

Re: GROUPS

2021-08-11 Thread Franklin, Jason
On Wed, 2021-08-11 at 20:36 -0400, Greg Wooledge wrote: > On Wed, Aug 11, 2021 at 08:00:12PM -0400, Franklin, Jason wrote: > > This doesn't work unless it was recently fixed. A variation does... > > > > bash-5.0$ echo $BASH_VERSION > > 5.0.17(1)-release > > bash-5.0$ GROUPS=FOO bash -c 'echo $GRO

Re: GROUPS

2021-08-11 Thread Greg Wooledge
On Wed, Aug 11, 2021 at 08:00:12PM -0400, Franklin, Jason wrote: > This doesn't work unless it was recently fixed. A variation does... > > bash-5.0$ echo $BASH_VERSION > 5.0.17(1)-release > bash-5.0$ GROUPS=FOO bash -c 'echo $GROUPS' > 1000 > bash-5.0$ GROUPS=FOO bash --posix -c 'echo $GROUPS' >

Re: GROUPS

2021-08-11 Thread Franklin, Jason
Chet: My apologies in advance for not responding in thread. The bug-bash archive interface doesn't expose the "Message-ID" header anywhere I can find, and I am not a subscriber. I suppose I should become one. :) > I believe I'd rather have variables behave as they're documented. It's more > pr

Re: GROUPS

2021-08-11 Thread Chet Ramey
On 8/11/21 2:06 PM, Robert Elz wrote: Date:Wed, 11 Aug 2021 10:16:42 -0400 From:Chet Ramey Message-ID: <26e01365-d7f0-448d-dc4d-83f244bd0...@case.edu> | As long as POSIX doesn't define a variable to have some special meaning, it | doesn't have anything to s

Re: GROUPS

2021-08-11 Thread Robert Elz
Date:Wed, 11 Aug 2021 10:16:42 -0400 From:Chet Ramey Message-ID: <26e01365-d7f0-448d-dc4d-83f244bd0...@case.edu> | As long as POSIX doesn't define a variable to have some special meaning, it | doesn't have anything to say about how a shell chooses to use it. It's

Re: GROUPS

2021-08-11 Thread Chet Ramey
On 8/10/21 8:56 PM, Franklin, Jason wrote: What surprised me was that Bash-specific "magic" variables did not lose their "magic" qualities when Bash was invoked in a POSIX-compliant mode of execution. That's not what bash posix mode is for. POSIX does not prohibit extensions. -- ``The lyf

Re: GROUPS

2021-08-11 Thread Chet Ramey
On 8/10/21 12:39 PM, Robert Elz wrote: | In this case, you are using features outside what POSIX specifies. Using a variable name that's outside what POSIX specifies is hardly using a feature that's outside POSIX - if it were then there would be no safe non-trivial scripts, since any variabl

Re: GROUPS

2021-08-11 Thread Andreas Schwab
On Aug 11 2021, Štěpán Němec wrote: > Quoting POSIX.1-2017 on environment variables [1]: Note that GROUPS is not an environment variable in bash, it is not exported. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And

Re: GROUPS

2021-08-11 Thread Štěpán Němec
On Tue, 10 Aug 2021 23:39:47 +0700 Robert Elz wrote: > Date:Tue, 10 Aug 2021 10:22:29 -0400 > From:Chet Ramey > Message-ID: <731876fc-39c0-4388-0c9e-bf560921b...@case.edu> > > | In this case, you are using features outside what POSIX specifies. > > Using a variable

Re: GROUPS

2021-08-10 Thread Dmitry Goncharov via Bug reports for the GNU Bourne Again SHell
On Tue, Aug 10, 2021 at 8:57 PM Franklin, Jason wrote: > What surprised me was that Bash-specific "magic" variables did not lose > their "magic" qualities when Bash was invoked in a POSIX-compliant mode > of execution. Posix mode does not mean that bash-specific variables (or anything else bash-s

Re: GROUPS

2021-08-10 Thread Franklin, Jason
Hey, Robert: Thanks for the input! Quoting you here with some of my thoughts... > Using a variable name that's outside what POSIX specifies is hardly > using a feature that's outside POSIX - if it were then there would be > no safe non-trivial scripts, since any variable name might be made magic

Re: GROUPS

2021-08-10 Thread Robert Elz
Date:Tue, 10 Aug 2021 10:22:29 -0400 From:Chet Ramey Message-ID: <731876fc-39c0-4388-0c9e-bf560921b...@case.edu> | In this case, you are using features outside what POSIX specifies. Using a variable name that's outside what POSIX specifies is hardly using a feature

Re: GROUPS

2021-08-10 Thread Chet Ramey
On 8/9/21 10:00 PM, Franklin, Jason wrote: > If I run a script against a POSIX-compliant (PC) shell using only PC > syntax/features and then I run the same script with Bash in PC mode, I > would expect an identical result. To me, anything else indicates a bug > in one of the shells. Perhaps this

Re: GROUPS

2021-08-10 Thread Chet Ramey
On 8/9/21 5:35 PM, Franklin, Jason wrote: > Greetings: > > I discovered today that the GROUPS variable is special in Bash. It is. For everyone else: GROUPS An array variable containing the list of groups of which the current user is a member. Assignments to GROUPS have no effect.

Re: GROUPS

2021-08-09 Thread Greg Wooledge
On Mon, Aug 09, 2021 at 10:00:25PM -0400, Franklin, Jason wrote: > I did not write the scripts in question. These were actually Debian > package maintainer scripts that started failing. > > Perhaps I'll get a test added to "checkbashisms" that looks for this. A bug report against that Debian pac

Re: GROUPS

2021-08-09 Thread Franklin, Jason
Hey, Greg! I presume that you are the Wooledge who hosts the BashFAQ. If so, thanks for hosting that. It's a huge help. :) On Mon, 2021-08-09 at 20:36 -0400, Greg Wooledge wrote: > On Mon, Aug 09, 2021 at 05:35:56PM -0400, Franklin, Jason wrote: > > Should bash, invoked with "--posix" or as "s

Re: GROUPS

2021-08-09 Thread Greg Wooledge
On Mon, Aug 09, 2021 at 05:35:56PM -0400, Franklin, Jason wrote: > Should bash, invoked with "--posix" or as "sh", omit the special > treatment of variables such as GROUPS? I would say no. Using all-caps variable names is a bad idea for precisely this reason -- you never know when it'll be someth