git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Vadim Zeitlin <vz-git@zeitlins.org>
Cc: git@vger.kernel.org
Subject: Re: Would it be possible to add an option to disable validating submodule paths?
Date: Tue, 7 Jan 2025 23:09:56 +0000	[thread overview]
Message-ID: <Z320RGb0tqNyvvxt@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <Mahogany-0.68.0-2854301-20250107-230058.01@dark.tt-solutions.com>

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

On 2025-01-07 at 22:00:58, Vadim Zeitlin wrote:
>  In e8d0608944 (submodule: require the submodule path to contain
> directories only, 2024-03-26) a check that submodule paths don't contain
> symlinks was added to Git. I understand that this check is generally useful
> and helpful, but I'd really like to have some way of disabling it for some
> trusted repositories and _allow_ some of their submodules to be symlinks
> (see below for the rationale).
> 
>  Unfortunately, there doesn't seem to be any way to do it currently and I'd
> like to ask if I might, perhaps, be missing such a way or, if I don't,
> whether a patch adding an option to do it could be accepted?
> 
>  As to why I'd like to disable it, it's the usual story: this change broke
> my workflow (https://xkcd.com/1172/). I have a relatively big Git
> repository that I use as a submodule in many of the projects I'm working on
> and I used to just symlink the corresponding submodule directory to one,
> primary copy of this repository present on my system, instead of really
> initializing the submodule. This saved me many gigabytes of disk space and
> is also much faster than reinitializing the submodule every time I start a
> new project or, more frequently, create a new worktree for the existing
> one. And this worked just fine for many years but doesn't work any longer
> as any operation on the repository, even just "git status", now gives
> 
> error: expected submodule path 'submodule/path' not to be a symbolic link
> 
> as soon as a symlink is detected. Under Linux I can use mount binds
> instead, but this is much less convenient for many reasons and I'd really
> prefer to just keep using symlinks. Would it be possible to (optionally)
> allow using them again?

Since this is a defense-in-depth change and it seems to have broken a
reasonable workflow, I think adding a config option for this would be
reasonable.  We've recently had some discussions on trying to limit the
defense-in-depth measures we implement on the security list in the
interests of allowing better discussion and feedback on the main list
and avoiding regressions in people's workflows, and I think your email
lends support to that approach.

I'm not presently planning to add such an option, but it shouldn't be
too hard to add a global variable for that (or maybe something under
struct repository) that's updated when parsing config, and then check it
in `validate_submodule_path`.  We'd need docs for that option as well,
but that would probably be it if someone wanted to do so.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

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

  reply	other threads:[~2025-01-07 23:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 22:00 Would it be possible to add an option to disable validating submodule paths? Vadim Zeitlin
2025-01-07 23:09 ` brian m. carlson [this message]
2025-01-07 23:25   ` Junio C Hamano
2025-01-07 23:50     ` Re[2]: " Vadim Zeitlin
2025-01-08 16:03       ` Junio C Hamano
2025-01-08 19:30         ` Re[2]: " Vadim Zeitlin
2025-07-28 23:12           ` [PATCH] submodule: Add a config option to skip path validation Vadim Zeitlin

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=Z320RGb0tqNyvvxt@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=vz-git@zeitlins.org \
    /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).