CVSROOT: cvslog.pl - protect escapes from split

qboosh qboosh at pld-linux.org
Tue Sep 30 19:43:22 CEST 2008


Author: qboosh                       Date: Tue Sep 30 17:43:22 2008 GMT
Module: CVSROOT                       Tag: HEAD
---- Log message:
- protect escapes from split

---- Files affected:
CVSROOT:
   cvslog.pl (1.81 -> 1.82) 

---- Diffs:

================================================================
Index: CVSROOT/cvslog.pl
diff -u CVSROOT/cvslog.pl:1.81 CVSROOT/cvslog.pl:1.82
--- CVSROOT/cvslog.pl:1.81	Mon Jul 14 18:55:46 2008
+++ CVSROOT/cvslog.pl	Tue Sep 30 19:43:16 2008
@@ -160,7 +160,11 @@
 if ($old_cmdargs) {
   # The old command format is handled by converting it to the new format making
   # @input reflect how @ARGV looks for the new format.
-  @input = split (/[ ,]/, ($ARGV[0] or ''));
+  my $cmdargs = ($ARGV[0] or '');
+  # little trick to support escapes which are not separators ("\ " or "\,");
+  # we can use " ,, " sequence as it would be invalid in args
+  $cmdargs =~ s/([^\\])[ ,]/$1 ,, /g;
+  @input = split (/ ,, /, $cmdargs);
 } else {
   @input = @ARGV;
 }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/CVSROOT/cvslog.pl?r1=1.81&r2=1.82&f=u



More information about the pld-cvs-commit mailing list