From: Josh Boyer <jwboyer@kernel.org>
To: emil.l.velikov@gmail.com
Cc: linux-firmware@kernel.org, Adam Sampson <ats@offog.org>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH RESEND v2 06/16] check_whence: error on duplicate file entries
Date: Tue, 7 Mar 2023 13:12:20 -0500 [thread overview]
Message-ID: <CA+5PVA45_jQYsjGPQ_HkGOd1dYYQ1aCKu_-nfyz38NRq-PF4gQ@mail.gmail.com> (raw)
In-Reply-To: <20230301-fixes-and-compression-v2-6-e2b71974e842@gmail.com>
On Wed, Mar 1, 2023 at 1:56 PM Emil Velikov via B4 Relay
<devnull+emil.l.velikov.gmail.com@kernel.org> wrote:
>
> From: Emil Velikov <emil.l.velikov@gmail.com>
>
> There's little point in copying (or compressing with later patches) the
> same files multiple times. So let's error out when duplicate entries are
> present.
I like this idea, but see my reply to patch 5. There are cases where
the same firmware file *should* be duplicated because the driver using
it is different. That would imply this would need to build out a
dictionary that can map files to drivers. That seems over-complicated
for the fundamental goal of this check.
> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
> ---
> check_whence.py | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/check_whence.py b/check_whence.py
> index f347f0e..7ff21f6 100755
> --- a/check_whence.py
> +++ b/check_whence.py
> @@ -24,6 +24,14 @@ def list_whence():
> yield match.group(2)
> continue
>
> +def list_whence_files():
> + with open('WHENCE', encoding='utf-8') as whence:
> + for line in whence:
> + match = re.match(r'File:\s*(.*)', line)
> + if match:
> + yield match.group(1).replace("\ ", " ")
> + continue
> +
> def list_git():
> with os.popen('git ls-files') as git_files:
> for line in git_files:
> @@ -32,12 +40,17 @@ def list_git():
> def main():
> ret = 0
> whence_list = list(list_whence())
> + whence_files = list(list_whence_files())
> known_files = set(name for name in whence_list if not name.endswith('/')) | \
> set(['check_whence.py', 'configure', 'Makefile',
> 'README', 'copy-firmware.sh', 'WHENCE'])
> known_prefixes = set(name for name in whence_list if name.endswith('/'))
> git_files = set(list_git())
>
> + for name in set(fw for fw in whence_files if whence_files.count(fw) > 1):
> + sys.stderr.write('E: %s listed in WHENCE twice\n' % name)
> + ret = 1
> +
Perhaps we can add this check via a cmdline option that is run
occasionally to look for duplicates? Then you could still keep
simpler code for anything that's operating on the files themselves.
josh
> for name in sorted(list(known_files - git_files)):
> sys.stderr.write('E: %s listed in WHENCE does not exist\n' % name)
> ret = 1
>
> --
> 2.39.2
>
next prev parent reply other threads:[~2023-03-07 18:12 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-01 18:56 [PATCH RESEND v2 00/16] Misc fixes, sanity checks and xz/zstd compression Emil Velikov via B4 Relay
2023-03-01 18:56 ` [PATCH RESEND v2 01/16] WHENCE: remove trailing white space Emil Velikov via B4 Relay
2023-03-07 14:53 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 02/16] WHENCE: remove unnecessary filename quotation Emil Velikov via B4 Relay
2023-03-07 14:56 ` Josh Boyer
2023-03-07 17:53 ` Emil Velikov
2023-03-07 18:01 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 03/16] check_whence, WHENCE, copy-firmware: escape filenames with spaces Emil Velikov via B4 Relay
2023-03-07 14:58 ` Josh Boyer
2023-03-07 17:30 ` Emil Velikov
2023-03-07 18:00 ` Josh Boyer
2023-03-07 20:48 ` Emil Velikov
2023-03-01 18:56 ` [PATCH RESEND v2 04/16] WHENCE: remove duplicate File entries Emil Velikov via B4 Relay
2023-03-07 15:01 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 05/16] WHENCE: comment out duplicate MediaTek firmware Emil Velikov via B4 Relay
2023-03-07 15:02 ` Josh Boyer
2023-03-07 17:19 ` Emil Velikov
2023-03-07 18:08 ` Josh Boyer
2023-03-07 20:57 ` Emil Velikov
2023-03-10 12:42 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 06/16] check_whence: error on duplicate file entries Emil Velikov via B4 Relay
2023-03-07 18:12 ` Josh Boyer [this message]
2023-03-01 18:56 ` [PATCH RESEND v2 07/16] check_whence: error on directory listed as File Emil Velikov via B4 Relay
2023-03-13 20:24 ` Emil Velikov
2023-03-21 10:31 ` Emil Velikov
2023-03-29 14:47 ` Emil Velikov
2023-03-01 18:56 ` [PATCH RESEND v2 08/16] copy-firmware: remove non-applicable file presence test Emil Velikov via B4 Relay
2023-05-08 12:39 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 09/16] check_whence: error if File: is actually a link Emil Velikov via B4 Relay
2023-05-08 12:41 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 10/16] check_whence: error if symlinks are in-tree Emil Velikov via B4 Relay
2023-05-08 12:45 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 11/16] copy-firmware: remove unreachable symlink workarounds Emil Velikov via B4 Relay
2023-03-01 18:56 ` [PATCH RESEND v2 12/16] copy-firmware: quote deskdir to prevent word splitting Emil Velikov via B4 Relay
2023-05-08 12:47 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 13/16] copy-firmware: tweak sed invocation Emil Velikov via B4 Relay
2023-05-08 12:48 ` Josh Boyer
2023-03-01 18:56 ` [PATCH RESEND v2 14/16] copy-firmware: quote the output of dirname Emil Velikov via B4 Relay
2023-03-01 18:56 ` [PATCH RESEND v2 15/16] copy-firmware: silence the last shellcheck warnings Emil Velikov via B4 Relay
2023-03-01 18:56 ` [PATCH RESEND v2 16/16] Makefile, copy-firmware: support xz/zstd compressed firmware Emil Velikov via B4 Relay
2023-03-06 14:23 ` Emil Velikov
2023-05-08 12:51 ` [PATCH RESEND v2 00/16] Misc fixes, sanity checks and xz/zstd compression Josh Boyer
2023-05-20 11:05 ` Emil Velikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+5PVA45_jQYsjGPQ_HkGOd1dYYQ1aCKu_-nfyz38NRq-PF4gQ@mail.gmail.com \
--to=jwboyer@kernel.org \
--cc=ats@offog.org \
--cc=dwmw2@infradead.org \
--cc=emil.l.velikov@gmail.com \
--cc=linux-firmware@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).