Git development
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Jeff King <peff@peff.net>
Cc: Pushkar Singh <pushkarkumarsingh1970@gmail.com>,
	git@vger.kernel.org, gitster@pobox.com
Subject: Re: [RFC] archive: behavior of --prefix with absolute or parent path components
Date: Tue, 7 Apr 2026 22:24:14 +0000	[thread overview]
Message-ID: <adWEDmP7A5XzRcyP@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <20260407192454.GA754735@coredump.intra.peff.net>

[-- Attachment #1: Type: text/plain, Size: 2197 bytes --]

On 2026-04-07 at 19:24:54, Jeff King wrote:
> Yes, but note that with "-P" tar will happily allow those paths. They
> _can_ be useful, if you know what you are doing, but they aren't
> necessarily safe when coming from untrusted sources.
> 
> We can also generate zip files, but I think most unzip implementations
> have similar restrictions (info-zip does, with "-:" to override).

I suspect there are people using this with `/` because they want to
deploy files to places like `/etc`.  We've actually had requests for the
ability to have multiple roots in a repository so that people can do
this kind of thing, so I'm certain there are people finding _some_ way
to do it, even if not with this exact approach.

In conjunction with a tool like mtree(1) to adjust ownership and
permissions, this could be useful.

> In theory we could support other formats, but after 20 years I don't
> think anybody has bothered to do so. Cpio, anyone? :)

cpio doesn't have the long filename support that our pax (tar) archives
have, so I wouldn't recommend adding it.  The only place I still see
people use it is initramfs images for Linux.

> I don't recall it ever being discussed. Of the three you mentioned,
> "../" and leading "/" are potentially useful, so I don't think we'd want
> to disallow them entirely. At least some tar implementations require
> "-P" on the generating side to avoid mistakes, so we could follow that
> path.  It may be considered a regression by anybody who is using the
> feature currently, though.
> 
> The "////" is meaningless AFAICT, and could be replaced with a single
> slash. But I think it's also mostly harmless, as the reading side (well,
> the kernel) will equate "foo/////file" and "foo/file". I don't know if
> there are systems where that would not be the case.

Technically, POSIX allows `//` to be different than `/`, I believe,
although I'm not aware of anyone outside of Windows (and maybe Interix)
where that has any special meaning.  If you have such a system, it could
be useful to provide that as well as `/`.

I agree that it's more likely a typo, though.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 325 bytes --]

  parent reply	other threads:[~2026-04-07 22:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 16:21 [RFC] archive: behavior of --prefix with absolute or parent path components Pushkar Singh
2026-04-07 19:24 ` Jeff King
2026-04-07 19:57   ` Junio C Hamano
2026-04-07 22:24   ` brian m. carlson [this message]
2026-04-08 16:00 ` [PATCH] archive: document --prefix handling of absolute and parent paths Pushkar Singh
2026-04-08 17:40   ` Jeff King

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=adWEDmP7A5XzRcyP@fruit.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=pushkarkumarsingh1970@gmail.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