git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Eric Sunshine <sunshine@sunshineco.com>,
	Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v2] fast-import: disallow "." and ".." path components
Date: Tue, 26 Nov 2024 07:57:57 +0100	[thread overview]
Message-ID: <Z0Vxb4OVJYeAdgds@pks.im> (raw)
In-Reply-To: <pull.1831.v2.git.1732561248717.gitgitgadget@gmail.com>

On Mon, Nov 25, 2024 at 07:00:48PM +0000, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail.com>
> 
> If a user specified e.g.
>    M 100644 :1 ../some-file
> then fast-import previously would happily create a git history where
> there is a tree in the top-level directory named "..", and with a file
> inside that directory named "some-file".  The top-level ".." directory
> causes problems.  While git checkout will die with errors and fsck will
> report hasDotdot problems, the user is going to have problems trying to
> remove the problematic file.  Simply avoid creating this bad history in
> the first place.

Makes sense.

More generally this made me wonder whether we should maybe extract some
bits out of "fsck.c" so that we don't have to duplicate the checks done
there in git-fast-import(1). This would for example include checks for
".git" and its HFS/NTFS variants as well as tree entry length checks for
names longer than 4096 characters.

This of course does not have to be part of your patch, which looks good
to me.

Thanks!

Patrick

  reply	other threads:[~2024-11-26  6:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 17:58 [PATCH] fast-import: disallow "." and ".." path components Elijah Newren via GitGitGadget
2024-11-25 18:15 ` Eric Sunshine
2024-11-25 18:24   ` Elijah Newren
2024-11-25 19:00 ` [PATCH v2] " Elijah Newren via GitGitGadget
2024-11-26  6:57   ` Patrick Steinhardt [this message]
2024-11-27 14:24     ` Jeff King
2024-11-27 23:07       ` Junio C Hamano
2024-11-27  8:28   ` Kristoffer Haugsbakk
2024-11-27 13:23     ` Re* " Junio C Hamano
2024-11-27 19:41       ` Eric Sunshine
2024-11-28  0:36       ` [PATCH v2] CodingGuidelines: a handful of error message guidelines Junio C Hamano
2024-11-28  7:57         ` Eric Sunshine
2024-11-28  9:28           ` Junio C Hamano
2024-11-28  9:51             ` Eric Sunshine

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=Z0Vxb4OVJYeAdgds@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=newren@gmail.com \
    --cc=sunshine@sunshineco.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 NNTP newsgroup(s).