[llvm] r257663 - Remove bashism from merge.sh: POSIX sh does not have the `function`

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 09:12:37 PST 2016


On Sat, Jan 16, 2016 at 7:20 AM, Dimitry Andric <dimitry at andric.com> wrote:
> On 13 Jan 2016, at 22:09, Hans Wennborg <hans at chromium.org> wrote:
>>
>> On Wed, Jan 13, 2016 at 11:55 AM, Dimitry Andric <dimitry at andric.com> wrote:
>>> On 13 Jan 2016, at 20:48, Dimitry Andric via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>>>
>>>> Author: dim
>>>> Date: Wed Jan 13 13:48:50 2016
>>>> New Revision: 257663
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=257663&view=rev
>>>> Log:
>>>> Remove bashism from merge.sh: POSIX sh does not have the `function`
>>>> reserved word, and it is even superfluous in bash, for this particular
>>>> instance.
>>>>
>>>> Modified:
>>>>   llvm/trunk/utils/release/merge.sh
>>>
>>> Hi Hans,
>>>
>>> Can I merge this to the 3.8 branch? (Using the fixed merge.sh script of course ;-)
>>
>> I'm OK with that, but I'm thinking maybe the better fix is to change
>> the shebang in these scripts to "#!/usr/bin/env bash", like in
>> test-release.sh. For example, tag.sh and export.sh also use 'function'
>> with #!/bin/sh.
>
> I did a little inventory:
>
> * There are 53 shell scripts under a release_38 llvm and clang checkout.
> * 41 of those have #!/bin/sh
> * 9 have #!/bin/bash (this usually won't work on e.g. FreeBSD)
> * 2 have #!/usr/bin/env bash (this should work everywhere)
> * 1 has #!/bin/csh
>
> Of the /bin/sh scripts, only utils/release/export.sh and utils/release/tag.sh use the 'function' keyword, and for both files these can be safely deleted.  They seem to run fine under FreeBSD /bin/sh.
>
> So I think I'll just go ahead and fix up export.sh and tag.sh in a follow-up commit.

I just worry that keeping these scripts free from bashisms is an
uphill battle since we don't have anything preventing them slipping in
again. Because of that, I figure using "#!/usr/bin/env bash" would be
a better solution.

I don't feel particularly strongly here though, and if you do want to
keep these scripts bashism free, that's fine too.

 - Hans


More information about the llvm-commits mailing list