{"thread":{"id":"5838","subject":"Re: gitweb: using quotemeta","startedAt":"2006-10-06T18:24:09Z","lastAt":"2006-10-06T18:45:37Z","messageCount":2,"participants":["Luben Tuikov","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"28310","messageId":"20061006182409.87381.qmail@web31812.mail.mud.yahoo.com","threadId":"5838","inReplyTo":null,"subject":"Re: gitweb: using quotemeta","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-10-06T18:24:09Z","receivedAt":"2006-10-06T18:24:09Z","isPatch":false,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"--- Luben Tuikov <ltuikov@yahoo.com> wrote:\n> --- Petr Baudis <pasky@suse.cz> wrote:\n> > Dear diary, on Mon, Oct 02, 2006 at 10:12:56PM CEST, I got a letter\n> > where Luben Tuikov <ltuikov@yahoo.com> said that...\n> > > Escaping for the purposes of HTML _view_ and URL generation is ok,\n> > > but it is not ok when _saving_ the file with a file name.\n> > > \n> > > A file name is just a string of chars, and I want to _save_ the file\n> > > name as its name is. No changes or interpretations please.  I don't\n> > > care what the string is, what chars it is made of, etc.\n> > > \n> > > Please don't interpret file names and their characters when the files\n> > > are _saved_ by the user's browser.\n> > > \n> > > The file name in my filesystem should be the exact same file name\n> > > as it appears on any other filesystem hosting the same git repo.\n> > > \n> > > I don't want this translation:\n> > > Server FS: linux-2.6.git-5c2d97cb31fb77981797fec46230ca005b865799.tar.gz\n> > > Quotemeta: linux\\-2\\.6\\.git\\-5c2d97cb31fb77981797fec46230ca005b865799\\.tar\\.gz\n> > > User FS: linux\\-2\\.6\\.git\\-5c2d97cb31fb77981797fec46230ca005b865799\\.tar\\.gz\n> > \n> > Then the user agent is buggy - which browser exhibits this behaviour?\n> \n> Latest greatest Firefox for Linux.  And no, I don't think that\n> the browser is broken.\n> \n> > According to RFC2183, the filename is a value. According to RFC2045, a\n> > value is either a token (uninteresting) or a quoted-string. According to\n> > RFC822:\n> > \n> >      quoted-string = <\"> *(qtext/quoted-pair) <\">; Regular qtext or\n> >                                                  ;   quoted chars.\n> > \n> >      qtext       =  <any CHAR excepting <\">,     ; => may be folded\n> >                      \"\\\" & CR, and including\n> >                      linear-white-space>\n> > \n> >      quoted-pair =  \"\\\" CHAR                     ; may quote any char\n> > \n> > So what we emit is completely correct.\n> \n> (Your quotations do not seem correct according to \n>   ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt !)\n> \n> Petr, I agree with your that what we emit is \"completely correct\".\n> \n> But is is _mangled_.  I.e. why mangle the filename from \"a.b\" to\n> \"a\\.b\" ?  Indeed the latter _is_ qtext but it is not the original name\n> given to the file.\n\nSorry, I ment to say that the latter doesn't appear to be qtext.\n\nBottomline is that quotemeta does not convert into qtext, and as thus\nshould never have been used.\n\nWill fix as per your suggestions.\n\n    Luben\n\n\n> \n> What actually happened is that _gitweb_ itself mangles the name.\n> \n> > Of course I have nothing against escaping just \", \\ and CR. I don't mind\n> > just substituting CR with some other string, but please just quote \" and\n> > \\ correctly.\n> \n> Indeed, these three are the only chars NOT ALLOWED in qtext.\n> Will quote those.  Thanks for pointing this out.\n> \n> > As of now, gitweb will not handle any filenames containing those three\n> > characters properly because of now.\n> \n> Will fix.\n> \n> Thanks,\n>    Luben\n> \n> \n> \n> > \n> > -- \n> > \t\t\t\tPetr \"Pasky\" Baudis\n> > Stuff: http://pasky.or.cz/\n> > #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n> > $/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\n> > lK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n> > \n> \n> \n"},{"id":"28316","messageId":"20061006184537.GU20017@pasky.or.cz","threadId":"5838","inReplyTo":"20061006182409.87381.qmail@web31812.mail.mud.yahoo.com","subject":"Re: gitweb: using quotemeta","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-06T18:45:37Z","receivedAt":"2006-10-06T18:45:37Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Oct 06, 2006 at 08:21:05PM CEST, I got a letter\nwhere Luben Tuikov <ltuikov@yahoo.com> said that...\n> > According to RFC2183, the filename is a value. According to RFC2045, a\n> > value is either a token (uninteresting) or a quoted-string. According to\n> > RFC822:\n> > \n> >      quoted-string = <\"> *(qtext/quoted-pair) <\">; Regular qtext or\n> >                                                  ;   quoted chars.\n> > \n> >      qtext       =  <any CHAR excepting <\">,     ; => may be folded\n> >                      \"\\\" & CR, and including\n> >                      linear-white-space>\n> > \n> >      quoted-pair =  \"\\\" CHAR                     ; may quote any char\n> > \n> > So what we emit is completely correct.\n> \n> (Your quotations do not seem correct according to \n>   ftp://ftp.rfc-editor.org/in-notes/rfc2045.txt !)\n\nWow, you caused my GNOME at work to do something totally horrible after\nme clicking on that link... ;-)\n\nI'm not sure how is RFC2045 relevant - this is from RFC822, RFC2045 does\nnot define those non-terminals.\n\n> Petr, I agree with your that what we emit is \"completely correct\".\n> \n> But is is _mangled_.  I.e. why mangle the filename from \"a.b\" to\n> \"a\\.b\" ?  Indeed the latter _is_ qtext but it is not the original name\n> given to the file.\n..snip..\n> Sorry, I ment to say that the latter doesn't appear to be qtext.\n> \n> Bottomline is that quotemeta does not convert into qtext, and as thus\n> should never have been used.\n\nIt's a moot point now, but I don't see that - inside qtext, any\ncharacter can be quoted, so what we do is technically ok.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"}]}