>From 63daad5a46cecf88c168e20febdec7d53568c111 Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Thu, 2 Sep 2010 16:46:14 +0200 Subject: [PATCH] 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. * lib/ar-lib.test: Test the above. Signed-off-by: Peter Rosin --- ChangeLog | 7 +++++++ lib/ar-lib | 2 +- tests/ar-lib.test | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d80edb..aaebf94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-09-02 Peter Rosin + + 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. + * lib/ar-lib.test: Test the above. + 2010-08-31 Peter Rosin Do file name conversion for object files in the compile wrapper. diff --git a/lib/ar-lib b/lib/ar-lib index ef03430..0f0a31b 100755 --- a/lib/ar-lib +++ b/lib/ar-lib @@ -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 diff --git a/tests/ar-lib.test b/tests/ar-lib.test index d418c21..4759b65 100755 --- a/tests/ar-lib.test +++ b/tests/ar-lib.test @@ -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" + : -- 1.7.1