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

git-clean fails to remove a file whose name contains \\, ", or \n, TAB, etc.

From
Jim Meyering <jim@meyering.net>
Date
May 8, 2007, 20:32 UTC
Message-ID
<87ps5bhx8t.fsf@rho.meyering.net>

Not that it matters (or maybe this is a feature :-), because people who create such files in their working directory deserve what they get, Eh? :-)

But if leaving it, then perhaps git-clean should at least warn that it's not doing its job (i.e. remove the uses of rm's "-f").

To reproduce, run these commands:

nl=' ' git-init > /dev/null && touch "x\\n\"$nl" && git-clean && ls -b

Here's the output I get:
    Removing "x\\n\"\n"
    .git/  x\\n"\n

git-clean.sh needs to strip off leading and trailing double quotes (easy) as well as convert escapees back to originals (not easy as you might think, in sh) before running rm. Good excuse to rewrite it in perl.

Next: Randal L. Schwartz
Message 1 of 8 in “git-clean fails to remove a file whose name contains \\, ", or \n, TAB, etc.”
  1. Jim MeyeringMay 8, 2007
  2. Randal L. SchwartzMay 8, 2007
  3. Junio C HamanoMay 8, 2007
  4. Jan HudecMay 8, 2007
  5. Randal L. SchwartzMay 8, 2007
  6. Karl HasselströmMay 8, 2007
  7. Randal L. SchwartzMay 8, 2007
  8. Karl HasselströmMay 8, 2007

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.