git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gitweb: using quotemeta
@ 2006-09-28 21:15 Luben Tuikov
  2006-09-28 23:18 ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Luben Tuikov @ 2006-09-28 21:15 UTC (permalink / raw)
  To: git

Commit ab41dfbfd4f3f9fedac71550027e9813b11abe3d introduces
the use of quotemeta to quote the $filename of the snapshot.
The commit message explains:

    Just in case filename contains end of line character.

But quotemeta quotes any characters not matching /A-Za-z_0-9/.
Which means that we get strings like this:
    
    linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz

Is this the desired behavior?  FWIW, the backslash character
is not part of of the name, but ended up when the snapshot was written
to the filesystem.

Thanks,
   Luben

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: gitweb: using quotemeta
@ 2006-10-06 18:24 Luben Tuikov
  0 siblings, 0 replies; 16+ messages in thread
From: Luben Tuikov @ 2006-10-06 18:24 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Jakub Narebski, git

--- Luben Tuikov <ltuikov@yahoo.com> wrote:
> --- Petr Baudis <pasky@suse.cz> wrote:
> > Dear diary, on Mon, Oct 02, 2006 at 10:12:56PM CEST, I got a letter
> > where Luben Tuikov <ltuikov@yahoo.com> said that...
> > > Escaping for the purposes of HTML _view_ and URL generation is ok,
> > > but it is not ok when _saving_ the file with a file name.
> > > 
> > > A file name is just a string of chars, and I want to _save_ the file
> > > name as its name is. No changes or interpretations please.  I don't
> > > care what the string is, what chars it is made of, etc.
> > > 
> > > Please don't interpret file names and their characters when the files
> > > are _saved_ by the user's browser.
> > > 
> > > The file name in my filesystem should be the exact same file name
> > > as it appears on any other filesystem hosting the same git repo.
> > > 
> > > I don't want this translation:
> > > Server FS: linux-2.6.git-5c2d97cb31fb77981797fec46230ca005b865799.tar.gz
> > > Quotemeta: linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz
> > > User FS: linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz
> > 
> > Then the user agent is buggy - which browser exhibits this behaviour?
> 
> Latest greatest Firefox for Linux.  And no, I don't think that
> the browser is broken.
> 
> > According to RFC2183, the filename is a value. According to RFC2045, a
> > value is either a token (uninteresting) or a quoted-string. According to
> > RFC822:
> > 
> >      quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or
> >                                                  ;   quoted chars.
> > 
> >      qtext       =  <any CHAR excepting <">,     ; => may be folded
> >                      "\" & CR, and including
> >                      linear-white-space>
> > 
> >      quoted-pair =  "\" CHAR                     ; may quote any char
> > 
> > So what we emit is completely correct.
> 
> (Your quotations do not seem correct according to 
>   ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt !)
> 
> Petr, I agree with your that what we emit is "completely correct".
> 
> But is is _mangled_.  I.e. why mangle the filename from "a.b" to
> "a\.b" ?  Indeed the latter _is_ qtext but it is not the original name
> given to the file.

Sorry, I ment to say that the latter doesn't appear to be qtext.

Bottomline is that quotemeta does not convert into qtext, and as thus
should never have been used.

Will fix as per your suggestions.

    Luben


> 
> What actually happened is that _gitweb_ itself mangles the name.
> 
> > Of course I have nothing against escaping just ", \ and CR. I don't mind
> > just substituting CR with some other string, but please just quote " and
> > \ correctly.
> 
> Indeed, these three are the only chars NOT ALLOWED in qtext.
> Will quote those.  Thanks for pointing this out.
> 
> > As of now, gitweb will not handle any filenames containing those three
> > characters properly because of now.
> 
> Will fix.
> 
> Thanks,
>    Luben
> 
> 
> 
> > 
> > -- 
> > 				Petr "Pasky" Baudis
> > Stuff: http://pasky.or.cz/
> > #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
> > $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
> > lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
> > 
> 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-10-11  9:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-28 21:15 gitweb: using quotemeta Luben Tuikov
2006-09-28 23:18 ` Junio C Hamano
2006-09-28 23:27   ` Luben Tuikov
2006-10-02  0:28     ` Jakub Narebski
2006-10-02 20:12       ` Luben Tuikov
2006-10-02 20:50         ` Jakub Narebski
2006-10-03  6:30           ` Junio C Hamano
2006-10-06 12:38             ` Jakub Narebski
2006-10-07  5:08               ` Junio C Hamano
2006-10-07  9:23                 ` Jakub Narebski
2006-10-07 17:41                   ` Luben Tuikov
2006-10-11  9:48                     ` Jakub Narebski
2006-10-06 13:50         ` Petr Baudis
2006-10-06 18:21           ` Luben Tuikov
2006-10-06 18:45             ` Petr Baudis
  -- strict thread matches above, loose matches on Subject: below --
2006-10-06 18:24 Luben Tuikov

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).