All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jason Pyeron" <jpyeron@pdinc.us>
To: "'René Scharfe'" <l.s.r@web.de>, git@vger.kernel.org
Subject: RE: git archive setting user and group
Date: Fri, 22 Jan 2021 16:13:15 -0500	[thread overview]
Message-ID: <045801d6f103$664852a0$32d8f7e0$@pdinc.us> (raw)
In-Reply-To: <cef51cd3-c6b5-ed24-f695-83be3a6743b4@web.de>

> From: René Scharfe 
> Sent: Friday, January 22, 2021 4:00 PM
> 
> Am 22.01.21 um 21:40 schrieb Jason Pyeron:
> >> From: Jason Pyeron
> >> Sent: Friday, January 22, 2021 3:09 PM
> >>
> >> I am about to make a release for logwatch tonight. Historically the files are owned by logwatch in
> the
> >> tgz file. When I use git archive it is owned by uid 0, is there an option to set the uid/uname,
> >> gid/gname owner of the files?
> >
> > Answer: not at this time, as it is hard coded in the source.
> >
> > archive-tar.c:
> > static void prepare_header(struct archiver_args *args,
> >                            struct ustar_header *header,
> >                            unsigned int mode, unsigned long size)
> > {
> >         xsnprintf(header->mode, sizeof(header->mode), "%07o", mode & 07777);
> >         xsnprintf(header->size, sizeof(header->size), "%011"PRIoMAX , S_ISREG(mode) ?
> (uintmax_t)size : (uintmax_t)0);
> >         xsnprintf(header->mtime, sizeof(header->mtime), "%011lo", (unsigned long) args->time);
> >
> >         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));
> >
> >
> > meh.
> >
> 
> 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

In this case, likely a cosmetic thing. 

> the archive, and root should not be used for extracting, and on systems

But I can think of situations, where it would matter - and I do not agree that "root should not be used for extraction".

> that don't have a logwatch user this wouldn't make a difference anyway,
> right?

I updated the hard coded values to match what was needed, did a make and presto all was happy.

The backend should take:

--group=NAME
--group-id=GID
--owner=NAME
--owner-id=UID

Patch wanted?


  reply	other threads:[~2021-01-22 21:15 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 [this message]
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
  -- 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='045801d6f103$664852a0$32d8f7e0$@pdinc.us' \
    --to=jpyeron@pdinc.us \
    --cc=git@vger.kernel.org \
    --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.