Thu 20 Nov 2008 06:47:36 AM UTC, comment #2:
a clumsy single-purpose patch is:
--- patchfs_ 2008-11-20 06:07:51.000000000 +0100
+++ patchfs 2008-11-20 07:42:18.000000000 +0100
@@ -10,6 +10,7 @@
use strict;
use POSIX;
use File::Temp 'tempfile';
+use IO::Handle;
# standard binaries
my $bzip = 'bzip2';
@@ -149,6 +150,15 @@
}
}
+sub _b
+{
+ my ($buf, $c)=@_;
+ return if $$buf !~ /^--- /;
+ $c = IO::Handle::getc(*I);
+ IO::Handle::ungetc(*I, ord($c));
+ return 1 if ord($c) == 43; # ord("+")
+}
+
# list files affected by patch
sub list
{
@@ -168,7 +178,7 @@
# recognize diff type
if (!$unified && !$context) {
- $unified=1 if (/^--- /);
+ $unified=1 if b(\$);
$context=1 if (/^\\\* /);
if (!$unified && !$context) {
$len+=length;
@@ -176,7 +186,7 @@
}
}
- if (($unified && /^--- /) || ($context && /^\\\* [^\]$/)) {
+ if (($unified && b(\$)) || ($context && /^\\\* [^\]$/)) {
# start of new file
if ($state==1) {
printf "-rw-r--r-- 1 %s %s %d %s %s%s\n", $uid, $gid, $len, datetime($time), $prefix, $f
|
Thu 20 Nov 2008 05:17:52 AM UTC, original submission:
THIS ITEM WAS REASSIGNED TO BUG #24906
Problem: In my patch file is "---" on the beginning of line.
For better explanation i was changed my patchfs script:
# diff patchfs_ patchfs
142c142
< error "Can't parse unified diff header"
---
> error "Can't parse unified diff header >>$$buf<<"
The script output is:
$ /usr/share/mc/extfs/patchfs list adonis.patch.bz2
-rw-r--r-- 1 igor igor 566 02-09-2008 04:00 adonis/bin/adv_sugg_maintain.sh.diff
-rw-r--r-- 1 igor igor 1936 09-05-2008 23:52 adonis/bin/archiv.sh.diff
Can't parse unified diff header >>--- where ar.last_update >= "2008-09-25"
-group by 1,2
-order by 1,2;
<<
In one of original data file is line with "--" (a sql comment without blank space on the bebinning):
-- where ar.last_update >= "2008-09-25"
|