automake's make install seems to create directories using mkdir when
it should use install to get the permissions right. Thanks to Bruno
Haible for the analysis below.


---------- Forwarded message ----------
From: Bruno Haible <br...@clisp.org>
Date: 2 May 2010 19:46:54 UTC+1
Subject: Re: [bug-libunistring] Small "make install" problem
To: bug-libunistr...@gnu.org
Cc: Reuben Thomas <r...@sc3d.org>


Hi,

Reuben Thomas wrote in
<http://lists.gnu.org/archive/html/bug-libunistring/2010-04/msg00002.html>:
> When I "sudo make install 0.9.2.1", where my user's umask is 0027, all
> of the files are installed with correct (world-readable & executable
> as necessary) permissions, but the unistring include directory itself
> is created with my user's umask (i.e. with perms 0770), although the
> files in it are created correctly world readable (0644).

This comes from the MKDIR_P and INSTALL_DATA values that are substituted
in lib/Makefile. On my system I see

 MKDIR_P = /arch/x86-linux/gnu/bin/mkdir -p
 INSTALL = /arch/x86-linux/gnu/bin/install -c
 INSTALL_DATA = ${INSTALL} -m 644
 INSTALL_PROGRAM = ${INSTALL}
 INSTALL_SCRIPT = ${INSTALL}

which explains why the creation of a subdirectory is sensitive to your
umask and the creation of installed files is not.

The code which creates the installation directory is found in
lib/Makefile.in, generated by Automake:

install-nobase_includeHEADERS: $(nobase_include_HEADERS)
      �...@$(NORMAL_INSTALL)
       test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
      �...@list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
       $(am__nobase_list) | while read dir files; do \
         xfiles=; for file in $$files; do \
           if test -f "$$file"; then xfiles="$$xfiles $$file"; \
           else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
         test -z "$$xfiles" || { \
           test "x$$dir" = x. || { \
             echo "$(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \
             $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \
           echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \
           $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir"
|| exit $$?; }; \
       done

As you can see, it uses $(MKDIR_P). If it were to use instead
 $(install_sh) -d -m 0755
it would behave as you wish.

Please report this to the bug-automake mailing list.

Bruno



-- 
http://rrt.sc3d.org


Reply via email to