On Fri, Jan 30, 2026 at 12:59:48PM -0500, Joe Lawrence wrote:
> Consider a patch offset by a line:
>
> $ cat combined.patch
> --- src.orig/fs/proc/cmdline.c 2022-10-24 15:41:08.858760066 -0400
> +++ src/fs/proc/cmdline.c 2022-10-24 15:41:11.698715352 -0400
> @@ -6,8 +6,7 @@
>
> static int cmdline_proc_show(struct seq_file *m, void *v)
> {
> - seq_puts(m, saved_command_line);
> - seq_putc(m, '\n');
> + seq_printf(m, "%s livepatch=1\n", saved_command_line);
> return 0;
> }
>
> --- a/fs/proc/version.c
> +++ b/fs/proc/version.c
> @@ -9,6 +9,7 @@
>
> static int version_proc_show(struct seq_file *m, void *v)
> {
> + seq_printf(m, "livepatch ");
> seq_printf(m, linux_proc_banner,
> utsname()->sysname,
> utsname()->release,
>
> GNU patch reports the offset:
>
> $ patch --dry-run -p1 < combined.patch
> checking file fs/proc/cmdline.c
> Hunk #1 succeeded at 7 (offset 1 line).
> checking file fs/proc/version.c
>
> It would pass the initial check as per validate_patches():
>
> $ git apply --check < combined.patch && echo "ok"
> ok
>
> But later fail the patch application by refresh_patch():
>
> $ git apply --check --recount < combined.patch
> error: patch failed: fs/proc/cmdline.c:6
> error: fs/proc/cmdline.c: patch does not apply
Hm, isn't the whole point of --recount that it ignores the line numbers?
Or does it just ignore the numbers after the commas (the counts)?
--
Josh