Re: [PATCH 2/5] ci/lib: allow running in GitHub Actions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> As to the "It works as expected", this is in a Bash:
>
> 	$ test "$CI_OS_NAME" = macos && CI_OS_NAME=osx
>
> 	$ echo $?
> 	1
>
> Yes, it works, but in the common case, it exits with an error (that we
> ignore, unless run with `sh -e ...`).
>
> Just making sure that we're talking about the same expectation here.

My expectation is that "set -e" won't prevent anything that comes
after "make sure we set CI_OS_NAME to osx on macos but do not do so
on other platforms" we see above from running.  In other words, with
a script like this:

    $ cat >X <<\EOF
    #!/bin/sh
    set -x -e
    CI_OS_NAME=linux

    echo different
    test "$CI_OS_NAME" = macos && CI_OS_NAME=OSX

    CI_OS_NAME=macos
    echo same
    test "$CI_OS_NAME" = macos && CI_OS_NAME=OSX

    echo both passed

    false

    echo at the very end
    EOF

I would expect all "echo" would execute, except for the last one
that is not reached because of the "false", which is the first
"2.9.3 list" whose last "2.9.2 pipeline"[*1*] yields a non-zero
status, would stop the execution.  Two 'test' before && may yield
success or failure and they may control whether the assignment to
CI_OS_NAME is done or skipped, but I expect that they do not affect
how "set -e" behaves.

    $ bash X
    + CI_OS_NAME=linux
    + echo different
    different
    + test linux = macos
    + CI_OS_NAME=macos
    + echo same
    same
    + test macos = macos
    + CI_OS_NAME=OSX
    + echo both passed
    both passed
    + false

    $ dash X
    + CI_OS_NAME=linux
    + echo different
    different
    + test linux = macos
    + CI_OS_NAME=macos
    + echo same
    same
    + test macos = macos
    + CI_OS_NAME=OSX
    + echo both passed
    both passed
    + false


[Footnote]

*1* these two words are from the shell grammar
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux