{"thread":{"id":"2945","subject":"[PATCH] Make GIT-VERSION-GEN tolerate missing git describe command","startedAt":"2005-12-30T16:23:17Z","lastAt":"2005-12-31T00:15:30Z","messageCount":6,"participants":["John Ellson","Linus Torvalds","H. Peter Anvin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"14100","messageId":"dp3mtp$rfm$1@sea.gmane.org","threadId":"2945","inReplyTo":null,"subject":"[PATCH] Make GIT-VERSION-GEN tolerate missing git describe command","fromName":"John Ellson","fromEmail":"ellson@research.att.com","sentAt":"2005-12-30T16:23:17Z","receivedAt":"2005-12-30T16:23:17Z","isPatch":true,"sender":{"key":"ellson@research.att.com","avatar":null},"body":"I think it is probably a bug that \"git non_existent_command\"\nreturns its error message to stdout without an error, where\n\"git-non_existent_command\" behaves differently and does return an\nerror.\n\nOlder versions of git did not implement \"git describe\"  and\nGIT-VERSION-GEN produces an empty version string if run on\na system with such a git installed.  The consequence\nis that \"make rpm\" fails.\n\nThis patch fixes GIT-VERSION-GEN so that it works in the\nabsence of a working \"git describe\"\n\n----------------------------------------\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 196402c..845b9dc 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -2,7 +2,7 @@\n\n  GVF=GIT-VERSION-FILE\n\n-VN=$(git describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT\n+VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT\n  VN=$(expr \"$VN\" : v'\\(.*\\)')\n  if test -r $GVF\n  then\n\n----------------------------------------\n\n\nSigned-off-by: John Ellson <ellson@research.att.com>\n"},{"id":"14103","messageId":"Pine.LNX.4.64.0512301046230.3249@g5.osdl.org","threadId":"2945","inReplyTo":"dp3mtp$rfm$1@sea.gmane.org","subject":"Re: [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-12-30T18:49:13Z","receivedAt":"2005-12-30T18:49:13Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 30 Dec 2005, John Ellson wrote:\n>\n> I think it is probably a bug that \"git non_existent_command\"\n> returns its error message to stdout without an error, where\n> \"git-non_existent_command\" behaves differently and does return an\n> error.\n> \n> Older versions of git did not implement \"git describe\"  and\n> GIT-VERSION-GEN produces an empty version string if run on\n> a system with such a git installed.  The consequence\n> is that \"make rpm\" fails.\n> \n> This patch fixes GIT-VERSION-GEN so that it works in the\n> absence of a working \"git describe\"\n\nShouldn't you make \"git.c\" return an error too, so that \"git-describe\" and \n\"git describe\" both fail properly?\n\nI realize that you'd want to do your patch _too_ (in case somebody has an \nold version of \"git\" installed), but I just think it would be sensible to \nfix the problem that causes this in the first place..\n\nContinuing to output to stdout rather than stderr is probably a good idea \n(so that it's easy to do \"git help | less\" or something), but yeah, I \nthink an unrecognized command should at least return an error.\n\n\t\tLinus\n"},{"id":"14104","messageId":"43B586B4.5030001@research.att.com","threadId":"2945","inReplyTo":"Pine.LNX.4.64.0512301046230.3249@g5.osdl.org","subject":"Re: [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command","fromName":"John Ellson","fromEmail":"ellson@research.att.com","sentAt":"2005-12-30T19:12:52Z","receivedAt":"2005-12-30T19:12:52Z","isPatch":true,"sender":{"key":"ellson@research.att.com","avatar":null},"body":"Linus Torvalds wrote:\n> On Fri, 30 Dec 2005, John Ellson wrote:\n>   \n>> I think it is probably a bug that \"git non_existent_command\"\n>> returns its error message to stdout without an error, where\n>> \"git-non_existent_command\" behaves differently and does return an\n>> error.\n>>\n>> Older versions of git did not implement \"git describe\"  and\n>> GIT-VERSION-GEN produces an empty version string if run on\n>> a system with such a git installed.  The consequence\n>> is that \"make rpm\" fails.\n>>\n>> This patch fixes GIT-VERSION-GEN so that it works in the\n>> absence of a working \"git describe\"\n>>     \n>\n> Shouldn't you make \"git.c\" return an error too, so that \"git-describe\" and \n> \"git describe\" both fail properly?\n>\n> I realize that you'd want to do your patch _too_ (in case somebody has an \n> old version of \"git\" installed), but I just think it would be sensible to \n> fix the problem that causes this in the first place..\n>\n> Continuing to output to stdout rather than stderr is probably a good idea \n> (so that it's easy to do \"git help | less\" or something), but yeah, I \n> think an unrecognized command should at least return an error.\n>\n> \t\tLinus\n>   \n\nI checked and that bug has been fixed since the older version of git that\nwas causing me problems. \"git non_existent_command\" now returns 1.\nHowever, the error message was also changed to\ngoto stderr, which it sounds like you disagree with?   Personally\nI don't have a problem with it, although a real \"git-help\" command\nmight be a good idea too.\n\nJohn\n"},{"id":"14105","messageId":"dp41ve$v7r$1@sea.gmane.org","threadId":"2945","inReplyTo":"dp3mtp$rfm$1@sea.gmane.org","subject":"Re: [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command","fromName":"John Ellson","fromEmail":"ellson@research.att.com","sentAt":"2005-12-30T19:31:56Z","receivedAt":"2005-12-30T19:31:56Z","isPatch":true,"sender":{"key":"ellson@research.att.com","avatar":null},"body":"John Ellson wrote:\n> I think it is probably a bug that \"git non_existent_command\"\n> returns its error message to stdout without an error, where\n> \"git-non_existent_command\" behaves differently and does return an\n> error.\n\nBTW.  Its the old shell-script version of \"git\" that fails to return an error on \nnon_existent_commands.    The newer C version of \"git\" correctly returns an \nerror code.\n\nThe reason that this is a sufficiently serious problem to require a fix is that \nthe broken version of \"git\" is in the git-core-0.99.9a-2.fc5.i386.rpm that is \ncurrently in Fedora Core Extras development.\n\nJohn\n"},{"id":"14106","messageId":"Pine.LNX.4.64.0512301153100.3249@g5.osdl.org","threadId":"2945","inReplyTo":"43B586B4.5030001@research.att.com","subject":"Re: [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-12-30T19:55:32Z","receivedAt":"2005-12-30T19:55:32Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 30 Dec 2005, John Ellson wrote:\n> \n> I checked and that bug has been fixed since the older version of git that\n> was causing me problems. \"git non_existent_command\" now returns 1.\n\nAhh, good.\n\n> However, the error message was also changed to goto stderr, which it \n> sounds like you disagree with?\n\nNot that I can see:\n\n\t[torvalds@g5 ~]$ git --version\n\tgit version 1.0.6-g58e3\n\t[torvalds@g5 ~]$ git hjsdhjas > /dev/null \n\t[torvalds@g5 ~]$ echo $?\n\t1\n\nso yes, it returns a proper error, and it outputs the help message to \nstdout, not stderr. Which is fine, because it means that you can indeed do\n\n\tgit help | less\n\nand it will do the right thing (apart from printing the line\n\n\tgit: 'help' is not a git-command\n\nwhich is a bit sad).\n\n\t\tLinus\n"},{"id":"14109","messageId":"43B5CDA2.5050408@zytor.com","threadId":"2945","inReplyTo":"dp41ve$v7r$1@sea.gmane.org","subject":"Re: [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command","fromName":"H. Peter Anvin","fromEmail":"hpa@zytor.com","sentAt":"2005-12-31T00:15:30Z","receivedAt":"2005-12-31T00:15:30Z","isPatch":true,"sender":{"key":"hpa@zytor.com","avatar":null},"body":"John Ellson wrote:\n> John Ellson wrote:\n> \n>> I think it is probably a bug that \"git non_existent_command\"\n>> returns its error message to stdout without an error, where\n>> \"git-non_existent_command\" behaves differently and does return an\n>> error.\n> \n> \n> BTW.  Its the old shell-script version of \"git\" that fails to return an \n> error on non_existent_commands.    The newer C version of \"git\" \n> correctly returns an error code.\n> \n> The reason that this is a sufficiently serious problem to require a fix \n> is that the broken version of \"git\" is in the \n> git-core-0.99.9a-2.fc5.i386.rpm that is currently in Fedora Core Extras \n> development.\n> \n\nIt has been fixed.  What's broken is that Fedora Extras still contains \n0.99.9a which is totally ancient.\n\n\t-hpa\n"}]}