[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ba9ec5eb-8078-4780-a2bd-db53c12f437d@redhat.com>
Date: Wed, 11 Jun 2025 15:21:26 -0400
From: Joe Lawrence <joe.lawrence@...hat.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>, Miroslav Benes <mbenes@...e.cz>,
live-patching@...r.kernel.org, Song Liu <song@...nel.org>,
laokz <laokz@...mail.com>, Jiri Kosina <jikos@...nel.org>,
Marcos Paulo de Souza <mpdesouza@...e.com>, Weinan Liu <wnliu@...gle.com>,
Fazla Mehrab <a.mehrab@...edance.com>,
Chen Zhongjin <chenzhongjin@...wei.com>, Puranjay Mohan <puranjay@...nel.org>
Subject: Re: [PATCH v2 59/62] livepatch/klp-build: Introduce klp-build script
for generating livepatch modules
On 6/11/25 3:08 PM, Josh Poimboeuf wrote:
> On Wed, Jun 11, 2025 at 02:44:35PM -0400, Joe Lawrence wrote:
>>> +get_patch_files() {
>>> + local patch="$1"
>>> +
>>> + grep0 -E '^(--- |\+\+\+ )' "$patch" \
>>> + | gawk '{print $2}' \
>> If we split the rest of this line on the tab character and print the
>> first part of $2:
>>
>> gawk '{ split($2, a, "\t"); print a[1] }'
>>
>> then it can additionally handle patches generated by `diff -Nupr` with a
>> timepstamp ("--- <filepath>\t<timestamp>").
> Hm? The default gawk behavior is to treat both tabs and groups of
> spaces as field separators:
>
> https://www.gnu.org/software/gawk/manual/html_node/Default-Field-
> Splitting.html
>
> And it works for me:
>
> $ diff -Nupr /tmp/meminfo.c fs/proc/meminfo.c > /tmp/a.patch
> $ grep -E '^(--- |\+\+\+ )' /tmp/a.patch | gawk '{print $2}'
> /tmp/meminfo.c
> fs/proc/meminfo.c
>
> Or did I miss something?
Ah hah, I fixed up the code in refresh_patch() with that double gawk,
and then noticed it could have just called get_patch_files() instead.
So yeah, you're right, the simple gawk '{print $2}' handles both cases
already :)
--
Joe
Powered by blists - more mailing lists