libtool-patches
[Top][All Lists]
Advanced

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

branch-1-5: root-owned libtool files in build tree after relink


From: Ralf Wildenhues
Subject: branch-1-5: root-owned libtool files in build tree after relink
Date: Sun, 3 Jul 2005 10:39:46 +0200
User-agent: Mutt/1.5.9i

Hi Thorsten, Marc, others,

I noted a work-around in the MirBSD port of Libtool for root-created
leftovers in .libs after a `make install' which requires relinking,
namely this patch (which is part of a larger patch), with this ID:
| +# $MirOS: ltmain.in,v 1.15 2005/05/14 16:16:25 tg Exp $

| @@ -277,8 +277,8 @@ func_extract_archives ()
|  
|      $show "${rm}r $my_gentop"
|      $run ${rm}r "$my_gentop"
| -    $show "$mkdir $my_gentop"
| -    $run $mkdir "$my_gentop"
| +    $show "$mkdir -m 0775 $my_gentop"
| +    $run $mkdir -m 0775 "$my_gentop"
|      my_status=$?
|      if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
|        exit $my_status
| @@ -295,8 +295,8 @@ func_extract_archives ()
|  
|        $show "${rm}r $my_xdir"
|        $run ${rm}r "$my_xdir"
| -      $show "$mkdir $my_xdir"
| -      $run $mkdir "$my_xdir"
| +      $show "$mkdir -m 0775 $my_xdir"
| +      $run $mkdir -m 0775 "$my_xdir"
|        status=$?
|        if test "$status" -ne 0 && test ! -d "$my_xdir"; then
|         exit $status

The patch is wrong.  It is also a minor security issue, because you
allow other members of your group to write to files you read later
(Usually, that turns out to be a non-issue with root:root).

Could you confirm that this patch below fixes the issue instead?

Thanks,
Ralf

2005-07-03  Albert Chin-A-Young  <address@hidden>

        * ltmain.in: When a library is installed, dependent on a
        convenience library, and it involves relinking, the object
        files extracted from the convenience library are not removed
        after the relink. This is a problem if you build as non-root,
        install as root, then try to remove the build directory as
        non-root; Clean up properly if relink fails; Change
        "$realname"U to ${realname}T to be consistent.
        Missing backport of 2004-03-24 patch reported against MirLibtool
        by Marc Matteo <address@hidden>.

Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.74
diff -u -r1.334.2.74 ltmain.in
--- ltmain.in   1 Jul 2005 02:23:01 -0000       1.334.2.74
+++ ltmain.in   3 Jul 2005 08:31:39 -0000
@@ -4009,13 +4009,30 @@
          IFS="$save_ifs"
          eval cmd=\"$cmd\"
          $show "$cmd"
-         $run eval "$cmd" || exit $?
+         $run eval "$cmd" || {
+           lt_exit=$?
+
+           # Restore the uninstalled library and exit
+           if test "$mode" = relink; then
+             $run eval '(cd $output_objdir && $rm ${realname}T && $mv 
${realname}U $realname)'
+           fi
+
+           exit $lt_exit
+         }
        done
        IFS="$save_ifs"
 
        # Restore the uninstalled library and exit
        if test "$mode" = relink; then
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname 
${realname}T && $mv "$realname"U $realname)' || exit $?
+
+         if test -n "$convenience"; then
+           if test -z "$whole_archive_flag_spec"; then
+             $show "${rm}r $gentop"
+             $run ${rm}r "$gentop"
+           fi
+         fi
+
          exit $EXIT_SUCCESS
        fi
 
@@ -5615,7 +5632,16 @@
            IFS="$save_ifs"
            eval cmd=\"$cmd\"
            $show "$cmd"
-           $run eval "$cmd" || exit $?
+           $run eval "$cmd" || {
+             lt_exit=$?
+
+             # Restore the uninstalled library and exit
+             if test "$mode" = relink; then
+               $run eval '(cd $output_objdir && $rm ${realname}T && $mv 
${realname}U $realname)'
+             fi
+
+             exit $lt_exit
+           }
          done
          IFS="$save_ifs"
        fi




reply via email to

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