diff options
author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2022-05-27 20:54:25 +1200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2022-06-10 06:56:38 +0000 |
commit | 73f0621a0a1266e9bedfdbd2d534e23406b81145 (patch) | |
tree | 48c0ea61e9971dff968e328f30a1870b1e64d00d | |
parent | 6b58061d22993d991463c25765656a77281397ef (diff) | |
download | samba-73f0621a0a1266e9bedfdbd2d534e23406b81145.tar.gz |
bootstrap: Fix [gm]old linker existence check
We used 'test -x $LD_GOLD' to test whether the alternate linker was
available and executable. However, if $LD_GOLD expanded to an empty
string, the 'test' command would be run in single argument mode, see
that '-x' was a non-empty string, and duly return a successful status
code. The result would be a meaningless symlink created, and a
misleading message.
Because 'which' already tests that its argument is executable, the
solution is simply to remove the 'test' command.
We also invert the return code of the 'which' command so that if the
alternate linker is not found, the overall code returned to Docker is
still successful.
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | .gitlab-ci-main.yml | 2 | ||||
-rw-r--r-- | bootstrap/config.py | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/centos7/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/centos8s/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/debian11/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/f36mit120/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/fedora36/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/opensuse153/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/ubuntu1804/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/generated-dists/ubuntu2004/Dockerfile | 4 | ||||
-rw-r--r-- | bootstrap/sha1sum.txt | 2 |
11 files changed, 20 insertions, 20 deletions
diff --git a/.gitlab-ci-main.yml b/.gitlab-ci-main.yml index 334fb69641b..5d8fc1eaaeb 100644 --- a/.gitlab-ci-main.yml +++ b/.gitlab-ci-main.yml @@ -47,7 +47,7 @@ variables: # Set this to the contents of bootstrap/sha1sum.txt # which is generated by bootstrap/template.py --render # - SAMBA_CI_CONTAINER_TAG: 7f3f1172a1da12271a0bc5a48eae4679691e386b + SAMBA_CI_CONTAINER_TAG: 7232d969a9464e01eac44046eef026210cd27c01 # # We use the ubuntu1804 image as default as # it matches what we have on sn-devel-184. diff --git a/bootstrap/config.py b/bootstrap/config.py index 45fbc7b6442..d3d16286ab2 100644 --- a/bootstrap/config.py +++ b/bootstrap/config.py @@ -372,9 +372,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || {{ LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; }} # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || {{ LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; }} # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/centos7/Dockerfile b/bootstrap/generated-dists/centos7/Dockerfile index 3b43da9216d..ccb46541106 100644 --- a/bootstrap/generated-dists/centos7/Dockerfile +++ b/bootstrap/generated-dists/centos7/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/centos8s/Dockerfile b/bootstrap/generated-dists/centos8s/Dockerfile index 80a2f099026..6f8a883b075 100644 --- a/bootstrap/generated-dists/centos8s/Dockerfile +++ b/bootstrap/generated-dists/centos8s/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/debian11/Dockerfile b/bootstrap/generated-dists/debian11/Dockerfile index cfd184a1d89..b7a46ca53e5 100644 --- a/bootstrap/generated-dists/debian11/Dockerfile +++ b/bootstrap/generated-dists/debian11/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/f36mit120/Dockerfile b/bootstrap/generated-dists/f36mit120/Dockerfile index 8a4ecb6f97e..803f0752a11 100644 --- a/bootstrap/generated-dists/f36mit120/Dockerfile +++ b/bootstrap/generated-dists/f36mit120/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/fedora36/Dockerfile b/bootstrap/generated-dists/fedora36/Dockerfile index 8a4ecb6f97e..803f0752a11 100644 --- a/bootstrap/generated-dists/fedora36/Dockerfile +++ b/bootstrap/generated-dists/fedora36/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/opensuse153/Dockerfile b/bootstrap/generated-dists/opensuse153/Dockerfile index b977f644448..f252e8b2877 100644 --- a/bootstrap/generated-dists/opensuse153/Dockerfile +++ b/bootstrap/generated-dists/opensuse153/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/ubuntu1804/Dockerfile b/bootstrap/generated-dists/ubuntu1804/Dockerfile index a66dc3f2324..9ab534d7b9d 100644 --- a/bootstrap/generated-dists/ubuntu1804/Dockerfile +++ b/bootstrap/generated-dists/ubuntu1804/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/generated-dists/ubuntu2004/Dockerfile b/bootstrap/generated-dists/ubuntu2004/Dockerfile index 7ae6a93143f..4393c90f46e 100644 --- a/bootstrap/generated-dists/ubuntu2004/Dockerfile +++ b/bootstrap/generated-dists/ubuntu2004/Dockerfile @@ -14,9 +14,9 @@ ADD *.sh /tmp/ RUN /tmp/bootstrap.sh && /tmp/locale.sh # if ld.gold exists, force link it to ld -RUN set -x; LD=$(which ld); LD_GOLD=$(which ld.gold); test -x $LD_GOLD && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD" +RUN set -x; ! LD_GOLD=$(which ld.gold) || { LD=$(which ld) && ln -sf $LD_GOLD $LD && test -x $LD && echo "$LD is now $LD_GOLD"; } # if ld.mold exists, force link it to ld (prefer mold over gold! ;-) -RUN set -x; LD=$(which ld); LD_MOLD=$(which ld.mold); test -x $LD_MOLD && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD" +RUN set -x; ! LD_MOLD=$(which ld.mold) || { LD=$(which ld) && ln -sf $LD_MOLD $LD && test -x $LD && echo "$LD is now $LD_MOLD"; } # make test can not work with root, so we have to create a new user RUN useradd -m -U -s /bin/bash samba && \ diff --git a/bootstrap/sha1sum.txt b/bootstrap/sha1sum.txt index 851b06db5a6..3658effe212 100644 --- a/bootstrap/sha1sum.txt +++ b/bootstrap/sha1sum.txt @@ -1 +1 @@ -7f3f1172a1da12271a0bc5a48eae4679691e386b +7232d969a9464e01eac44046eef026210cd27c01 |