Bugfix: Replace bashisms with standard sh to fix build on non-BASH systems #5038

pull luke-jr wants to merge 4 commits into bitcoin:master from luke-jr:fix_bashisms changing 14 files +65 −61
  1. luke-jr commented at 7:01 PM on October 3, 2014: member

    Note: I have not actually tested this on a non-BASH system yet.

    Downstream Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=524332

  2. theuni commented at 8:24 PM on October 3, 2014: member

    ACK in principle. As you said on IRC, I'd like to have travis testing for this. Shouldn't be too hard to spawn in a new shell and export a few things as needed.

    One request though.. please split into 3 commits: build/tests/gitian, that way we can backport more easily if needed.

  3. luke-jr force-pushed on Oct 3, 2014
  4. luke-jr commented at 10:38 PM on October 3, 2014: member

    Split

  5. travis: add non-default shell testing to travis. d6b0539f45
  6. theuni commented at 11:25 PM on October 3, 2014: member

    @luke-jr Please see #5040 and grab the commit from there if you agree with it (I'll close that PR).

    If that is green, ACK.

  7. Bugfix: Replace bashisms with standard sh to fix build on non-BASH systems b77b4eda8d
  8. Bugfix: Replace bashisms with standard sh in gitian descriptors ab72068565
  9. Bugfix: Replace bashisms with standard sh in tests/tools 0b17964131
  10. luke-jr force-pushed on Oct 3, 2014
  11. theuni commented at 10:37 PM on October 6, 2014: member

    In case it's non-obvious to anyone reading after-the-fact:

    This PR adds fixes for shell-scripts that needlessly used bashisms. There was previously no test for these. #5040 introduced a test, and the build failed as expected. This PR fixes the scripts and adds the test from #5040. The fact that it's green means that they're confirmed fixed.

    ACK.

  12. gmaxwell commented at 12:31 AM on October 7, 2014: contributor

    utACK.

  13. laanwj commented at 6:42 AM on October 7, 2014: member

    Not meaning to depreciate this pull, but is there really no modern non-bash alternative to uglyness like

    if test x$use_pkgconfig = x; then
    

    I remember, from maybe 20 years ago, that constructions like that were used for compatibility with some shell from the 80's. Hasn't really anything changed on that front?

  14. luke-jr commented at 6:44 AM on October 7, 2014: member

    @laanwj I'm pretty sure

    if test "$use_pkgconfig" = ""; then
    

    is fine in most shells, but when the entire purpose of a configure script is portability, it makes sense to use the most portable code.

  15. laanwj commented at 6:48 AM on October 7, 2014: member

    It's just so stupid to have to add a dummy string to do a string comparison, as if it's some amazing new thing. In other places we also have limits on how far we go back with regard to compatibility.

    Anyhow, I was just asking. For anything worthwhile (that is actually meant to be reviewed) we should be using Python, not shellscript.

    utACK.

  16. laanwj merged this on Oct 7, 2014
  17. laanwj closed this on Oct 7, 2014

  18. laanwj referenced this in commit d4b571a5d3 on Oct 7, 2014
  19. laanwj referenced this in commit cd3269e38e on Oct 7, 2014
  20. Michagogo commented at 9:20 AM on October 8, 2014: contributor

    Um, why did we make the changes within the gitian build scripts? Those, by definition, run on Ubuntu 12.04, and with bash, unless I'm missing something. I just checked gitian's source, and the build script has a hard-coded #!/bin/bash, as well as the fact that the actual command run is on-target setarch #{@arches[arch]} bash -x < var/build-script > var/build.log 2>&1

  21. luke-jr commented at 9:27 AM on October 8, 2014: member

    Better to use standards?

  22. Michagogo commented at 9:29 AM on October 8, 2014: contributor

    It just seems weird to me to make it ugly in the name of compatibility/reducing bashisms, in a script that will only ever be run by bash.

  23. laanwj commented at 9:44 AM on October 8, 2014: member

    @Michagogo Agreed. Wouldn't have been needed for the gitian descriptors as it forces bash. It's just the basic build system that needs to be compatible between shells. @theuni We could revert this with #4727, which completely overhauls the gitian descriptors anyway.

  24. theuni commented at 7:03 PM on October 8, 2014: member

    Yea, all of the above is fine by me. I didn't argue it because they should be obsoleted soon anyway, as you said.

  25. luke-jr deleted the branch on Oct 9, 2014
  26. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me