Hi!
[Automakers, this is from the libtool-patches list...]
Den 2010-09-02 15:06 skrev Peter Rosin:
> 112: Test 24 33 34 45 47 99 100 are "new" failures with low max_cmd_len
> and I think the reason is that the file name conversion adds escapes for
> the backslashes. I.e. .libs/a1.obj -> .libs\\a1.obj when in this case
> .libs\a1.obj is desired. 25 also fails earlier, probably due to the same
> thing. However, my previous suggestion with a naive_slashify instead of
> naive_backslashify doesn't work either since MSYS turns @c:/foobar into
> @c;c:\msys\1.0\foobar (or something similar, that was from memory) which
> we must avoid at all cost. cygpath -m (instead of -w) is fine on Cygwin
> though since Cygwin doesn't clobber @c:/foobar "for us".
>
> Maybe we can work around this by sanitizing the input files in ar-lib,
> but that seems a bit horrible to me... I'll see if I can fix this
> somehow. Suggestions welcome.
It is actually a bug in ar-lib. When you issue
.../ar-lib lib x foo.lib
it runs this loop:
$AR -NOLOGO -LIST "$archive" | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
(with archive=foo.lib)
and that reads members from the archive but breaks if there's a
backslash in one of the members. This works much better:
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
Ok for the msvc branch?
The code added to the test fails with old ar-lib and works with the change.
Cheers,
Peter
>From 63daad5a46cecf88c168e20febdec7d53568c111 Mon Sep 17 00:00:00 2001
From: Peter Rosin <[email protected]>
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 <[email protected]>
---
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 <[email protected]>
+
+ 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 <[email protected]>
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