tags 635572 + patch
thanks

On 2012-01-12 10:16 +0100, Sven Joachim wrote:

> On 2011-07-27 05:13 +0200, Ian Zimmerman wrote:
>
>> At line 117 of the aptitude-run-state-bundle script we find this:
>>
>>     if file "$INPUTFILE" | grep bzip2 2>/dev/null > /dev/null
>>
>> therefore, aptitude should depend on file ...
>
> Since aptitude-run-state-bundle is not normally run by users, adding
> that dependency and thereby increasing file's priority from standard to
> important seems wrong in any case.
>
> However, GNU tar has been auto-detecting compression formats since
> version 1.21, and therefore it is probably no longer necessary to run
> `file' to determine the compression format at all.  I'll prepare a patch
> in the next few days if nobody beats me to it.

See the attached patch.  It might not work with other tar
implementations, but GNU tar seems to be required for dpkg anyway, so I
guess nobody cares.  It also makes it trivial to support xz compression
in aptitude-run-state-bundle, if somebody ever implements that in
aptitude-create-state-bundle.

Sven

>From 7bfcc3b8f4ba0ef0e9a7c4b081cc5aad4e271057 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Sat, 14 Jan 2012 19:20:16 +0100
Subject: [PATCH] Don't run "file" in aptitude-run-state-bundle (Closes:
 #635572)

Rely on tar autodetecting the compression type, which GNU tar has been
doing since version 1.21.
---
 aptitude-run-state-bundle |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/aptitude-run-state-bundle b/aptitude-run-state-bundle
index 0beddfd..a75f491 100755
--- a/aptitude-run-state-bundle
+++ b/aptitude-run-state-bundle
@@ -114,14 +114,7 @@ then
        exit 1
     fi
 
-    if file "$INPUTFILE" | grep bzip2 2>/dev/null > /dev/null
-    then
-       DECOMPRESSOR=bunzip2
-    else
-       DECOMPRESSOR=gunzip
-    fi
-
-    ($DECOMPRESSOR -c < "$INPUTFILE") | (cd "$tempdir" && tar x) || exit 1
+    tar -C "$tempdir" -xf "$INPUTFILE" || exit 1
 fi
 
 if [ $UNPACK_ONLY = 1 ]
-- 
1.7.8.3

Reply via email to