libtool-patches
[Top][All Lists]
Advanced

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

FYI: libtool--devo--1.0--patch-188


From: Gary V. Vaughan
Subject: FYI: libtool--devo--1.0--patch-188
Date: Fri, 17 Sep 2004 15:14:36 +0100 (BST)
User-agent: mailnotify/0.3

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Applied to HEAD.
- -- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
_________________________________________________________
This patch notification generated by tlaapply version 0.5
http://tkd.kicks-ass.net/arch/address@hidden/cvs-utils--tla--1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)

iD8DBQFBSvFMFRMICSmD1gYRAvTJAJsGsGG+heRUfXU+zN9Zh70RByfKRwCfQnFN
fjhb7kDcjEzhpUDCOrGWZBI=
=bhP8
-----END PGP SIGNATURE-----
* looking for address@hidden/libtool--devo--1.0--patch-187 to compare with
* comparing to address@hidden/libtool--devo--1.0--patch-187
M  ChangeLog
M  libtoolize.in
M  config/ltmain.in
M  tests/defs

* modified files

Index: Changelog
from  Gary V. Vaughan  <address@hidden>

        Missed a couple of MKDIR_P references in ltmain.in in my last
        patch; fix them carefully.  Introduce an opt_dry_run to ltmain.in
        so that the implementations of func_mkdir_p can converge, and a
        func_mktempdir to do a better job of temporary directory creation:

        * libtoolize.in (func_mkdir_p): Don't fail if the directory wasn't
        created in dry run mode.
        * tests/defs (func_mkdir_p): Ditto.  We don't actually have a dry
        run mode for the tests, but the function is written carefully to
        be kept in synch and work correctly here too.
        * config/ltmain.in (func_mkdir_p): Ditto.  This copy of the
        function now only differs in its use of $echo over $ECHO.
        (func_extract_archive): Removed first redundant mkdir call.
        (func_mktempdir): New function that tries to avoid races when
        making temporary directories.
        (opt_dry_run): Set this if --dry-run is given at the CLI, or if
        tests/mdemo-dryrun.test has forced the value of $run.
        (func_mode_install): Call $MKDIR directly and error out if the
        directory cannot be created.
        (func_mode_link): Rather than copying func_mkdir_p into the
        wrapper script as a replacement for $MKDIR_P, we know that the
        script won't be called my `make -j', so write the current value of
        $MKDIR.

--- orig/config/ltmain.in
+++ mod/config/ltmain.in
@@ -193,8 +193,9 @@
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 
-opt_help=false
+opt_dry_run=${run-false}  ## inherit $run when mdemo-dryrun.test sets it above
 opt_duplicate_deps=false
+opt_help=false
 
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
@@ -618,11 +619,15 @@
                        set -x
                        ;;
 
-      --dlopen)                test "$#" -eq 0 && func_missing_arg "$opt" && 
break
+      -dlopen)         test "$#" -eq 0 && func_missing_arg "$opt" && break
                        execute_dlfiles="$execute_dlfiles $1"
+                       shift
+                       ;;
+
+      --dry-run | -n)  opt_dry_run=:
+                       run=:
                        ;;
 
-      --dry-run | -n)  run=:                                           ;;
       --features)       func_features                                  ;;
       --finish)                mode="finish"                                   
;;
 
@@ -663,7 +668,7 @@
                        ;;
 
       # Separate optargs to long options:
-      --dlopen=*|--mode=*|--tag=*)
+      -dlopen=*|--mode=*|--tag=*)
                        arg=`echo "$opt" | $SED "$my_sed_long_arg"`
                        opt=`echo "$opt" | $SED "$my_sed_long_opt"`
                        set -- "$opt" "$arg" ${1+"$@"}
@@ -721,7 +726,7 @@
     my_directory_path="$1"
     my_dir_list=
 
-    if test -n "$my_directory_path"; then
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
 
       # Protect directory names starting with `-'
       case $my_directory_path in
@@ -751,11 +756,45 @@
         $MKDIR "$my_dir" 2>/dev/null || :
       done
       IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
     fi
+}
+
+
+# func_mktempdir
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/libtool"
 
-    # Bail out if we (or some other process) failed to create a directory.
-    test -d "$my_directory_path" || \
-      func_fatal_error "Failed to create \`$1'"
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    echo "$my_tmpdir"
 }
 
 
@@ -1113,8 +1152,6 @@
     my_xabs=""
     my_xdir=""
 
-    func_mkdir_p "$my_gentop"
-
     for my_xlib in $my_oldlibs; do
       # Extract the objects.
       case $my_xlib in
@@ -1152,7 +1189,7 @@
              $RM "${darwin_base_archive}"
              cd "$darwin_curdir"
            done # $darwin_arches
-      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
            darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | 
$NL2SP`
            darwin_file=
            darwin_files=
@@ -2187,18 +2224,7 @@
          outputname=
          if test "$fast_install" = no && test -n "$relink_command"; then
            if test "$finalize" = yes && test -z "$run"; then
-             tmpdir="/tmp"
-             test -n "$TMPDIR" && tmpdir="$TMPDIR"
-             tmpdir="$tmpdir/libtool-$$"
-             save_umask=`umask`
-             umask 0077
-             if $MKDIR_P "$tmpdir"; then
-               umask $save_umask
-             else
-               umask $save_umask
-               func_error "error: cannot create temporary directory \`$tmpdir'"
-               continue
-             fi
+             func_mktempdir "${TMPDIR-/tmp}/libtool-XXXXXXXX"
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
              outputname="$tmpdir/$file"
              # Replace the output file specification.
@@ -6215,7 +6241,7 @@
     file=\"\$\$-\$program\"
 
     if test ! -d \"\$progdir\"; then
-      $MKDIR_P \"\$progdir\"
+      $MKDIR \"\$progdir\"
     else
       $RM \"\$progdir/\$file\"
     fi"


--- orig/libtoolize.in
+++ mod/libtoolize.in
@@ -315,7 +315,7 @@
     my_directory_path="$1"
     my_dir_list=
 
-    if test -n "$my_directory_path"; then
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
 
       # Protect directory names starting with `-'
       case $my_directory_path in
@@ -345,11 +345,11 @@
         $MKDIR "$my_dir" 2>/dev/null || :
       done
       IFS="$save_mkdir_p_IFS"
-    fi
 
-    # Bail out if we (or some other process) failed to create a directory.
-    test -d "$my_directory_path" || \
-      func_fatal_error "Failed to create \`$1'"
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
 }
 
 


--- orig/tests/defs
+++ mod/tests/defs
@@ -191,7 +191,7 @@
     my_directory_path="$1"
     my_dir_list=
 
-    if test -n "$my_directory_path"; then
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
 
       # Protect directory names starting with `-'
       case $my_directory_path in
@@ -221,11 +221,11 @@
         $MKDIR "$my_dir" 2>/dev/null || :
       done
       IFS="$save_mkdir_p_IFS"
-    fi
 
-    # Bail out if we (or some other process) failed to create a directory.
-    test -d "$my_directory_path" || \
-      func_fatal_error "Failed to create \`$1'"
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
 }
 
 # func_mkprefixdir




reply via email to

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