Re: New patchfs script



On Wed, Dec 11, 2002 at 04:42:35PM +0200, Andrew V. Samoilov wrote:
> -    copyout ($ARGV[2], $ARGV[3]);
> +    copyout ($ARGV[2], quotemeta ($ARGV[3]));

The second chunk is invalid.
$ARGV[3] is used only for 'open', and it doesn't need quoting:

bash-2.05b$ perl -we 'open TMP, ">". quotemeta("Q|Q|\\|Q"); print TMP
"xxx\n"; close TMP'
bash-2.05b$ ls Q*
Q\|Q\|\\\|Q

Fixed in attachment.


-- 

  _.|._ |_  _.    : Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|    : gg 1802819, pgp 0xB25952C0
     |            : jid alpha.jabberpl.org
Index: patchfs
===================================================================
RCS file: /cvs/gnome/mc/vfs/extfs/patchfs,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- patchfs	9 Dec 2002 20:16:34 -0000	1.6
+++ patchfs	11 Dec 2002 11:03:26 -0000	1.7
@@ -124,14 +124,15 @@
 
 
 my $tmp;
-$_=`$file $ARGV[1]`;
+my $quoted_name = quotemeta $ARGV[1];
+$_=`$file $quoted_name`;
 if (/bzip/) {
     $tmp=tmpnam();
-    system "$bzcat $ARGV[1] > $tmp";
+    system "$bzcat $quoted_name > $tmp";
     open I, "< $tmp";
 } elsif (/gzip/) {
     $tmp=tmpnam();
-    system "$gzcat $ARGV[1] > $tmp";
+    system "$gzcat $quoted_name > $tmp";
     open I, "< $tmp";
 } else {
     open I, "< $ARGV[1]";


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