automake-patches
[Top][All Lists]
Advanced

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

Re: Make ar-lib support backslashed files in archives.


From: Ralf Wildenhues
Subject: Re: Make ar-lib support backslashed files in archives.
Date: Sun, 3 Oct 2010 12:02:51 +0200
User-agent: Mutt/1.5.20 (2010-08-04)

Hello again,

* Peter Rosin wrote on Thu, Sep 02, 2010 at 04:52:20PM CEST:
> From 63daad5a46cecf88c168e20febdec7d53568c111 Mon Sep 17 00:00:00 2001
> From: Peter Rosin <address@hidden>
> 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.

> --- 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"
> +
>  :

This test fails when echo interprets backslashes:

+ touch fake2.lib
+ ./ar-lib ./lib x fake2.lib
+ opts=lib -NOLOGO -EXTRACT:dir^Lake2.obj fake2.lib
+ test xlib -NOLOGO -EXTRACT:dir^Lake2.obj fake2.lib = xlib -NOLOGO 
-EXTRACT:dir\fake2.obj fake2.lib
+ exit_status=1

(the ^L are form feeds).

I'm pushing this fix to the msvc branch and merging to master;
while at it, let's also avoid 'test -a'.

Cheers,
Ralf

    tests: fix ar-lib.test for echo that interprets backslashes.
    
    * tests/ar-lib.test: Use printf instead of echo.  Avoid test -a.
    More robust quoting.

diff --git a/tests/ar-lib.test b/tests/ar-lib.test
index 4759b65..31d87ed 100755
--- a/tests/ar-lib.test
+++ b/tests/ar-lib.test
@@ -21,15 +21,15 @@
 set -e
 
 cp "$testsrcdir/../lib/ar-lib" .
-# Use a dummy lib, since lib isn't readily available on all systems
+# Use a dummy lib, since lib isn't readily available on all systems.
 cat >lib <<'END'
 #! /bin/sh
-if test x"$2" = x-LIST -a $3 = fake.lib; then
+if test x"$2" = x-LIST && test x"$3" = xfake.lib; then
   echo fake.obj
-elif test x"$2" = x-LIST -a $3 = fake2.lib; then
-  echo dir\\fake2.obj
+elif test x"$2" = x-LIST && test x"$3" = xfake2.lib; then
+  printf "%s\n" "dir\\fake2.obj"
 else
-  echo "lib $@"
+  printf "%s\n" "lib $*"
 fi
 END
 



reply via email to

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