From: "Jason Pyeron" <jpyeron@pdinc.us>
To: <git@vger.kernel.org>
Cc: "'Junio C Hamano'" <gitster@pobox.com>, "'René Scharfe'" <l.s.r@web.de>
Subject: RE: git archive setting user and group
Date: Fri, 22 Jan 2021 17:51:11 -0500 [thread overview]
Message-ID: <078701d6f111$14d304c0$3e790e40$@pdinc.us> (raw)
In-Reply-To: <xmqqsg6s61x2.fsf@gitster.c.googlers.com>
> From: Junio C Hamano
> Sent: Friday, January 22, 2021 5:29 PM
>
> René Scharfe <l.s.r@web.de> writes:
>
> > Am 22.01.21 um 21:40 schrieb Jason Pyeron:
> > ...
> >> xsnprintf(header->uid, sizeof(header->uid), "%07o", 0);
> >> xsnprintf(header->gid, sizeof(header->gid), "%07o", 0);
> >> strlcpy(header->uname, "root", sizeof(header->uname));
> >> strlcpy(header->gname, "root", sizeof(header->gname));
> >
> > Adding support for using a custom user and group should be easy. Is
> > this just a cosmetic thing? Regular users would ignore the user info in
> > the archive, and root should not be used for extracting, and on systems
> > that don't have a logwatch user this wouldn't make a difference anyway,
> > right?
>
> I am not particularly interested in cosmetics, but it probably is OK
> to make uname/gname overridable. I do not see any point in uid/gid
> numeric values overridable, though. Just like user names and group
Interesting. So logwatch(0) vs logwatch(1100) ? I guess it is as good as any value, but tar never uses 0.
On a system without the logwatch user/group tar behaves as follows:
$ tar czf /tmp/logwatch.tgz --owner=logwatch --group=logwatch .
$ tar tvzf /tmp/logwatch.tgz | head -n 1
drwxrwxr-x logwatch/logwatch 0 2020-03-14 15:01 ./
$ tar tvzf /tmp/logwatch.tgz --numeric-owner | head -n 1
drwxrwxr-x 1049681/1049088 0 2020-03-14 15:01 ./
$ id
uid=1049681(myuser) gid=1049088(mygroup) groups=no one cares...
but when the user / group is known...
$ tar czf /tmp/logwatch.tgz --owner=Guest --group=Users .
$ tar tvzf /tmp/logwatch.tgz | head -n 1
drwxrwxr-x Guest/Users 0 2020-03-14 15:01 ./
$ tar tvzf /tmp/logwatch.tgz --numeric-owner | head -n 1
drwxrwxr-x 1049077/545 0 2020-03-14 15:01 ./
$ getent passwd Guest | cut -f 3 -d :
1049077
$ getent group Users | cut -f 3 -d :
545
> names do not name the same user and group on every machine, uid/gid
> are even less so.
>
>
next prev parent reply other threads:[~2021-01-22 22:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 20:40 git archive setting user and group Jason Pyeron
2021-01-22 21:00 ` René Scharfe
2021-01-22 21:13 ` Jason Pyeron
2021-01-22 21:39 ` Konstantin Ryabitsev
2021-01-22 22:02 ` Jason Pyeron
2021-01-22 22:28 ` Ævar Arnfjörð Bjarmason
2021-01-23 1:05 ` brian m. carlson
2021-01-23 4:58 ` Jeff King
2021-01-23 5:16 ` Konstantin Ryabitsev
2021-01-23 5:11 ` Konstantin Ryabitsev
2021-01-22 22:29 ` Junio C Hamano
2021-01-22 22:51 ` Jason Pyeron [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-01-22 20:09 Jason Pyeron
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='078701d6f111$14d304c0$3e790e40$@pdinc.us' \
--to=jpyeron@pdinc.us \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.