/.travis/functions: No such file or directory


My unittests that check certain OS-level commands are failing with the errors:

[] sudo: whoami
[] out: /home/travis/.travis/job_stages: line 1: /.travis/functions: No such file or directory
[] out: root
[] out:

AssertionError: ‘/home/travis/.travis/job_stages: line 1: /.travis/functions: No such file or directory\nroot’ != ‘root’

These don’t happen for me on my local Ubuntu install, and they look to be due to some Travis-specific configuration. Any idea how I can resolve them?


When reporting a problem, please include the build log URL, so that we can help you better.

Thank you!


Same problem here.


Looks like job_stages sources $TRAVIS_HOME/.travis/functions, but for some reason, at the time that job_stages was created, that variable was empty (when it should, in my environment, have been /home/travis).

I found the code that’s supposed to do this here, but not sure why it’s not working.

In my case, the code under test creates a new bash subshell by sshing to localhost, so I guess it’s related to that.


It looks like your code is doing something funny: for some reason, result[HOSTS[0]] has the value /home/travis/.travis/job_stages: line 1: /.travis/functions: No such file or directory.

I guess that your program captures stdout+stderr of some command (and probably does not check its exit code), likely in an altered environment. According to https://en.wikipedia.org/wiki/Standard_streams , a program’s result is supposed to be just stdout contents, stderr is only supposed to be used for diagnostics/error reporting.

You need to track the above-mentioned erroneous value back to its origin along your program’s logic – with debugger or with debug printing. For the former, you can request Travis staff to enable debug mode for your repo as per https://docs.travis-ci.com/user/running-build-in-debug-mode/ .


Here’s my failing build: https://travis-ci.org/chrisspen/burlap/builds/500063221

I’m trying to run “sudo whoami”, and it’s throwing that error. This used to run without error in Travis.


Or, your jobs managed to source ~/.travis/job_stages without $TRAVIS_HOME set. The content of ~/.travis/job_stages should have:

source "${TRAVIS_HOME}/.travis/functions"

See https://travis-ci.org/BanzaiMan/travis_production_test/builds/500078837#L176


Any update on this? I have a lot of code that processes output from shell commands, and this bug is adding Travis-specific junk to everything, breaking a ton of my tests. I can update my code to ignore everything but the last line of output, but it’d be nice if Travis didn’t populate output with irrelevant errors.


Please read my previous comment. Your tool is sourceing the file without the required environment variables set. Please consult your tools (documentation, or if you know the internals, source code). I do not believe this is something we can fix.


I don’t understand your comment. My tool is Fabric, a library for running arbitrary shell commands from Python. How can it source a custom Travis file that neither it nor I know about, much less define a custom TRAVIS_HOME environment variable? If the patch is to manually define TRAVIS_HOME, please document what that value should be.


$TRAVIS_HOME is defined by our build script, and it is exported during the build. This is documented in https://docs.travis-ci.com/user/environment-variables#default-environment-variables.

The file in question /home/travis/.travis/job_stages is designed to be used (sourced) in such an execution environment. And it works.

Something beyond our control is sourceing this file in an inappropriate manner, and causing the issue. It may be Fabric, as you say, or it may not be.