On Dec  5 19:30, Corinna Vinschen via Cygwin wrote:
> On Dec  5 13:40, Corinna Vinschen via Cygwin wrote:
> > On Dec  5 09:28, Marco Atzeri via Cygwin wrote:
> > > On 04/12/2025 21:50, Brian Inglis via Cygwin wrote:
> > > > On 2025-12-04 08:00, Jon Turney via Cygwin wrote:
> > > > > Actually, I think this is a shortcoming of the cygwin version of 
> > > > > newgrp.
> > > > > The SUS description [1] of newgrp allows a numeric group id to be
> > > > > specified.
> > > > > (In fact, it includes the clarifying remark "If group is a non-
> > > > > negative numeric string and exists in the group database as a group
> > > > > name, the numeric group ID associated with that group name will be
> > > > > used as the group ID", which suggests a, um, straightforward
> > > > > implementation)
> > > > > But it seems that our implementation only currently handles a group
> > > > > name (See [2]).
> > > > > [1] https://pubs.opengroup.org/onlinepubs/7908799/xcu/newgrp.html
> > > > 
> > > > That's OG SUSV2 1997 - current is at:
> > > > 
> > > >      
> > > > https://pubs.opengroup.org/onlinepubs/9799919799/utilities/newgrp.html
> > > > 
> > > > > [2] 
> > > > > https://cygwin.com/cgit/newlib-cygwin/tree/winsup/utils/newgrp.c#n166
> > 
> > Shouldn't be too hard to add to our newgrp(1).
> 
> Uhm... there's a problem here.
> 
> Right now, our newgrp is commandline compatible with Linux' newgrp from
> shadow-utils:
> 
> - A single '-' reinitializes the environment.
> - The group must be given as name, not as GID.
> 
> This is not commandline compatible with the POSIX definition:
> 
> - A '-l' reinitializes the environment.
> - The group may be given as name or GID.
> 
> I can't just change it to POSIX compatible because this potentially
> breaks Linux compatibility.
> 
> What we could do is to check the POSIXLY_CORRECT environment variable
> and switch the identity to POSIX if this variable is set.
> 
> Make sense?

No, scratch that, it's much eaiser.  shadow-utils newgrp let's -l slip
through, any other -X results in a usage message.  I can change Cygwin's
newgrp accordingly.

The only non-compatibility is that Cygwin's newgrp allows to specify a
command.   shadow-utils nad POSIX newgrp only create a new shell
environment.

I guess we can ignore this...


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to