git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] submodule: prevent backslash expantion in submodule names

From
JDJoachim Durchholz <jo@durchholz.org>
Date
Apr 8, 2017, 20:32 UTC
Message-ID
<d8ef00f6-4ec0-dfcb-dc49-71f27538eb2f@durchholz.org>
In-Reply-To
<20170408105901.2osi2zadboqxhf34@sigill.intra.peff.net>
Am 08.04.2017 um 12:59 schrieb Jeff King:
> The reason I mentioned escaping earlier is I wondered what would happen
> when the submodule starts with a double-quote, or has a newline in the
> name.
I have tested newlines within the name, these work fine.

I also tested double and single quotes within the name, but not at beginning or end.

Show 13 quoted lines
> So I think your patch is fine there. But it does raise a few concerns.
> It looks like git-submodule does not cope well with exotic filenames:
>
>   $ git submodule add /some/repo "$(printf 'sub with\nnewline')"
>   Cloning into '/home/peff/tmp/sub with
>   newline'...
>   done.
>   error: invalid key (newline): submodule.sub with
>   newline.url
>   error: invalid key (newline): submodule.sub with
>   newline.path
>   Failed to register submodule 'sub with
>   newline'

Strange. I'm running essentially the same kind of request, and things work fine. Might be due to me using Python3 instead of bash, or maybe due to different versions of git.

If anybody is interested, I can publish my test code on github, it was scheduled to land there anyway.

> I'm not too worried about that.  It's a nonsense request, and our config
> format has no syntactic mechanism to represent that key.

Oh. I've been thinking that the quoted format is exactly for that kind of stuff. Though it might be prone to eol conversion if a submodule name contains crlf sequences.

Also, funny behavour. Experience has taught me that funny behaviour, if it isn't exploitable today, may combine with some new funny behaviour in a future version of the same software. So I'm worried even with that.

This is starting to look like a can of worms to me... one way to "close 
the lid" would be if git
* defined what's a valid submodule name,
* rejected invalid submodule names, and
* documented validity rules in the git-submodule docs.
YMMV, just my 2 cents :-)

Regards, Jo

Previous: Jeff KingNext: Junio C Hamano
Message 10 of 11 in “problem with backslash in directory name”
  1. Joachim DurchholzApr 7, 2017
  2. Jeff KingApr 7, 2017
  3. Joachim DurchholzApr 7, 2017
  4. Joachim DurchholzApr 7, 2017
  5. Brandon WilliamsApr 7, 2017
  6. Stefan BellerApr 7, 2017
  7. submodule: prevent backslash expantion in submodule namesBrandon Williams, Apr 7, 2017
  8. Joachim DurchholzApr 7, 2017
  9. Jeff KingApr 8, 2017
  10. Joachim DurchholzApr 8, 2017
  11. Junio C HamanoApr 17, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.