Make ar-lib support backslashed files in archives.
authorPeter Rosin <peda@lysator.liu.se>
Thu, 2 Sep 2010 19:04:00 +0000 (21:04 +0200)
committerPeter Rosin <peda@lysator.liu.se>
Thu, 2 Sep 2010 19:04:00 +0000 (21:04 +0200)
* lib/ar-lib: If an archive member contains a backslash, make sure
it is escaped when the archive member is extracted.
* tests/ar-lib.test: Test the above.

Signed-off-by: Peter Rosin <peda@lysator.liu.se>
ChangeLog
lib/ar-lib
tests/ar-lib.test

index 5d80edb..02f2fcd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,16 @@
+2010-09-02  Peter Rosin  <peda@lysator.liu.se>
+
+       Make ar-lib support backslashed files in archives.
+       * lib/ar-lib: If an archive member contains a backslash, make sure
+       it is escaped when the archive member is extracted.
+       * tests/ar-lib.test: Test the above.
+
 2010-08-31  Peter Rosin  <peda@lysator.liu.se>
 
        Do file name conversion for object files in the compile wrapper.
        * lib/compile (func_cl_wrapper): Do file name conversion for object
        files (i.e. extensions .obj, .OBJ, .o and .O) if needed.
-       * lib/compile4.test: Test the above.
+       * tests/compile4.test: Test the above.
 
 2010-08-16  Peter Rosin  <peda@lysator.liu.se>
 
@@ -22,7 +29,7 @@
        file extension as C++, unless it's given a hint. So hint about
        .cc, .CC, .cxx, .CXX, c++ and C++. Also do path conversion on
        .c, .cpp, .CPP, .lib, .LIB and .Lib files.
-       * lib/compile3.test: Test the C++ hinting.
+       * tests/compile3.test: Test the C++ hinting.
 
 2010-08-12  Peter Rosin  <peda@lysator.liu.se>
 
index ef03430..4883fef 100755 (executable)
@@ -2,7 +2,7 @@
 # Wrapper for Microsoft lib.exe
 
 me=ar-lib
-scriptversion=2010-08-12.16; # UTC
+scriptversion=2010-09-02.19; # UTC
 
 # Copyright (C) 2010 Free Software
 # Foundation, Inc.
@@ -219,7 +219,7 @@ elif test -n "$extract"; then
       esac
     done
   else
-    $AR -NOLOGO -LIST "$archive" | while read member
+    $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
     do
       $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
     done
index d418c21..4759b65 100755 (executable)
@@ -26,6 +26,8 @@ cat >lib <<'END'
 #! /bin/sh
 if test x"$2" = x-LIST -a $3 = fake.lib; then
   echo fake.obj
+elif test x"$2" = x-LIST -a $3 = fake2.lib; then
+  echo dir\\fake2.obj
 else
   echo "lib $@"
 fi
@@ -76,4 +78,9 @@ test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
 opts=`./ar-lib ./lib -lib -LTCG x foo.lib foo.obj`
 test x"$opts" = x"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib"
 
+# Check if ar-lib can extract backslashed members
+touch fake2.lib
+opts=`./ar-lib ./lib x fake2.lib`
+test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib"
+
 :