Bug 1286667

Summary: CCACHE_HARDLINK break libtool/automake deps handling
Product: [Fedora] Fedora Reporter: Fabrice Bellet <fabrice>
Component: ccacheAssignee: Ville Skyttä <ville.skytta>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: joel, ville.skytta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-04 19:52:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fabrice Bellet 2015-11-30 13:10:21 UTC
This report may possibly apply to automake instead. What I observe in Fedora 23 is that the hardlinking feature of ccache breaks the way dependency files are handled by libtool/automake. The typical case is when a *.Tpo file is moved to *.Plo file with "mv -f" (automake macro). When both files correspond to the same hardlinked one, the mv command fails, and compilation aborts.

Here is for example that happens when building atk, considering atkwindow.c
and its .deps related files atkwindow.Tpo and atkwindow.Plo:

Initially after configure, a single "dummy" atkwindow.Plo file exists.
When I launch the compiler for the first time:

[bellet@bonobo atk (master %)]$ /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I.. -DG_DISABLE_DEPRECATED -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR="\"/opt/gnome/share/locale\"" -pthread -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include  -fvisibility=hidden -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES  -O1 -g -Wall -MT atkwindow.lo -MD -MP -MF .deps/atkwindow.Tpo -c -o atkwindow.lo atkwindow.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I.. -DG_DISABLE_DEPRECATED -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR=\"/opt/gnome/share/locale\" -pthread -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -fvisibility=hidden -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -O1 -g -Wall -MT atkwindow.lo -MD -MP -MF .deps/atkwindow.Tpo -c atkwindow.c  -fPIC -DPIC -o .libs/atkwindow.o

[bellet@bonobo atk (master %)]$ ls -l  /home/bellet/.ccache/6/7/9d1692bbcfe5e29bb780eac544d86f-394577.d .deps/atkwindow* -i
18128139 -rw-rw-r--. 1 bellet bellet     8 Nov 30 13:59 .deps/atkwindow.Plo
18128062 -rw-rw-r--. 2 bellet bellet 10946 Nov 30 13:59 .deps/atkwindow.Tpo
18128062 -rw-rw-r--. 2 bellet bellet 10946 Nov 30 13:59 /home/bellet/.ccache/6/7/9d1692bbcfe5e29bb780eac544d86f-394577.d

Then the makefile moves the *.Tpo file into *.Plo:

[bellet@bonobo atk (master %)]$ mv -f .deps/atkwindow.Tpo .deps/atkwindow.Plo

[bellet@bonobo atk (master %)]$ ls -l  /home/bellet/.ccache/6/7/9d1692bbcfe5e29bb780eac544d86f-394577.d .deps/atkwindow* -i
18128062 -rw-rw-r--. 2 bellet bellet 10946 Nov 30 13:59 .deps/atkwindow.Plo
18128062 -rw-rw-r--. 2 bellet bellet 10946 Nov 30 13:59 /home/bellet/.ccache/6/7/9d1692bbcfe5e29bb780eac544d86f-394577.d

If the compiler is invoked again on the same file:

[bellet@bonobo atk (master %)]$ /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I.. -DG_DISABLE_DEPRECATED -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR="\"/opt/gnome/share/locale\"" -pthread -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include  -fvisibility=hidden -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES  -O1 -g -Wall -MT atkwindow.lo -MD -MP -MF .deps/atkwindow.Tpo -c -o atkwindow.lo atkwindow.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I.. -DG_DISABLE_DEPRECATED -DATK_DISABLE_DEPRECATED -DATK_COMPILATION -DATK_LOCALEDIR=\"/opt/gnome/share/locale\" -pthread -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -fvisibility=hidden -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -O1 -g -Wall -MT atkwindow.lo -MD -MP -MF .deps/atkwindow.Tpo -c atkwindow.c  -fPIC -DPIC -o .libs/atkwindow.o

[bellet@bonobo atk (master %)]$ ls -l  /home/bellet/.ccache/6/7/9d1692bbcfe5e29bb780eac544d86f-394577.d .deps/atkwindow* -i
18128062 -rw-rw-r--. 3 bellet bellet 10946 Nov 30 14:03 .deps/atkwindow.Plo
18128062 -rw-rw-r--. 3 bellet bellet 10946 Nov 30 14:03 .deps/atkwindow.Tpo
18128062 -rw-rw-r--. 3 bellet bellet 10946 Nov 30 14:03 /home/bellet/.ccache/6/7/9d1692bbcfe5e29bb780eac544d86f-394577.d

And the mv command then fails:

[bellet@bonobo atk (master %)]$ mv -f .deps/atkwindow.Tpo .deps/atkwindow.Plo
mv: ‘.deps/atkwindow.Tpo’ and ‘.deps/atkwindow.Plo’ are the same file

It previously worked fine with Fedora 22, so my guess is that something changed in ccache/automake/libtool ?
And if CCACHE_HARDLINK is disabled, everything works as expected.

Comment 1 Ville Skyttä 2015-12-04 18:43:30 UTC
I don't have any info regarding this. Joel, do you? I suggest also asking the libtool/autofoo maintainers.

Comment 2 Joel Rosdahl 2015-12-04 19:21:06 UTC
> It previously worked fine with Fedora 22, so my guess is that something
> changed in ccache/automake/libtool ?

I'd say coreutils: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=222d7ac0c4f5f005438c534f3aba62fd94d96dc2

Nothing much ccache can do about that.

Comment 3 Ville Skyttä 2015-12-04 19:52:17 UTC
Thanks Joel. Sounds plausible; that coreutils change went into 8.24 which is what F-23+ has, while F-22 has 8.23. Closing as CANTFIX based on this.