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

Re: Stupid quoting...

From
David Kastrup <dak@gnu.org>
Date
Jun 14, 2007, 06:12 UTC
Message-ID
<86wsy76p4v.fsf@lola.quinscape.zz>
In-Reply-To
<Pine.LNX.4.64.0706140145450.4059@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 20 quoted lines
> Hi,
>
> [somehow I got the impression your mail did not make it to the list]
>
> On Wed, 13 Jun 2007, David Kastrup wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> 
>> > On Wed, 13 Jun 2007, David Kastrup wrote:
>> >
>> >> what is the point in quoting file names and their characters in
>> >> git-diff's output?  And what is the recommended way of undoing the
>> >> damage?
>> >
>> > The recommended way is not using spaces to begin with.
>> 
>> Who is talking about spaces?
>
> That is the common reason for quoting. I mean, really, how many files do 
> you have which contain newlines or backslashes or tabs? Huh?
I am talking about non-ASCII characters.
Show 10 quoted lines
>
>> > I mean, does "David" contain spaces?
>> 
>> "Günter" contains non-ASCII characters.
>
> And "Guenther" (sorry, have problems with my mailer, so I simulate
> it in plain ASCII" does not need quotes, _even_ if containing
> non-ASCII characters.
>
> So what exactly was your point again?

You _are_ aware that git writes out \303\274 (8 characters: 2 backslashes and 6 digits) instead of ü in a file name? And I am talking about a pure utf-8 locale.

LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=

My point was that these octal escape sequences are utterly pointless.
Show 22 quoted lines
>> > People seem not to see the problem, and fail to blame Microsoft for 
>> > all the damage they have done, introducing that stupid, stupid concept 
>> > of filenames containing spaces, and _enforcing_ it.
>> 
>> The concept of UNIX file names is _any_ byte sequence not
>> containing "/" or an ASCII NUL.  Microsoft actually prohibits quite
>> a few more characters.  Filenames with spaces first came into
>> serious use under MacOS, the first graphical user interface where
>> no shell and metacharacters interfered with the choice of file
>> names.
>> 
>> Blaming Microsoft here is completely ridiculous.
>
> It is completely unridiculous. Before Microsoft -- in its infinite
> wisdom -- decided to create folders like "Program Files", and
> "Documents and Settings", and made it the _default_ (of all things)
> to save its ridiculous Word documents as "New Document", _nobody_ on
> this planet even _thought_ about including stupid whitespace in a
> filename.
>
> You can tell that this is true by looking at now-ancient Unix
> scripts.

You are making a spectacle of yourself. Do you even read what you are replying to? When spaces became commonplace in _MacOS_, _MacOS_ was by no means Unix-based. Microsoft only followed the trend (with a delay of several years, by the way) when imitating the MacOS GUI.

Show 29 quoted lines
>> >> I have something like
>> >> 
>> >> git-diff -M -C --name-status -r master^ master | {
>> >>     while read -r flag name
>> >>     do
>> >> 	case "$name" in *\\[0-3][0-7][0-7]*)
>> >> 		name=$(echo -e $(echo "$name"|sed 's/\\\([0-3][0-7][0-7]\)/\\0\1/g;s/\\\([^0]\)/\\\\\1/g'))
>> >> 	esac
>> >>         [...]
>> >> 
>> >> in order to get through the worst with utf-8 file names, and it is a
>> >> complete nuisance (double quotemarks are treated later).
>> >
>> > Please understand that the quotes are not there for you, but for 
>> > processing by other programs.
>> >
>> > However, I _suspect_ that you want to do something like
>> >
>> > 	name="$(echo $name)"
>> >
>> > because "echo" is exactly one of the programs this quoting was invented 
>> > for.
>> 
>> Only that it does not work with echo.  echo requires \0NNN for
>> octal escapes, not \NNN, and then only when "echo -e" is used.
>
> Um. How does that apply here? Git only does quoting so that programs
> like echo get it right, when passed the name? No funny \0NNN or \NNN
> or whatever?
git puts out funny \NNN quotes.  That's what I am complaining about.
Show 6 quoted lines
>> You are really haphazard in distributing your blame.
>> 
>> Can you actually name a program that would work with the default
>> output of git here?
>
> echo.

It doesn't, since it does not interpret the \NNN escape sequences that git chooses to output.

-- 
David Kastrup
Previous: Johannes SchindelinNext: Alex Riesen
Message 17 of 35 in “Stupid quoting...”
  1. David KastrupJun 13, 2007
  2. Alex RiesenJun 13, 2007
  3. Johannes SchindelinJun 13, 2007
  4. Steven GrimmJun 14, 2007
  5. Johannes SchindelinJun 14, 2007
  6. Steven GrimmJun 14, 2007
  7. Johannes SchindelinJun 14, 2007
  8. Junio C HamanoJun 14, 2007
  9. Jakub NarebskiJun 16, 2007
  10. David KastrupJun 18, 2007
  11. Jeff KingJun 18, 2007
  12. Johannes SchindelinJun 19, 2007
  13. David KastrupJun 19, 2007
  14. Johannes SchindelinJun 19, 2007
  15. Olivier GalibertJun 19, 2007
  16. Johannes SchindelinJun 14, 2007
  17. David KastrupJun 14, 2007
  18. Alex RiesenJun 14, 2007
  19. Alex RiesenJun 14, 2007
  20. Johannes SchindelinJun 20, 2007
  21. Junio C HamanoJun 20, 2007
  22. David KastrupJun 20, 2007
  23. Jakub NarebskiJun 20, 2007
  24. David KastrupJun 20, 2007
  25. Jan HudecJun 24, 2007
  26. Robin RosenbergJun 24, 2007
  27. Junio C HamanoJun 24, 2007
  28. David KastrupJun 24, 2007
  29. Junio C HamanoJun 24, 2007
  30. Jeff KingJun 24, 2007
  31. Jan HudecJun 24, 2007
  32. Robin RosenbergJun 24, 2007
  33. David KastrupJun 24, 2007
  34. Robin RosenbergJun 24, 2007
  35. David KastrupJun 24, 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.