On Thu, Aug 29, 2024 at 08:46:41AM GMT, Gábor Németh wrote:
> > I would appreciate help typing in the additional code and submitting
> > that to upstream, so we don't have to diverge from upstream forever.
> 
> I did the typing-in part and have a small patch [1].

Wow, great work!

> Before seding the PR I'd appreciate a quick sync with you.
> 
> My approach was to simply add the second argument, making an sg symlink
> trivially work. Possible objection may be that original newgrp did not
> accept the command argument, thus `newgrp group some-cmd` would execute
> some-cmd instead of ignoring it. Also upstream advises against adding
> new short options [2] but I can argue that in case of `newgrp` we are
> returning to some established behavior (sg), or that the cited SUSv2 is
> not followed to the letter anyway as eg. it prescribes accepting '-' as
> the group name, which upstream does not do. A solution complicating the
> patch would be to test for argv[0] if we're called as `sg` but I found
> that ugly and can't decide.

Okay, I hear your conccerns.

For sg, I think one can argue the value of providing it is in
providing it with the existing behaviour from shadow, providing
compatibility.
A completely interface would certainly look differently.

> I'd appreciate your thoughts.

I've dug around a bit in the upstream sources, and it appears they
like separate source files with their own main() function for each
program name.

But I'd advise sending the patch upstream and/or to the mailing list
and seeing what they think!

Best,
Chris

Reply via email to