The assert looks like a "you should never get here" condition.
It tries to figure out which filename should be used for the output.
At the point of the assert (or assume) it assumes "at this point it
should be clear which filename to use".
This fails because we try to revert the patch but the file to apply it
to is not found. So there is nothing to revert to. In this case it is
fine to ignore the hunk.
My patch look very similar. I removed the assert because if it is part
of the if condition the assert condition can never be false.
I used a smaller file to reproduce it:
$ cat test.patch | patch -d . -R -E --dry-run -p2
missing header for unified diff at line 4 of patch
patch_: pch.c:622: intuit_diff_type: Assertion `i0 != NONE' failed.
Aborted (core dumped)
with the patch (see attachment reverse_bug.patch) it says:
missing header for unified diff at line 4 of patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nur test1/foo test2/foo
|--- test1/foo 1970-01-01 10:00:00.000000000 +1000
|+++ test2/foo 2007-08-27 20:54:30.000000000 +1000
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
Eddy
diff -Nur patch-2.5.9.orig/pch.c patch-2.5.9/pch.c
--- patch-2.5.9.orig/pch.c 2007-08-26 17:56:57.000000000 +1000
+++ patch-2.5.9/pch.c 2007-08-29 07:23:16.000000000 +1000
@@ -617,9 +617,8 @@
}
is_empty = i == NONE || st[i].st_size == 0;
- if ((! is_empty) < p_says_nonexistent[reverse ^ is_empty])
+ if (((! is_empty) < p_says_nonexistent[reverse ^ is_empty]) && (i0 != NONE))
{
- assert (i0 != NONE);
reverse ^=
ok_to_reverse
("The next patch%s would %s the file %s,\nwhich %s!",
diff -Nur test1/foo test2/foo
--- test1/foo 1970-01-01 10:00:00.000000000 +1000
+++ test2/foo 2007-08-27 20:54:30.000000000 +1000
@@ -0,0 +1 @@
+foo