Subject: bug#20186: Failure to create directory during info-building phase of "make distcheck"

From: James Youngman <[email-masked]>
Date: Tue, 24 Mar 2015 00:26:38 +0000

I'm seeing a failure of "make distcheck" which I think is caused by
the fact that Automake 1.14.1's rule for .texi.info is trying to
create a backup directory in a read-only directory:

(sorry about what appear to be problems with leading space)

$ cat doc/Makefile.in
...
.texi.info:
$(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \
am__cwd=`pwd` && $(am__cd) $(srcdir) && \
rm -rf $$backupdir && mkdir $$backupdir && \
if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
 for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9]
$(@:.info=).i[0-9][0-9]; do \
   if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
 done; \
else :; fi && \
cd "$$am__cwd"; \
if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
-o $@ $<; \
then \
 rc=0; \
 $(am__cd) $(srcdir); \
else \
 rc=$$?; \
 $(am__cd) $(srcdir) && \
 $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
fi; \
rm -rf $$backupdir; exit $$rc
...

$ make distcheck
...
make[3]: Entering directory
'/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build/doc'
cp ../locate/dblocation.texi dblocation.texi
restore=: && backupdir=".am$$" && \
am__cwd=`pwd` && CDPATH="${ZSH_VERSION+.}:" && cd ../../doc && \
rm -rf $backupdir && mkdir $backupdir && \
if (/bin/sh /home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/build-aux/missing
makeinfo --version) >/dev/null 2>&1; then \
  for f in ../../doc/find.info ../../doc/find.info-[0-9]
../../doc/find.info-[0-9][0-9] ../../doc/find.i[0-9]
../../doc/find.i[0-9][0-9]; do \
    if test -f $f; then mv $f $backupdir; restore=mv; else :; fi; \
  done; \
else :; fi && \
cd "$am__cwd"; \
if /bin/sh /home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/build-aux/missing
makeinfo   -I ../../doc \
 -o ../../doc/find.info ../../doc/find.texi; \
then \
  rc=0; \
  CDPATH="${ZSH_VERSION+.}:" && cd ../../doc; \
else \
  rc=$?; \
  CDPATH="${ZSH_VERSION+.}:" && cd ../../doc && \
  $restore $backupdir/* `echo "./../../doc/find.info" | sed 's|[^/]*$||'`; \
fi; \
rm -rf $backupdir; exit $rc
mkdir: cannot create directory '.am22323': Permission denied
could not open ../../doc/find.texi: No such file or directory
Makefile:1648: recipe for target '../../doc/find.info' failed
make[3]: *** [../../doc/find.info] Error 1
make[3]: Leaving directory
'/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build/doc'
Makefile:1695: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
'/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build'
Makefile:1635: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory
'/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build'
Makefile:1910: recipe for target 'distcheck' failed
make: *** [distcheck] Error 1

$ ls -l -d /home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build/doc
/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build/
 /home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/
dr-xr-xr-x 14 james lp 4096 Mar 23 23:52
/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/
drwxr-xr-x 12 james lp 4096 Mar 23 23:53
/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build/
drwxr-xr-x  2 james lp 4096 Mar 23 23:54
/home/james/source/GNU/findutils/git/gnu/compile/64/findutils-4.5.15-git/_build/doc

$ automake --version
automake (GNU automake) 1.14.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later
<http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <[email-masked]>
       and Alexandre Duret-Lutz <[email-masked]>.

In case it matters, my regular compile directory (in which "make
distcheck" was invoked) is also a VPATH build, as is the build
configuration created by "make distcheck".

I see that this part of the Automake code changed since the release of
1.14.1, At first glance it looks to me as if git comit
cdba479fe5739555ad9ec30e0224f24b2facf548 might fix the problem.  Is
this likely?

I experimented with "AM_MAKEINFOHTMLFLAGS = --no-split" but this
didn't seem to mitigate my problem.  What else could I try as a
workaround (apart from "install source-built packages of things into
/usr/local until the problem goes away")?

Thanks,
James.