git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@CS.UCLA.EDU>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Junio C Hamano <junkio@cox.net>,
	Robert Fitzsimons <robfitz@273k.net>,
	Alex Riesen <raa.lkml@gmail.com>,
	git@vger.kernel.org, Kai Ruemmler <kai.ruemmler@gmx.net>
Subject: Re: [PATCH] Try URI quoting for embedded TAB and LF in pathnames
Date: Tue, 11 Oct 2005 11:03:59 -0700	[thread overview]
Message-ID: <87ek6s0w34.fsf@penguin.cs.ucla.edu> (raw)
In-Reply-To: <Pine.LNX.4.64.0510110802470.14597@g5.osdl.org> (Linus Torvalds's message of "Tue, 11 Oct 2005 08:17:25 -0700 (PDT)")

Linus Torvalds <torvalds@osdl.org> writes:

> Personally, I'd like the normal C quoting the best.

That would be fine with me too.  How about if we use the equivalent of
--quoting-style="c" for file names that contain funny bytes, and no
quoting for other file names?  So, for example, something like this:

    diff --git "space tab\tnewline\nquote\"backslash\\" b/dee/pqr
    similarity index 72%
    rename from "space tab\tnewline\nquote\"backslash\\"
    rename to dee/pqr
    index 9ee055c..243fbbc 100644
    --- "space tab\tnewline\nquote\"backslash\\"
    +++ b/dee/pqr
    @@ -1 +1,3 @@
     Fri Oct  7 23:19:04 PDT 2005
    +foo
    +foo

The surrounding double-quotes are an extra indication to the human
reader that there is something weird about the quoted file name.

> Use filenames as if they are just binary blobs of data, 
> that's the only thing that has a high chance of success.

Thanks for thinking those things through.  I agree mostly, but there's
still a technical problem, in that we have to decide what a "funny
byte" is if we are using C-style quoting.  For example, the simplest
approach is to say a byte is funny if it is space, backslash, quote,
an ASCII control character, or is non-ASCII.  But this will cause
perfectly-reasonable UTF-8 file names to be presented in git format
using unreadable strings like "a\293\203\257b" or whatever.

Perhaps it would be better to say that a byte is "funny" if it is
space, backslash, quote, an ASCII control character, or a byte that is
not part of a valid UTF-8 encoding.  This will let UTF-8 file names
through unscathed, while still warning the reader when funny business
is going on.  File names with other encodings (e.g., Shift-JIS) will
contain lots of backslashes, but that's OK: we don't mind making
nonstandard encodings hard-to-read, so long as we preserve the bytes
correctly.

We could implement in other GNU applications by having a new quoting
style that supports this quoting behavior.  I can arrange for that.


> If somebody wants to use names with tabs and newlines, is he really
> going to work with diffs? Or is it just a driver error?

The current-supported scheme with 'diff' and 'patch' should work for
everything but newlines.  I like the idea of getting it to work even
with newlines, and I am willing to sacrifice old patches with file
names starting with '"' (extremely rare, if any) to get newlines to
work.  Among other things I worry about people submitting
purposely-malformed patches in non-git environments.

  reply	other threads:[~2005-10-11 18:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-07 19:35 [RFC] embedded TAB and LF in pathnames Junio C Hamano
2005-10-07 23:29 ` Alex Riesen
2005-10-07 23:44   ` Junio C Hamano
2005-10-08  6:45     ` Alex Riesen
2005-10-08  9:10       ` Junio C Hamano
2005-10-08 13:30         ` [PATCH] Try URI quoting for " Robert Fitzsimons
2005-10-08 18:30           ` Junio C Hamano
2005-10-08 20:19             ` Junio C Hamano
2005-10-11  6:20               ` Paul Eggert
2005-10-11  7:37                 ` Junio C Hamano
2005-10-11 15:17                 ` Linus Torvalds
2005-10-11 18:03                   ` Paul Eggert [this message]
2005-10-11 18:37                     ` Linus Torvalds
2005-10-11 19:42                       ` Paul Eggert
2005-10-11 20:56                         ` Linus Torvalds
2005-10-12  6:51                           ` Paul Eggert
2005-10-12 14:59                             ` Linus Torvalds
2005-10-12 19:07                               ` Daniel Barkalow
2005-10-12 19:52                                 ` Linus Torvalds
2005-10-12 20:21                                   ` H. Peter Anvin
     [not found]                               ` <87vf02qy79.fsf@penguin.cs.ucla.edu>
2005-10-12 21:02                                 ` Junio C Hamano
2005-10-12 21:05                                 ` Linus Torvalds
2005-10-12 21:09                                   ` H. Peter Anvin
2005-10-12 21:15                                   ` Johannes Schindelin
2005-10-12 21:33                                   ` Junio C Hamano
2005-10-14  0:57                                   ` Paul Eggert
2005-10-14  5:43                                     ` Linus Torvalds
2005-10-12 21:24                                 ` Linus Torvalds
2005-10-14  0:16                                   ` Paul Eggert
2005-10-14  5:20                                     ` Linus Torvalds
2005-10-14 17:18                                       ` H. Peter Anvin
2005-10-14  6:59                                 ` Junio C Hamano
2005-10-09 10:42           ` Junio C Hamano

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=87ek6s0w34.fsf@penguin.cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=kai.ruemmler@gmx.net \
    --cc=raa.lkml@gmail.com \
    --cc=robfitz@273k.net \
    --cc=torvalds@osdl.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).