{"thread":{"id":"20886","subject":"Problem with \"dashless options\"","startedAt":"2009-09-09T13:21:30Z","lastAt":"2010-04-27T21:28:28Z","messageCount":8,"participants":["Henrik Tidefelt","Jeff King","Pierre Habouzit","Christopher Cameron","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"122761","messageId":"D69FA890-4249-4DC9-B8AE-C9F105F1AD3B@isy.liu.se","threadId":"20886","inReplyTo":null,"subject":"Problem with \"dashless options\"","fromName":"Henrik Tidefelt","fromEmail":"tidefelt@isy.liu.se","sentAt":"2009-09-09T13:21:30Z","receivedAt":"2009-09-09T13:21:30Z","isPatch":false,"sender":{"key":"tidefelt@isy.liu.se","avatar":null},"body":"Hi,\n\nYesterday I installed a fresh git (1.6.4.2) on my system using  \nMacPorts.  Some of the git sub-commands work fine (for instance,  \ncheckout, status, remote), while push gives an error as follows:\n\n$ git push isy next\nfatal: BUG: dashless options don't support arguments\n\nThe same thing happens when I do\n\n$ git push --repo=isy next\n\nSince this seems to be a rather severe problem, I suppose it is that  \nit is related to the old and perhaps unusual platform I am using.  It  \nis a PowerPC machine running Mac OS 10.4, with GCC powerpc-apple- \ndarwin8-gcc-4.0.1 and MacPorts 1.8.0.\n\nI'll be happy to provide additional information that might help.\n\n\nBest regards,\n\nHenrik Tidefelt\n"},{"id":"122762","messageId":"20090909143455.GA10092@sigill.intra.peff.net","threadId":"20886","inReplyTo":"D69FA890-4249-4DC9-B8AE-C9F105F1AD3B@isy.liu.se","subject":"Re: Problem with \"dashless options\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-09-09T14:34:55Z","receivedAt":"2009-09-09T14:34:55Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 09, 2009 at 03:21:30PM +0200, Henrik Tidefelt wrote:\n\n> Yesterday I installed a fresh git (1.6.4.2) on my system using\n> MacPorts.  Some of the git sub-commands work fine (for instance,\n> checkout, status, remote), while push gives an error as follows:\n> \n> $ git push isy next\n> fatal: BUG: dashless options don't support arguments\n\nHmm. Very strange. The only code path that triggers this is an option\ndeclared with PARSE_OPT_NODASH but not PARSE_OPT_NOARG. But there are\nonly two options in all of git that use PARSE_OPT_NODASH, and:\n\n  1. They are in git grep, not git push.\n\n  2. They correctly have PARSE_OPT_NOARG set.\n\nWhich leads me to believe that something is writing random cruft on top\nof the options struct. Either a stack overflow, or some issue related to\nyour compiler (either a bug in the compiler, or something non-portable\nwe are doing).\n\nCan you try applying the patch below which will at least give us a bit\nmore information about the offending option?\n\nAlso, does 1.6.4.1 work OK? Or any other earlier version? If so, can you\ntry bisecting?\n\ndiff --git a/parse-options.c b/parse-options.c\nindex f7ce523..e93eb67 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -275,7 +275,15 @@ static int parse_nodash_opt(struct parse_opt_ctx_t *p, const char *arg,\n \t\t\tcontinue;\n \t\tif ((options->flags & PARSE_OPT_OPTARG) ||\n \t\t    !(options->flags & PARSE_OPT_NOARG))\n-\t\t\tdie(\"BUG: dashless options don't support arguments\");\n+\t\t\tdie(\"BUG: dashless options don't support arguments\\n\"\n+\t\t\t    \"buggy option is:\\n\"\n+\t\t\t    \" type: %d\\n\"\n+\t\t\t    \" short_name: %c\\n\"\n+\t\t\t    \" long_name: %s\\n\"\n+\t\t\t    \" flags: %d\\n\",\n+\t\t\t    options->type, options->short_name,\n+\t\t\t    options->long_name, options->flags\n+\t\t\t);\n \t\tif (!(options->flags & PARSE_OPT_NONEG))\n \t\t\tdie(\"BUG: dashless options don't support negation\");\n \t\tif (options->long_name)\n"},{"id":"122768","messageId":"AB9C50E3-E2BB-4449-B8F9-75777ADE1602@isy.liu.se","threadId":"20886","inReplyTo":"20090909143455.GA10092@sigill.intra.peff.net","subject":"Re: Problem with \"dashless options\"","fromName":"Henrik Tidefelt","fromEmail":"tidefelt@isy.liu.se","sentAt":"2009-09-09T16:26:37Z","receivedAt":"2009-09-09T16:26:37Z","isPatch":false,"sender":{"key":"tidefelt@isy.liu.se","avatar":null},"body":"Yes, that was a strange error.  I applied the patch, but could not  \nreproduce the error any more.  Also, Gustaf Hendeby built git  \ndirectly from the git distribution (not via MacPorts) on my machine,  \nand could not reproduce the error.  Then I simply tried to clean and  \nbuild the git from MacPorts again, and voila!, now it works.   \nSomething very strange must have happened during the previous build.\n\nI am sorry for taking your time.\n\n\nHenrik\n\nOn 9Sep , 2009, at 16:34 , Jeff King wrote:\n\n> On Wed, Sep 09, 2009 at 03:21:30PM +0200, Henrik Tidefelt wrote:\n>\n>> Yesterday I installed a fresh git (1.6.4.2) on my system using\n>> MacPorts.  Some of the git sub-commands work fine (for instance,\n>> checkout, status, remote), while push gives an error as follows:\n>>\n>> $ git push isy next\n>> fatal: BUG: dashless options don't support arguments\n>\n> Hmm. Very strange. The only code path that triggers this is an option\n> declared with PARSE_OPT_NODASH but not PARSE_OPT_NOARG. But there are\n> only two options in all of git that use PARSE_OPT_NODASH, and:\n>\n>   1. They are in git grep, not git push.\n>\n>   2. They correctly have PARSE_OPT_NOARG set.\n>\n> Which leads me to believe that something is writing random cruft on  \n> top\n> of the options struct. Either a stack overflow, or some issue  \n> related to\n> your compiler (either a bug in the compiler, or something non-portable\n> we are doing).\n>\n> Can you try applying the patch below which will at least give us a bit\n> more information about the offending option?\n>\n> Also, does 1.6.4.1 work OK? Or any other earlier version? If so,  \n> can you\n> try bisecting?\n>\n> diff --git a/parse-options.c b/parse-options.c\n> index f7ce523..e93eb67 100644\n> --- a/parse-options.c\n> +++ b/parse-options.c\n> @@ -275,7 +275,15 @@ static int parse_nodash_opt(struct  \n> parse_opt_ctx_t *p, const char *arg,\n>  \t\t\tcontinue;\n>  \t\tif ((options->flags & PARSE_OPT_OPTARG) ||\n>  \t\t    !(options->flags & PARSE_OPT_NOARG))\n> -\t\t\tdie(\"BUG: dashless options don't support arguments\");\n> +\t\t\tdie(\"BUG: dashless options don't support arguments\\n\"\n> +\t\t\t    \"buggy option is:\\n\"\n> +\t\t\t    \" type: %d\\n\"\n> +\t\t\t    \" short_name: %c\\n\"\n> +\t\t\t    \" long_name: %s\\n\"\n> +\t\t\t    \" flags: %d\\n\",\n> +\t\t\t    options->type, options->short_name,\n> +\t\t\t    options->long_name, options->flags\n> +\t\t\t);\n>  \t\tif (!(options->flags & PARSE_OPT_NONEG))\n>  \t\t\tdie(\"BUG: dashless options don't support negation\");\n>  \t\tif (options->long_name)\n"},{"id":"122769","messageId":"20090909163001.GE4859@laphroaig.corp","threadId":"20886","inReplyTo":"AB9C50E3-E2BB-4449-B8F9-75777ADE1602@isy.liu.se","subject":"Re: Problem with \"dashless options\"","fromName":"Pierre Habouzit","fromEmail":"madcoder@madism.org","sentAt":"2009-09-09T16:30:01Z","receivedAt":"2009-09-09T16:30:01Z","isPatch":false,"sender":{"key":"madcoder@madism.org","avatar":null},"body":"On Wed, Sep 09, 2009 at 06:26:37PM +0200, Henrik Tidefelt wrote:\n> Yes, that was a strange error.  I applied the patch, but could not\n> reproduce the error any more.  Also, Gustaf Hendeby built git\n> directly from the git distribution (not via MacPorts) on my machine,\n> and could not reproduce the error.  Then I simply tried to clean and\n> build the git from MacPorts again, and voila!, now it works.\n> Something very strange must have happened during the previous build.\n\nAre you using a keyboard mapping where AltGr+space produces an &nbsp; ?\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"122777","messageId":"4EEF55B5-46E1-4C06-AA60-62F700F7B279@isy.liu.se","threadId":"20886","inReplyTo":"20090909163001.GE4859@laphroaig.corp","subject":"Re: Problem with \"dashless options\"","fromName":"Henrik Tidefelt","fromEmail":"tidefelt@isy.liu.se","sentAt":"2009-09-09T21:12:12Z","receivedAt":"2009-09-09T21:12:12Z","isPatch":false,"sender":{"key":"tidefelt@isy.liu.se","avatar":null},"body":"No, but it is mapped to WHITE FROWNING FACE; I guess I defined it so  \nto avoid the trouble I was previously experiencing from accidentally  \ntyping the &nbsp; instead of space without being able to see the  \ndifference on screen.  Why would it matter?\n\n\nHenrik\n\nOn 09-09-09, at 18:30 , Pierre Habouzit wrote:\n\n> On Wed, Sep 09, 2009 at 06:26:37PM +0200, Henrik Tidefelt wrote:\n>> Yes, that was a strange error.  I applied the patch, but could not\n>> reproduce the error any more.  Also, Gustaf Hendeby built git\n>> directly from the git distribution (not via MacPorts) on my machine,\n>> and could not reproduce the error.  Then I simply tried to clean and\n>> build the git from MacPorts again, and voila!, now it works.\n>> Something very strange must have happened during the previous build.\n>\n> Are you using a keyboard mapping where AltGr+space produces an  \n> &nbsp; ?\n>\n> -- \n> ·O·  Pierre Habouzit\n> ··O                                                madcoder@debian.org\n> OOO                                                http://www.madism.org\n"},{"id":"122784","messageId":"20090909224930.GC29776@artemis.corp","threadId":"20886","inReplyTo":"4EEF55B5-46E1-4C06-AA60-62F700F7B279@isy.liu.se","subject":"Re: Problem with \"dashless options\"","fromName":"Pierre Habouzit","fromEmail":"madcoder@madism.org","sentAt":"2009-09-09T22:49:30Z","receivedAt":"2009-09-09T22:49:30Z","isPatch":false,"sender":{"key":"madcoder@madism.org","avatar":null},"body":"On Wed, Sep 09, 2009 at 11:12:12PM +0200, Henrik Tidefelt wrote:\n> No, but it is mapped to WHITE FROWNING FACE; I guess I defined it so\n> to avoid the trouble I was previously experiencing from accidentally\n> typing the &nbsp; instead of space without being able to see the\n> difference on screen.  Why would it matter?\n\nwell because then one of your space could have been that, and the shell\ndoesn't consider non breakable space as .. breakable, hence you can read\nsomething where you believe there is (n+1) arguments but the shell (and\ngit) see only n.\n\nIt often yields errors really hard to grasp like the dreaded:\n\n$ ls | grep\nzsh: command not found:  grep\nnotice the              ^\n\nsorry then I don't really know what happened...\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"140541","messageId":"loom.20100427T194730-644@post.gmane.org","threadId":"20886","inReplyTo":"D69FA890-4249-4DC9-B8AE-C9F105F1AD3B@isy.liu.se","subject":"Re: Problem with &quot;dashless options&quot;","fromName":"Christopher Cameron","fromEmail":"christopher.cameron@live.com","sentAt":"2010-04-27T17:55:20Z","receivedAt":"2010-04-27T17:55:20Z","isPatch":false,"sender":{"key":"christopher.cameron@live.com","avatar":null},"body":"Henrik Tidefelt <tidefelt <at> isy.liu.se> writes:\n\n> Some of the git sub-commands work fine (for instance,  \n> checkout, status, remote), while push gives an error as follows:\n> \n> $ git push isy next\n> fatal: BUG: dashless options don't support arguments\n\nI encountered the exact same problem.  There are a sequence of\n#defines in parse_options.h which are supposed to initialize option\nstructs (OPT_END, OPT_STRING, etc).  These structures only partially \ninitialize the structure, leading to, for instance, junk bits in the flags \nword of OPT_STRING.\n type: 9\n short_name: m\n long_name: master\n flags: 74636f6e\nYou were seeing some commands affected vs not depending on how\nthey use the options macros.\n\nI changed my local source to fill out the full struct, and I never saw \nthe bug again.\n"},{"id":"140555","messageId":"m2eii0egar.fsf@igel.home","threadId":"20886","inReplyTo":"loom.20100427T194730-644@post.gmane.org","subject":"Re: Problem with &quot;dashless options&quot;","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2010-04-27T21:28:28Z","receivedAt":"2010-04-27T21:28:28Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Christopher Cameron <christopher.cameron@live.com> writes:\n\n> I encountered the exact same problem.  There are a sequence of\n> #defines in parse_options.h which are supposed to initialize option\n> structs (OPT_END, OPT_STRING, etc).  These structures only partially \n> initialize the structure, leading to, for instance, junk bits in the flags \n> word of OPT_STRING.\n\nThat's a bug in your compiler.  All parts of the struct that are not\nexplicitly initialized are supposed to be implicitly initialized to\nzero.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}