From ad42905ecf5498fbf132fa862ae4386a5f0b7739 Mon Sep 17 00:00:00 2001 From: Daniel Borca Date: Mon, 24 Aug 2009 17:41:36 +0300 Subject: [PATCH] Ticket #1477: incorrect detection of compressed patchfs UseCase: * rename any patch file into patch_file.lzma_tar.patch.gz for example * try to enter into renamed file (press Enter key on a file in panel) * You'll see error message 'sh: lzma: command not found' Fix issue: * Add -b key into call of 'file' utility (to avoid filename in output) * better parse 'file -b' output Signed-off-by: Slava Zanko --- vfs/extfs/patchfs.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vfs/extfs/patchfs.in b/vfs/extfs/patchfs.in index 35100ae7e..0b18070d1 100644 --- a/vfs/extfs/patchfs.in +++ b/vfs/extfs/patchfs.in @@ -17,7 +17,7 @@ my $lzma = 'lzma'; my $xz = 'xz'; my $bzip = 'bzip2'; my $gzip = 'gzip'; -my $fileutil = 'file'; +my $fileutil = 'file -b'; # date parsing requires Date::Parse from TimeDate module my $parsedates = eval 'require Date::Parse'; @@ -74,13 +74,13 @@ sub myin my ($qfname)=(quotemeta $_[0]); $_=`$fileutil $qfname`; - if (/lzma/) { + if (/^'*lzma/) { return "$lzma -dc $qfname"; - } elsif (/xz/) { + } elsif (/^'*xz/) { return "$xz -dc $qfname"; - } elsif (/bzip/) { + } elsif (/^'*bzip/) { return "$bzip -dc $qfname"; - } elsif (/gzip/) { + } elsif (/^'*gzip/) { return "$gzip -dc $qfname"; } else { return "cat $qfname"; @@ -94,13 +94,13 @@ sub myout my ($sep) = $append ? '>>' : '>'; $_=`$fileutil $qfname`; - if (/lzma/) { + if (/^'*lzma/) { return "$lzma -c $sep $qfname"; - } elsif (/xz/) { + } elsif (/^'*xz/) { return "$xz -c $sep $qfname"; - } elsif (/bzip/) { + } elsif (/^'*bzip/) { return "$bzip -c $sep $qfname"; - } elsif (/gzip/) { + } elsif (/^'*gzip/) { return "$gzip -c $sep $qfname"; } else { return "cat $sep $qfname";