[ccache] [PATCH] Use bash for test.sh.

Andrew Stubbs ams at codesourcery.com
Mon Nov 12 04:03:37 MST 2012


On 11/11/12 11:31, Eitan Adler wrote:
> Mike,
>
> http://www.technollama.co.uk/wordpress/wp-content/uploads/2011/05/obvious-troll.jpg

Insulting respected members of the Linux community will get you nowhere. 
I realise that some might call you the same, and BSD also, so you should 
know better.

> Andrew,
>
> I don't think we ever solved the problem you saw? What error did you
> get with what shell?

It does seem that just using bash is not sufficient to solve this 
problem. Joel has declared that it must work on Solaris /bin/sh, so work 
there it must. Not that I have any means to test that.

Anyway, here's the transcript showing the problem:

/tmp/ccache$ ./test.sh
starting testsuite base
starting testsuite link
gcc: error trying to exec 'cc1': execvp: No such file or directory
gcc: error trying to exec 'cc1': execvp: No such file or directory
SUITE: "link", TEST: "CCACHE_CPP2" - Files differ: reference_test1.o != 
test1.o
cache directory                     /tmp/ccache/testdir.18802/.ccache
primary config                      /tmp/ccache/testdir.18802/ccache.conf
secondary config      (readonly)
cache hit (direct)                     0
cache hit (preprocessed)               4
cache miss                             3
called for link                        2
called for preprocessing               1
multiple source files                  1
compiler produced stdout               1
couldn't find the compiler             1
bad compiler arguments                 1
unsupported source language            1
unsupported compiler option            1
output to a non-regular file           1
no input file                          1
files in cache                         3
cache size                          12.3 kB
max cache size                       5.0 GB
TEST FAILED
Test data and log file have been left in testdir.18802

I've deliberately moved the sources to /tmp to side-step any possible 
problems caused by calling test.sh from another directory, but it made 
no visible difference.

And now again with bash:

/tmp/ccache$ bash ./test.sh
starting testsuite base
starting testsuite link
starting testsuite hardlink
starting testsuite cpp2
starting testsuite nlevels4
starting testsuite nlevels1
starting testsuite basedir
starting testsuite direct
starting testsuite compression
starting testsuite readonly
starting testsuite extrafiles
starting testsuite cleanup
starting testsuite pch
starting testsuite upgrade
starting testsuite prefix
test done - OK

checkbashisms does indeed return nothing.

Running "sh -x test.sh" shows that the gcc command producing the error:

+ CCACHE_DISABLE=1 gcc -c test1.c -o reference_test1.o -O -O
gcc: error trying to exec 'cc1': execvp: No such file or directory

I don't understand what's wrong with that command. gcc isn't supposed to 
rely on the PATH to find cc1, but presumably it's something environmental.

I'm pretty sure I did not see this problem in the default shell provided 
by Ubuntu 12.04, so it's either a dash bug, or some kind of subtle 
incompatibility.

Andrew


More information about the ccache mailing list