bug-gnulib
[Top][All Lists]
Advanced

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

Use "$(MKDIR_P) sys", not race-prone "test -d sys || mkdir sys".


From: Jim Meyering
Subject: Use "$(MKDIR_P) sys", not race-prone "test -d sys || mkdir sys".
Date: Thu, 18 Jan 2007 17:19:17 +0100

When building coreutils from scratch using "make -j3" on a uniprocessor
system, I encountered this failure:

  ...
  mv configmake.h-t configmake.h
  mv stdint.h-t stdint.h
  test -d sys || mkdir sys
  test -d sys || mkdir sys
  rm -f sys/stat.h-t sys/stat.h
  { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
            sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|"///usr/include/sys/stat.h"|g' \
                < ./stat_.h; \
          } > sys/stat.h-t
  mv sys/stat.h-t sys/stat.h
  mkdir: cannot create directory `sys': File exists
  make[1]: *** [sys/time.h] Error 1
  make[1]: *** Waiting for unfinished jobs....
  make[1]: Leaving directory `/f/w/cu/lib'
  make: *** [all-recursive] Error 1

So I checked in this fix:

2007-01-18  Jim Meyering  <address@hidden>

        Use "$(MKDIR_P) sys", not race-prone "test -d sys || mkdir sys".
        * modules/sys_stat (Makefile.am): Use "$(MKDIR_P) sys", rather
        than the race-prone "test -d sys || mkdir sys".
        (configure.ac): Use AC_PROG_MKDIR_P.
        * modules/sys_select: Likewise.
        * modules/sys_socket: Likewise.
        * modules/sys_time: Likewise.

Index: modules/sys_stat
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sys_stat,v
retrieving revision 1.10
diff -u -p -r1.10 sys_stat
--- modules/sys_stat    26 Dec 2006 18:42:09 -0000      1.10
+++ modules/sys_stat    18 Jan 2007 16:17:28 -0000
@@ -10,6 +10,7 @@ absolute-header

 configure.ac:
 gl_HEADER_SYS_STAT_H
+AC_PROG_MKDIR_P

 Makefile.am:
 BUILT_SOURCES += $(SYS_STAT_H)
@@ -17,7 +18,7 @@ BUILT_SOURCES += $(SYS_STAT_H)
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
 sys/stat.h: stat_.h
-       test -d sys || mkdir sys
+       $(MKDIR_P) sys
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \
Index: modules/sys_select
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sys_select,v
retrieving revision 1.5
diff -u -p -r1.5 sys_select
--- modules/sys_select  7 Oct 2006 14:54:51 -0000       1.5
+++ modules/sys_select  18 Jan 2007 16:17:28 -0000
@@ -9,6 +9,7 @@ sys_socket

 configure.ac:
 gl_HEADER_SYS_SELECT
+AC_PROG_MKDIR_P

 Makefile.am:
 BUILT_SOURCES += $(SYS_SELECT_H)
@@ -16,7 +17,7 @@ BUILT_SOURCES += $(SYS_SELECT_H)
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
 sys/select.h:
-       test -d sys || mkdir sys
+       $(MKDIR_P) sys
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          echo '#include <sys/socket.h>'; \
Index: modules/sys_socket
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sys_socket,v
retrieving revision 1.9
diff -u -p -r1.9 sys_socket
--- modules/sys_socket  13 Oct 2006 12:40:23 -0000      1.9
+++ modules/sys_socket  18 Jan 2007 16:17:28 -0000
@@ -10,6 +10,7 @@ Depends-on:

 configure.ac:
 gl_HEADER_SYS_SOCKET
+AC_PROG_MKDIR_P

 Makefile.am:
 BUILT_SOURCES += $(SYS_SOCKET_H)
@@ -17,7 +18,7 @@ BUILT_SOURCES += $(SYS_SOCKET_H)
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
 sys/socket.h: socket_.h
-       test -d sys || mkdir sys
+       $(MKDIR_P) sys
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          cat $(srcdir)/socket_.h; \
        } > address@hidden
Index: modules/sys_time
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sys_time,v
retrieving revision 1.1
diff -u -p -r1.1 sys_time
--- modules/sys_time    18 Jan 2007 08:33:35 -0000      1.1
+++ modules/sys_time    18 Jan 2007 16:17:28 -0000
@@ -10,6 +10,7 @@ absolute-header

 configure.ac:
 gl_HEADER_SYS_TIME_H
+AC_PROG_MKDIR_P

 Makefile.am:
 BUILT_SOURCES += sys/time.h
@@ -17,7 +18,7 @@ BUILT_SOURCES += sys/time.h
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
 sys/time.h: sys_time_.h
-       test -d sys || mkdir sys
+       $(MKDIR_P) sys
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \




reply via email to

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