[Top][All Lists]

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

Re: AM_PROG_MKDIR_P overcautious?

From: Alexandre Duret-Lutz
Subject: Re: AM_PROG_MKDIR_P overcautious?
Date: Sun, 07 Aug 2005 10:09:54 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

>>> "SK" == Stepan Kasal <address@hidden> writes:

 SK> Hello,
 SK> regarding the bug report about `mkdir -p -- .', archived at:

 SK> I think that the problem described here is a bug in a vendor mkdir.
 SK> Generally, mkdir -p on any existing directory should succeed, no matter
 SK> whether it is writable or not.

 SK> I asked Harlan Stenn, the author of the bug report, about the details,
 SK> but he doesn't remember.

OK.  Let's just fix the comment then.  I can't see any
compelling reason to add that dot back, especially since it took
several versions to get this check to a point where nobody is
complaining about it.

I'm installing this on HEAD.

2005-08-07  Alexandre Duret-Lutz  <address@hidden>

        * m4/mkdirp.m4: Update misleading comment about `mkdir -p .'.
        Prompted by Stepan Kasal.

Index: m4/mkdirp.m4
RCS file: /cvs/automake/automake/m4/mkdirp.m4,v
retrieving revision 1.7
diff -u -r1.7 mkdirp.m4
--- m4/mkdirp.m4        9 Jan 2005 14:46:21 -0000       1.7
+++ m4/mkdirp.m4        7 Aug 2005 08:08:05 -0000
@@ -25,30 +25,34 @@
 # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
 # concurrently, both version can detect that a/ is missing, but only
 # one can create it and the other will error out.  Consequently we
-# restrict ourselves to GNU make (using the --version option ensures
+# restrict ourselves to GNU mkdir (using the --version option ensures
 # this.)
 [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-  # We used to keeping the `.' as first argument, in order to
+  # We used to define $(mkdir_p) as `mkdir -p -- .', in order to
   # allow $(mkdir_p) to be used without argument.  As in
   #   $(mkdir_p) $(somedir)
-  # where $(somedir) is conditionally defined.  However this is wrong
-  # for two reasons:
-  #  1. if the package is installed by a user who cannot write `.'
-  #     make install will fail,
-  #  2. the above comment should most certainly read
-  #     $(mkdir_p) $(DESTDIR)$(somedir)
-  #     so it does not work when $(somedir) is undefined and
-  #     $(DESTDIR) is not.
-  #  To support the latter case, we have to write
-  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
-  #  so the `.' trick is pointless.
+  # where $(somedir) is conditionally defined.  However we don't do
+  # that anymore.
+  #  1. before we restricted the check to GNU mkdir, `mkdir -p .' was
+  #     reported to fail in read-only directories.  The system where this
+  #     happened has been forgotten.
+  #  2. in practice we call $(mkdir_p) on directories such as
+  #       $(mkdir_p) "$(DESTDIR)$(somedir)"
+  #     and we don't want to create $(DESTDIR) if $(somedir) is empty.
+  #     To support the latter case, we have to write
+  #       test -z "$(somedir)" || $(mkdir_p) "$(DESTDIR)$(somedir)"
+  #     so $(mkdir_p) always has an argument.
+  #     We will have better chances of detecting a missing test if
+  #     $(mkdir_p) complains about missing arguments.
+  #  3. $(mkdir_p) is named after `mkdir -p' and we don't expect this
+  #     to accept no argument.
+  #  4. having something like `mkdir .' in the output is unsightly.
   mkdir_p='mkdir -p --'
   # On NextStep and OpenStep, the `mkdir' command does not
   # recognize any option.  It will interpret all options as
-  # directories to create, and then abort because `.' already
-  # exists.
+  # directories to create.
   for d in ./-p ./--version;
     test -d $d && rmdir $d

Alexandre Duret-Lutz

reply via email to

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