{"thread":{"id":"42217","subject":"Portability of git shell scripts?","startedAt":"2016-05-04T18:17:38Z","lastAt":"2016-05-07T02:53:20Z","messageCount":5,"participants":["Armin Kunaschik","Torsten Bögershausen","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"285481","messageId":"CALR6jEh5dAcnqiyo4kXkj+8imfQQd0nT=baPOW_qbJpJwmFsyw@mail.gmail.com","threadId":"42217","inReplyTo":null,"subject":"Portability of git shell scripts?","fromName":"Armin Kunaschik","fromEmail":"megabreit@googlemail.com","sentAt":"2016-05-04T18:17:38Z","receivedAt":"2016-05-04T18:17:38Z","isPatch":false,"sender":{"key":"megabreit@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/10429218?v=4"},"body":"Hi list,\n\nI'm trying to compile/test/use git 2.8.2 on AIX 6.1 with no bash available.\n/bin/sh is a hard link to /bin/ksh which is a ksh88, a posix shell.\nIs this supposed to work?\n\nAs an example: make test fails on nearly every t34* test and on tests\nwhich contain rebase.\nThe installation of bash (and manually changing the shebang to\n/bin/bash) \"fixes\" all rebase test failures. So obviously git-rebase\nis not portable at some point.\n\nDoes it make any sense to put work into making these scripts portable,\nthat is, work with posix shells?\nAnd, as last resort, is it possible to configure git use bash in some\nor all shell scripts?\n\nRegards,\nArmin\n"},{"id":"285483","messageId":"cdb4e001-7dc7-3c3b-27ca-2c970135805a@web.de","threadId":"42217","inReplyTo":"CALR6jEh5dAcnqiyo4kXkj+8imfQQd0nT=baPOW_qbJpJwmFsyw@mail.gmail.com","subject":"Re: Portability of git shell scripts?","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-05-04T18:35:51Z","receivedAt":"2016-05-04T18:35:51Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 04.05.16 20:17, Armin Kunaschik wrote:\n> Hi list,\n> \n> I'm trying to compile/test/use git 2.8.2 on AIX 6.1 with no bash available.\n> /bin/sh is a hard link to /bin/ksh which is a ksh88, a posix shell.\n> Is this supposed to work?\n> \n> As an example: make test fails on nearly every t34* test and on tests\n> which contain rebase.\n> The installation of bash (and manually changing the shebang to\n> /bin/bash) \"fixes\" all rebase test failures. So obviously git-rebase\n> is not portable at some point.\n> \n> Does it make any sense to put work into making these scripts portable,\n> that is, work with posix shells?\n> And, as last resort, is it possible to configure git use bash in some\n> or all shell scripts?\n> \n> Regards,\n> Armin\nThe Makefile has a knob to use a specifc shell:\n\n# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.\n\nDoes this help ?\n\nOtherwise:\nI don't know how much posix ksh88 is, it may help, if you can post some output ?\n\nI use sometimes\ndebug=t verbose=t ./t34XXXX.sh 2>&1 ≤ tee xx.txt\nbut there may be better debugging utilities these days.\n"},{"id":"285516","messageId":"20160504212028.GG21259@sigill.intra.peff.net","threadId":"42217","inReplyTo":"CALR6jEh5dAcnqiyo4kXkj+8imfQQd0nT=baPOW_qbJpJwmFsyw@mail.gmail.com","subject":"Re: Portability of git shell scripts?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-05-04T21:20:28Z","receivedAt":"2016-05-04T21:20:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 04, 2016 at 08:17:38PM +0200, Armin Kunaschik wrote:\n\n> I'm trying to compile/test/use git 2.8.2 on AIX 6.1 with no bash available.\n> /bin/sh is a hard link to /bin/ksh which is a ksh88, a posix shell.\n> Is this supposed to work?\n\nWe aim for a practical subset of Bourne shells, including bash, dash,\nash, ksh, etc. There's at least one Bourne-ish shell known not to work,\nwhich is Solaris /bin/sh[1]. POSIX is usually a good guide, but we aim\nfor practical portability more than adhering strictly to the standards\ndocument.\n\nI've tested with mksh in the past (though it's possible that we've\nintroduced a regression since then). But I think we've run into problems\nwith ksh93[2]. I don't know about ksh88, or what construct it doesn't\nlike.  It may or may not be easy to work around.\n\n> As an example: make test fails on nearly every t34* test and on tests\n> which contain rebase.\n> The installation of bash (and manually changing the shebang to\n> /bin/bash) \"fixes\" all rebase test failures. So obviously git-rebase\n> is not portable at some point.\n\nRight. Any modern-ish Bourne shell will do, so moving to bash is one way\nto fix it.\n\n> Does it make any sense to put work into making these scripts portable,\n> that is, work with posix shells?\n\nMaybe. :) If you can find what it is that ksh88 is unhappy with, we can\nsee how painful it is to adapt to. But given my looking into ksh93 in\n[2], I suspect it will be easier to just use a more modern shell.\n\n> And, as last resort, is it possible to configure git use bash in some\n> or all shell scripts?\n\nYou can set SHELL_PATH in your config.mak file.\n\n-Peff\n\n[1] Solaris /bin/sh doesn't even understand $(), so we declared it as\n    hopeless long ago. I think most people just replace it with bash,\n    but I suspect /usr/xpg6/bin/sh probably works, too.\n\n[2] http://thread.gmane.org/gmane.comp.version-control.git/268657/focus=268666\n"},{"id":"285754","messageId":"CALR6jEiWQUO0WsOVah2O+9-j2Qx7juYjP7cb1v+P=Ey0oqQszg@mail.gmail.com","threadId":"42217","inReplyTo":"20160504212028.GG21259@sigill.intra.peff.net","subject":"Re: Portability of git shell scripts?","fromName":"Armin Kunaschik","fromEmail":"megabreit@googlemail.com","sentAt":"2016-05-06T16:57:45Z","receivedAt":"2016-05-06T16:57:45Z","isPatch":false,"sender":{"key":"megabreit@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/10429218?v=4"},"body":"On Wed, May 4, 2016 at 11:20 PM, Jeff King <peff@peff.net> wrote:\n> On Wed, May 04, 2016 at 08:17:38PM +0200, Armin Kunaschik wrote:\n>\n>> I'm trying to compile/test/use git 2.8.2 on AIX 6.1 with no bash available.\n>> /bin/sh is a hard link to /bin/ksh which is a ksh88, a posix shell.\n>> Is this supposed to work?\n>\n> We aim for a practical subset of Bourne shells, including bash, dash,\n> ash, ksh, etc. There's at least one Bourne-ish shell known not to work,\n> which is Solaris /bin/sh[1]. POSIX is usually a good guide, but we aim\n> for practical portability more than adhering strictly to the standards\n> document.\n>\n> I've tested with mksh in the past (though it's possible that we've\n> introduced a regression since then). But I think we've run into problems\n> with ksh93[2]. I don't know about ksh88, or what construct it doesn't\n> like.  It may or may not be easy to work around.\n\nIn general ksh (88 or 93) is posix compliant... and bash is moving away\nfrom posix. :-) But I know what you mean.\n\n>> As an example: make test fails on nearly every t34* test and on tests\n>> which contain rebase.\n>> The installation of bash (and manually changing the shebang to\n>> /bin/bash) \"fixes\" all rebase test failures. So obviously git-rebase\n>> is not portable at some point.\n>\n> Right. Any modern-ish Bourne shell will do, so moving to bash is one way\n> to fix it.\n\nMy last compile of git 2.2.2 did far better than the current 2.8.2. So\nit looks like\nthere were more recent changes that broke portability.\n\n>> Does it make any sense to put work into making these scripts portable,\n>> that is, work with posix shells?\n>\n> Maybe. :) If you can find what it is that ksh88 is unhappy with, we can\n> see how painful it is to adapt to. But given my looking into ksh93 in\n> [2], I suspect it will be easier to just use a more modern shell.\n\nRegarding [2] this was a bug which was fixed quite fast. To me this is no\nreal showstopper. Modernity of ksh93 depends on the letter after the 93 :-)\n\n>> And, as last resort, is it possible to configure git use bash in some\n>> or all shell scripts?\n>\n> You can set SHELL_PATH in your config.mak file.\n\nI tried a build with SHELL_PATH=/bin/bash. Many problems \"went away\".\nOthers appeared. I'll give it a few more days to look into it.\n\nFirst finding:\nmake test does not make it through t3513-revert-submodule.sh anymore.\nThe test is not portable since it uses the z-flags of GNU-tar. When -z\nis removed,\n(and extension is changed back to tar) everything runs and tests smoothly.\n\nIs this report enough to start the magic to change things?\n\nRegards,\nArmin\n"},{"id":"285794","messageId":"20160507025320.GA31460@sigill.intra.peff.net","threadId":"42217","inReplyTo":"CALR6jEiWQUO0WsOVah2O+9-j2Qx7juYjP7cb1v+P=Ey0oqQszg@mail.gmail.com","subject":"Re: Portability of git shell scripts?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-05-07T02:53:20Z","receivedAt":"2016-05-07T02:53:20Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 06, 2016 at 06:57:45PM +0200, Armin Kunaschik wrote:\n\n> > Right. Any modern-ish Bourne shell will do, so moving to bash is one\n> > way to fix it.\n> \n> My last compile of git 2.2.2 did far better than the current 2.8.2. So\n> it looks like there were more recent changes that broke portability.\n\nIf you have a working version and a non-working version, the results of\n\"git bisect\" would be very helpful to find the change (or the output of\nthe test run with \"-v -i\" to show what's going on in the failing test).\n\n-Peff\n"}]}