1*4882a593Smuzhiyunfix parallel build issue 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunBuild randomly fails since December 2017 on buildroot 4*4882a593Smuzhiyun(http://autobuild.buildroot.org/?reason=ecryptfs-utils-111): 5*4882a593Smuzhiyun 6*4882a593Smuzhiyunmake[5]: Entering directory '/home/buildroot/autobuild/instance-2/output-1/build/ecryptfs-utils-111/src/utils' 7*4882a593Smuzhiyun /bin/mkdir -p '/home/buildroot/autobuild/instance-2/output-1/target/sbin' 8*4882a593Smuzhiyun /bin/bash ../../libtool --mode=install /usr/bin/install -c mount.ecryptfs umount.ecryptfs mount.ecryptfs_private '/home/buildroot/autobuild/instance-2/output-1/target/sbin' 9*4882a593Smuzhiyunlibtool: install: /usr/bin/install -c mount.ecryptfs /home/buildroot/autobuild/instance-2/output-1/target/sbin/mount.ecryptfs 10*4882a593Smuzhiyun/usr/bin/install: cannot create regular file '/home/buildroot/autobuild/instance-2/output-1/target/sbin/mount.ecryptfs': File exists 11*4882a593SmuzhiyunMakefile:832: recipe for target 'install-rootsbinPROGRAMS' failed 12*4882a593Smuzhiyunmake[5]: *** [install-rootsbinPROGRAMS] Error 1 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunAs spotted by Thomas Petazzoni, build failure happens because of the 15*4882a593Smuzhiyunfollowing line in src/utils/Makefile.am: 16*4882a593Smuzhiyun 17*4882a593Smuzhiyuninstall-exec-hook: install-rootsbinPROGRAMS 18*4882a593Smuzhiyun -rm -f "$(DESTDIR)/$(rootsbindir)/umount.ecryptfs_private" 19*4882a593Smuzhiyun $(LN_S) "mount.ecryptfs_private" "$(DESTDIR)/$(rootsbindir)/umount.ecryptfs_private" 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunThe install-exec-hook target should not have a dependency on 22*4882a593Smuzhiyuninstall-rootsbinPROGRAMS. 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunFrom https://www.gnu.org/software/automake/manual/html_node/Extending.html#Extending: 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun""" 27*4882a593SmuzhiyunIn contrast, some rules also have a way to run another rule, called a 28*4882a593Smuzhiyunhook; hooks are always executed after the main rule’s work is done. The 29*4882a593Smuzhiyunhook is named after the principal target, with ‘-hook’ appended. The 30*4882a593Smuzhiyuntargets allowing hooks are install-data, install-exec, uninstall, dist, 31*4882a593Smuzhiyunand distcheck. 32*4882a593Smuzhiyun 33*4882a593SmuzhiyunFor instance, here is how to create a hard link to an installed program: 34*4882a593Smuzhiyun 35*4882a593Smuzhiyuninstall-exec-hook: 36*4882a593Smuzhiyun ln $(DESTDIR)$(bindir)/program$(EXEEXT) \ 37*4882a593Smuzhiyun $(DESTDIR)$(bindir)/proglink$(EXEEXT) 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun""" 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunSo, they explicitly say that these hooks are run after the main rule 42*4882a593Smuzhiyunwork is done, which means the dependency on install-rootsbinPROGRAMS is 43*4882a593Smuzhiyunnot needed. And the example they use to illustrate is *exactly* the 44*4882a593Smuzhiyunsituation of ecryptfs-utils: creating a link to a program that was 45*4882a593Smuzhiyuninstalled. 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 48*4882a593Smuzhiyun[Upstream status: https://bugs.launchpad.net/ecryptfs/+bug/1857622] 49*4882a593Smuzhiyun 50*4882a593Smuzhiyundiff -Nuar ecryptfs-utils-111-orig/src/utils/Makefile.in ecryptfs-utils-111/src/utils/Makefile.in 51*4882a593Smuzhiyun--- ecryptfs-utils-111-orig/src/utils/Makefile.in 2019-12-26 15:14:16.656146065 +0100 52*4882a593Smuzhiyun+++ ecryptfs-utils-111/src/utils/Makefile.in 2019-12-26 17:36:07.108496164 +0100 53*4882a593Smuzhiyun@@ -1522,7 +1522,7 @@ 54*4882a593Smuzhiyun .PRECIOUS: Makefile 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun-install-exec-hook: install-rootsbinPROGRAMS 58*4882a593Smuzhiyun+install-exec-hook: 59*4882a593Smuzhiyun -rm -f "$(DESTDIR)/$(rootsbindir)/umount.ecryptfs_private" 60*4882a593Smuzhiyun $(LN_S) "mount.ecryptfs_private" "$(DESTDIR)/$(rootsbindir)/umount.ecryptfs_private" 61*4882a593Smuzhiyun 62