octave-maintainers
[Top][All Lists]
Advanced

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

Re: [ccache] build octave with ccache causes segfault when checkinstall


From: Joel Rosdahl
Subject: Re: [ccache] build octave with ccache causes segfault when checkinstall
Date: Wed, 03 Aug 2011 20:17:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11

On 2011-07-04 14:44, Andreas Weber wrote:
> [...]
> address@hidden:~/src/build_octave$ checkinstall
> ...
> /home/andy/src/build_octave/libtool: line 8970:  4125 Segmentation fault
>      ccache g++ -fPIC -DPIC -shared -nostdlib
> [...]
> This looks like ccache causes a segfault. I have reproduced this on
> different machines over the last 4 months.

I have now also reproduced the segfault. There's a bug in checkinstall's
installwatch wrapper that triggers a bug in ccache.

More specifically, checkinstall calls installwatch to run a command
whose file system accesses are to be watched, and this is done by
preloading installwatch.so, which wraps a number of functions. The
wrapped getcwd(buffer, size) function copies the result to the buffer
but returns a pointer to an internally allocated buffer (and leaks the
memory, by the way), which works for callers that do this:

        char buffer[MAXPATHLEN];
        if (!getcwd(buffer, sizeof(buffer)) {
                /* Failure */
        }

But not for callers that do this:

        char buffer[MAXPATHLEN];
        if (getcwd(buffer, sizeof(buffer) != buffer) {
                /* Failure */
        }

(getcwd is specified to return the buffer pointer on success, so both
versions are valid.) ccache does the latter, and then fails to handle
the failed getcwd call correctly.

I'll include a fix in ccache 3.1.6.

-- Joel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]