{"thread":{"id":"22766","subject":"[PATCH] Allow '+', '-' and '.' in remote helper names","startedAt":"2010-02-23T12:33:48Z","lastAt":"2010-02-23T17:12:19Z","messageCount":9,"participants":["Ilari Liusvaara","Johannes Schindelin","Sverre Rabbelier","Johannes Sixt","Erik Faye-Lund","Paolo Bonzini","Gabriel Filion"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"135418","messageId":"1266928428-19075-1-git-send-email-ilari.liusvaara@elisanet.fi","threadId":"22766","inReplyTo":null,"subject":"[PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Ilari Liusvaara","fromEmail":"ilari.liusvaara@elisanet.fi","sentAt":"2010-02-23T12:33:48Z","receivedAt":"2010-02-23T12:33:48Z","isPatch":true,"sender":{"key":"ilari.liusvaara@elisanet.fi","avatar":null},"body":"According to relevant RFCs, in addition to alphanumerics, the following\ncharacters are valid in URL scheme parts: '+', '-' and '.', but\ncurrently only alphanumerics are allowed in remote helper names.\n\nAllow those three characters in remote helper names (both 'foo://' and\n'foo::' syntax).\n\nSigned-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>\n---\n transport.c |   19 +++++++++++++++++--\n 1 files changed, 17 insertions(+), 2 deletions(-)\n\ndiff --git a/transport.c b/transport.c\nindex 08e4fa0..00acff1 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -872,6 +872,21 @@ static int is_file(const char *url)\n \treturn S_ISREG(buf.st_mode);\n }\n \n+static int isurlschemechar(int first_flag, int ch)\n+{\n+\t/*\n+\t * The set of valid URL schemes, as per STD66 (RFC3986) is\n+\t * '[A-Za-z][A-Za-z0-9+.-]*'. But use sightly looser check\n+\t * of '[A-Za-z0-9][A-Za-z0-9+.-]*' because earlier version\n+\t * of check used '[A-Za-z0-9]+' so not to break any remote\n+\t * helpers.\n+\t */\n+\tint alphanumeric, special;\n+\talphanumeric = ch > 0 && isalnum(ch);\n+\tspecial = ch == '+' || ch == '-' || ch == '.';\n+\treturn alphanumeric || (!first_flag && special);\n+}\n+\n static int is_url(const char *url)\n {\n \tconst char *url2, *first_slash;\n@@ -896,7 +911,7 @@ static int is_url(const char *url)\n \t */\n \turl2 = url;\n \twhile (url2 < first_slash - 1) {\n-\t\tif (!isalnum((unsigned char)*url2))\n+\t\tif (!isurlschemechar(url2 == url, (unsigned char)*url2))\n \t\t\treturn 0;\n \t\turl2++;\n \t}\n@@ -930,7 +945,7 @@ struct transport *transport_get(struct remote *remote, const char *url)\n \tif (url) {\n \t\tconst char *p = url;\n \n-\t\twhile (isalnum(*p))\n+\t\twhile (isurlschemechar(p == url, *p))\n \t\t\tp++;\n \t\tif (!prefixcmp(p, \"::\"))\n \t\t\thelper = xstrndup(url, p - url);\n-- \n1.7.0.86.gb35cab\n"},{"id":"135423","messageId":"alpine.DEB.1.00.1002231402350.3980@intel-tinevez-2-302","threadId":"22766","inReplyTo":"1266928428-19075-1-git-send-email-ilari.liusvaara@elisanet.fi","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-02-23T13:03:40Z","receivedAt":"2010-02-23T13:03:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 23 Feb 2010, Ilari Liusvaara wrote:\n\n> According to relevant RFCs, in addition to alphanumerics, the following\n> characters are valid in URL scheme parts: '+', '-' and '.', but\n> currently only alphanumerics are allowed in remote helper names.\n\nMay I caution against allowing \"+\" as part of filenames? On Windows, \nthanks to the DOS garb^Wheritage, \"+\" is not really allowed...\n\nOr maybe I misunderstood the intent of the patch?\n\nCiao,\nDscho\n"},{"id":"135424","messageId":"fabb9a1e1002230507i56b32e8cwd7643a79284f6567@mail.gmail.com","threadId":"22766","inReplyTo":"alpine.DEB.1.00.1002231402350.3980@intel-tinevez-2-302","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-02-23T13:07:02Z","receivedAt":"2010-02-23T13:07:02Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Tue, Feb 23, 2010 at 14:03, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> May I caution against allowing \"+\" as part of filenames? On Windows,\n> thanks to the DOS garb^Wheritage, \"+\" is not really allowed...\n\nWould it be safe to say \"raplce all occurences of '+' and '.' with\n'-'? Is it feasible that we would want to support two protocols with a\ndifferent helper that map to the same 'name' using that scheme? So,\nwould there ever be a case where we want to handle \"bzr+ssh\"\nand \"bzr-ssh\" with a different helper? I reckon not, and if it does\noccur it's always possible to put a simple dispatcher in between?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"135425","messageId":"4B83D5CC.9030206@viscovery.net","threadId":"22766","inReplyTo":"alpine.DEB.1.00.1002231402350.3980@intel-tinevez-2-302","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-02-23T13:19:08Z","receivedAt":"2010-02-23T13:19:08Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Johannes Schindelin schrieb:\n> May I caution against allowing \"+\" as part of filenames? On Windows, \n> thanks to the DOS garb^Wheritage, \"+\" is not really allowed...\n\nI don't think that's true (and I also think it never was).\n\nYou may be refering to the copy command, where you can say\n\n   copy a.txt+b.txt+c.txt abc.txt\n\nto concatenate the source files. But this does not restrict how you can\nname your files. If you have a file a+b.txt and want to use it with copy,\nthen you must use double-quotes:\n\n   copy \"a+b.txt\" elsewhere.txt\n   copy \"a+b.txt\"+c.txt abc.txt\n\n-- Hannes\n"},{"id":"135426","messageId":"40aa078e1002230532n6e692fd0p8fa5d599c21a1873@mail.gmail.com","threadId":"22766","inReplyTo":"4B83D5CC.9030206@viscovery.net","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-02-23T13:32:10Z","receivedAt":"2010-02-23T13:32:10Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, Feb 23, 2010 at 2:19 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Johannes Schindelin schrieb:\n>> May I caution against allowing \"+\" as part of filenames? On Windows,\n>> thanks to the DOS garb^Wheritage, \"+\" is not really allowed...\n>\n> I don't think that's true (and I also think it never was).\n>\n\nWikipedia doesn't seem to think so either:\nhttp://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\n\n-- \nErik \"kusma\" Faye-Lund\n"},{"id":"135428","messageId":"4B83DCB1.5050905@gnu.org","threadId":"22766","inReplyTo":"1266928428-19075-1-git-send-email-ilari.liusvaara@elisanet.fi","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2010-02-23T13:48:33Z","receivedAt":"2010-02-23T13:48:33Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 02/23/2010 01:33 PM, Ilari Liusvaara wrote:\n> According to relevant RFCs, in addition to alphanumerics, the following\n> characters are valid in URL scheme parts: '+', '-' and '.', but\n> currently only alphanumerics are allowed in remote helper names.\n>\n> Allow those three characters in remote helper names (both 'foo://' and\n> 'foo::' syntax).\n\nI think '+' could be special-cased in that, for example, \"svn+ssh://\" \nshould still invoke an hypothetic git-remote-svn helper.  There is no \nuse yet for this feature, but I'm sure that foreign VCS helpers would \nuse it.\n\nPaolo\n"},{"id":"135427","messageId":"alpine.DEB.1.00.1002231450010.3980@intel-tinevez-2-302","threadId":"22766","inReplyTo":"fabb9a1e1002230507i56b32e8cwd7643a79284f6567@mail.gmail.com","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-02-23T13:51:24Z","receivedAt":"2010-02-23T13:51:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 23 Feb 2010, Sverre Rabbelier wrote:\n\n> On Tue, Feb 23, 2010 at 14:03, Johannes Schindelin \n> <Johannes.Schindelin@gmx.de> wrote:\n> > May I caution against allowing \"+\" as part of filenames? On Windows, \n> > thanks to the DOS garb^Wheritage, \"+\" is not really allowed...\n> \n> Would it be safe to say \"raplce all occurences of '+' and '.' with\n> '-'?\n\nI'd rather only replace '+' with '-'. While \"short\" DOS filenames can only \nhave one dot, and only up to three (upper-case) characters after that, \n\"long\" ones do not share that restriction.\n\n> Is it feasible that we would want to support two protocols with a \n> different helper that map to the same 'name' using that scheme? So, \n> would there ever be a case where we want to handle \"bzr+ssh\" and \n> \"bzr-ssh\" with a different helper? I reckon not, and if it does occur \n> it's always possible to put a simple dispatcher in between?\n\nPossible.\n\nCiao,\nDscho\n"},{"id":"135430","messageId":"alpine.DEB.1.00.1002231541431.3980@intel-tinevez-2-302","threadId":"22766","inReplyTo":"40aa078e1002230532n6e692fd0p8fa5d599c21a1873@mail.gmail.com","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-02-23T14:42:03Z","receivedAt":"2010-02-23T14:42:03Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 23 Feb 2010, Erik Faye-Lund wrote:\n\n> On Tue, Feb 23, 2010 at 2:19 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> > Johannes Schindelin schrieb:\n> >> May I caution against allowing \"+\" as part of filenames? On Windows,\n> >> thanks to the DOS garb^Wheritage, \"+\" is not really allowed...\n> >\n> > I don't think that's true (and I also think it never was).\n> >\n> \n> Wikipedia doesn't seem to think so either:\n> http://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\n\nOkay, I stand corrected, and therefore gladly retract my objections!\n\nCiao,\nDscho\n"},{"id":"135442","messageId":"4B840C73.8020204@gmail.com","threadId":"22766","inReplyTo":"4B83DCB1.5050905@gnu.org","subject":"Re: [PATCH] Allow '+', '-' and '.' in remote helper names","fromName":"Gabriel Filion","fromEmail":"lelutin@gmail.com","sentAt":"2010-02-23T17:12:19Z","receivedAt":"2010-02-23T17:12:19Z","isPatch":true,"sender":{"key":"lelutin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/108728?v=4"},"body":"Paolo Bonzini wrote:\n> On 02/23/2010 01:33 PM, Ilari Liusvaara wrote:\n>> According to relevant RFCs, in addition to alphanumerics, the following\n>> characters are valid in URL scheme parts: '+', '-' and '.', but\n>> currently only alphanumerics are allowed in remote helper names.\n>>\n>> Allow those three characters in remote helper names (both 'foo://' and\n>> 'foo::' syntax).\n> \n> I think '+' could be special-cased in that, for example, \"svn+ssh://\"\n> should still invoke an hypothetic git-remote-svn helper.  There is no\n> use yet for this feature, but I'm sure that foreign VCS helpers would\n> use it.\n> \n\nSpecial-casing the + could be useful to simplify support for\n\"svn::ssh://\"-style addresses as both could receive the same URL\n(\"ssh://..\").\n\nIt would also mean less clutter in the script directory. Instead of\nhaving two scripts, one to catch \"helper://..\" remote URLs and another\nto catch \"helper+ssh://..\" URLs, the same script would differentiate\nbetween used protocols.\n\n-- \nGabriel Filion\n"}]}