"shell_session_update: command not found" in build log; causes build to fail if `trap ERR` is set

build-env

#1

See https://travis-ci.org/native-api/opencv-python/builds/453359272 for a sample failure and https://travis-ci.org/native-api/opencv-python/builds/453426776 for the success after that when I figured out the problem.

At certain points, Travis bash logic calls shell_session_update for some reason. This function, which is always present in an OSX interactive shell, is not present in Travis shell environment, so the command fails with the above message.
I see that Travis protects itself against accidental termination by unsetting -e – but it doesn’t unset trap ERR, so the above failure still terminates Travis logic.

So, there are a few problems here:

  • Calling shell_session_update in the first place

    AFAICS it saves interactive session history and optionally state. So there’s no point using it inside a batch job anyway.

  • Not protecting Travis logic against an ERR trap

    It’s not documented in hxxps://docs.travis-ci.com/user/customizing-the-build/ that using traps is illegal or some conditions must be met, so officially they are fair game.


#2

Fixed in https://github.com/travis-ci/travis-build/commit/53921f975c42c1e9ff9c92e8c07c197e5a7a77bc