automake-patches
[Top][All Lists]
Advanced

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

Re: mkdir, umask, and install


From: Alexandre Duret-Lutz
Subject: Re: mkdir, umask, and install
Date: Thu, 15 May 2003 22:02:31 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3 (gnu/linux)

Hi Billy,

Thank you for this report.

>>> "Billy" == Billy Biggs <address@hidden> writes:

 Billy> In my application, I install some required data files
 Billy> into pkgdatadir, and install my default configuration
 Billy> file (docs/default.tvtime.xml) to sysconfdir, renaming
 Billy> it to $(sysconfdir)/@PACKAGE@/tvtime.xml

 Billy> A user complained that when using a umask of 0077 during
 Billy> 'make install', users can run the application, but not
 Billy> access the data files.  Further investigation has me
 Billy> confused about correctness.

 Billy> automake seems to install data files using install -m
 Billy> 644, and install ignores umask, so the files in the data
 Billy> directory are world readable, as is the binary.
 Billy> However, the directories (bin, share, share/tvtime) are
 Billy> created using mkdir, which listened to the umask.

 Billy> It's unclear what a good policy is here.  Should install
 Billy> be listening to umask?  Should automake use install to
 Billy> create directories and also ignore umask?  In our
 Billy> Makefile.am, we handle creation of sysconfdir/@PACKAGE@
 Billy> ourself, and we use $(INSTALL), should we use mkdir
 Billy> instead to be consistent with automake?

`install -D' will create 755 directories whatever umask is set to,
so my feeling is that Automake's rules should behave similarly.

Jim, any opinion?

2003-05-15  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (handle_configure): Add `-m 755' to the definition of
        mkinstalldirs.
        * lib/install-sh (mkdircmd): New variable.  Use it to
        create directories with mode 755.
        * tests/mkinst3.test: New file.
        * tests/Makefile.am (TESTS): Add mkinst3.test.
        Report from Billy Biggs.

Index: THANKS
===================================================================
RCS file: /cvs/automake/automake/THANKS,v
retrieving revision 1.215
diff -u -r1.215 THANKS
--- THANKS      7 May 2003 20:59:08 -0000       1.215
+++ THANKS      15 May 2003 19:56:09 -0000
@@ -28,6 +28,7 @@
 Bill Currie            address@hidden
 Bill Davidson          address@hidden
 Bill Fenner            address@hidden
+Billy Biggs            address@hidden
 Bob Proulx             address@hidden
 Braden N. McDaniel     address@hidden
 Brendan O'Dea          address@hidden
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1456
diff -u -r1.1456 automake.in
--- automake.in 27 Apr 2003 18:14:34 -0000      1.1456
+++ automake.in 15 May 2003 19:56:18 -0000
@@ -4505,7 +4505,7 @@
 
     # Set location of mkinstalldirs.
     define_variable ('mkinstalldirs',
-                    '$(SHELL) ' . $config_aux_dir . '/mkinstalldirs',
+                    '$(SHELL) ' . $config_aux_dir . '/mkinstalldirs -m 755',
                     INTERNAL);
 
     reject_var ('CONFIG_HEADER',
Index: lib/install-sh
===================================================================
RCS file: /cvs/automake/automake/lib/install-sh,v
retrieving revision 1.11
diff -u -r1.11 install-sh
--- lib/install-sh      9 May 2003 17:58:21 -0000       1.11
+++ lib/install-sh      15 May 2003 19:56:22 -0000
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2003-05-09.19
+scriptversion=2003-05-15.21
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -66,6 +66,7 @@
 chgrpcmd=
 stripcmd=
 rmcmd="$rmprog -f"
+mkdircmd="$mkdirprog -m 755"
 mvcmd="$mvprog"
 src=
 dst=
@@ -159,7 +160,7 @@
     instcmd=:
     chmodcmd=
   else
-    instcmd=$mkdirprog
+    instcmd=$mkdircmd
   fi
 else
   # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
@@ -205,7 +206,7 @@
   while test $# -ne 0 ; do
     pathcomp=$pathcomp$1
     shift
-    test -d "$pathcomp" || $mkdirprog "$pathcomp"
+    test -d "$pathcomp" || $mkdircmd "$pathcomp"
     pathcomp=$pathcomp/
   done
 fi
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.492
diff -u -r1.492 Makefile.am
--- tests/Makefile.am   6 May 2003 22:29:16 -0000       1.492
+++ tests/Makefile.am   15 May 2003 19:56:23 -0000
@@ -282,6 +282,7 @@
 mdate3.test \
 mdate4.test \
 mkinst2.test \
+mkinst3.test \
 mkinstall.test \
 nobase.test \
 nodef.test \
Index: tests/mkinst3.test
===================================================================
RCS file: tests/mkinst3.test
diff -N tests/mkinst3.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/mkinst3.test  15 May 2003 19:56:23 -0000
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Copyright (C) 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure installation is insensible to umask.
+# Report from Billy Biggs.
+
+required=non-root
+. ./defs || exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+nobase_pkgdata_DATA = foo bar/baz
+END
+
+mkdir bar
+echo 'ok' > foo
+echo 'ok' > bar/baz
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure --prefix `pwd`/_inst
+umask 0777
+$MAKE install
+grep ok _inst/share/mkinst3/foo
+grep ok _inst/share/mkinst3/bar/baz


-- 
Alexandre Duret-Lutz





reply via email to

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