public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: /usr/bin/sg in Cygwin?
Date: Mon, 22 Apr 2024 10:54:33 +0200	[thread overview]
Message-ID: <ZiYlyYg36BkHeuAv@calimero.vinschen.de> (raw)
In-Reply-To: <CALXu0Uen=vmJ5a8bv7ikOfHf_me0+uPkfcUHSPvugBMj_Vg_SA@mail.gmail.com>

On Apr 22 07:55, Cedric Blancher via Cygwin wrote:
> On Mon, 22 Apr 2024 at 01:20, Dan Shelton via Cygwin <cygwin@cygwin.com> wrote:
> >
> > On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> wrote:
> > >
> > > On 2024-04-19 17:47, Dan Shelton via Cygwin wrote:
> > > > On Fri, 23 Feb 2024 at 22:25, Dan Shelton wrote:
> > > >> Is there a package which provides /usr/bin/sg (execute shell commands
> > > >> in a different group)?
> > >
> > > The POSIX standard command is newgrp - install cygwin-doc to see Cygwin (and
> > > newlib libc) man pages (and info, html, PDF docs), man-pages-posix to see POSIX
> > > man pages, and man-pages-linux if you want to see recent Linux release man pages.
> > >
> > > To see possibly relevant commands, run:
> > >
> > > $ apropos -s 1,1p group
> > > chgrp (1)            - change group ownership
> > > chgrp (1p)           - change the file group ownership
> > > chown (1)            - change file owner and group
> > > g3topbm (1)          - convert a Group 3 fax file into a PBM image
> > > groups (1)           - print the groups a user is in
> > > id (1)               - print real and effective user and group IDs
> > > make (1)             - GNU Make utility to maintain groups of programs
> > > make (1p)            - maintain, update, and regenerate groups of programs
> > > mkgroup (1)          - Write /etc/group-like output to stdout
> > > newgrp (1)           - change primary group for a command
> > > newgrp (1p)          - change to a new group
> > > pbmtog3 (1)          - convert a PBM image into a Group 3 MH fax file
> >
> > newgrp(1) is USELESS. It only opens an interactive shell, but does not
> > allow the user to execute a non-interactive script with the requested
> > group like bash -c does.
> 
> Linux /usr/bin/sg source is in
> https://github.com/shadow-maint/shadow/blob/master/src/newgrp.c
> So this is just a packaging issue that whoever does the Cygwin newgrp
> package has to package /usr/bin/sg too

newgrp(1) is a Cygwin util from the base package:

  $ cygcheck -f /usr/bin/newgrp
  cygwin-3.6.0-0.109.ga0a25849f9dd

Reason being that the functionality under Windows is pretty limited
compared to "real" POSIX systems...

https://cygwin.com/cygwin-ug-net/newgrp.html

...and fetching the default environment of the user (to implement the
dash option '-') is pretty different from any other known POSIX system,
having to use Windows functions:

  https://cygwin.com/cgit/newlib-cygwin/tree/winsup/utils/newgrp.c

If anybody thinks he or she can provide a useful shadow-utils
package, feel free.  But it might not be worth the effort, probably.


Corinna

  reply	other threads:[~2024-04-22  8:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23 21:25 Dan Shelton
2024-04-19 23:47 ` Dan Shelton
2024-04-20  5:38   ` Brian Inglis
2024-04-21 23:20     ` Dan Shelton
2024-04-22  1:35       ` Eliot Moss
2024-04-22  8:46         ` Corinna Vinschen
2024-04-22  5:55       ` Cedric Blancher
2024-04-22  8:54         ` Corinna Vinschen [this message]
2024-04-22  5:35     ` Cedric Blancher
2024-04-22 17:40       ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZiYlyYg36BkHeuAv@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).