All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: linux-firmware@kernel.org
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Subject: [PATCH v2 13/16] copy-firmware.sh: call ./check_whence.py before parsing the file
Date: Mon, 23 Sep 2024 14:09:41 +0100	[thread overview]
Message-ID: <20240923-misc-fixes-v2-13-397f23443628@gmail.com> (raw)
In-Reply-To: <20240923-misc-fixes-v2-0-397f23443628@gmail.com>

Currently ./check_whence.py is used when submitting new firmware, while
copy-firmware.sh when the firmware is to be consumed.

Since the latter does (very little) validation, having a malformed WHENCE file
can lead to all sorted of problems. From the obvious, where it errors out, to
more serious one where it overwrites or executes something it should not have.

Just call check_whence.py and error out. It takes 0.2s on my 5 year old
mid-range laptop, so the overhead is negligible.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 copy-firmware.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/copy-firmware.sh b/copy-firmware.sh
index 12b97ae32f953c96a1c7612ccd14b1991a8687bf..12322530e5e155f77829f0d070d173ab5bfbab5b 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -71,6 +71,9 @@ if test -d "$destdir"; then
     find "$destdir" -type d -empty >/dev/null || warn "destination folder is not empty."
 fi
 
+$verbose "Checking that WHENCE file is formatted properly"
+./check_whence.py || err "check_whence.py has detected errors."
+
 # shellcheck disable=SC2162 # file/folder name can include escaped symbols
 grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
     test -f "$f" || continue

-- 
2.46.1


WARNING: multiple messages have this Message-ID (diff)
From: Emil Velikov via B4 Relay <devnull+emil.l.velikov.gmail.com@kernel.org>
To: linux-firmware@kernel.org
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Subject: [PATCH v2 13/16] copy-firmware.sh: call ./check_whence.py before parsing the file
Date: Mon, 23 Sep 2024 14:09:41 +0100	[thread overview]
Message-ID: <20240923-misc-fixes-v2-13-397f23443628@gmail.com> (raw)
In-Reply-To: <20240923-misc-fixes-v2-0-397f23443628@gmail.com>

From: Emil Velikov <emil.l.velikov@gmail.com>

Currently ./check_whence.py is used when submitting new firmware, while
copy-firmware.sh when the firmware is to be consumed.

Since the latter does (very little) validation, having a malformed WHENCE file
can lead to all sorted of problems. From the obvious, where it errors out, to
more serious one where it overwrites or executes something it should not have.

Just call check_whence.py and error out. It takes 0.2s on my 5 year old
mid-range laptop, so the overhead is negligible.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 copy-firmware.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/copy-firmware.sh b/copy-firmware.sh
index 12b97ae32f953c96a1c7612ccd14b1991a8687bf..12322530e5e155f77829f0d070d173ab5bfbab5b 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -71,6 +71,9 @@ if test -d "$destdir"; then
     find "$destdir" -type d -empty >/dev/null || warn "destination folder is not empty."
 fi
 
+$verbose "Checking that WHENCE file is formatted properly"
+./check_whence.py || err "check_whence.py has detected errors."
+
 # shellcheck disable=SC2162 # file/folder name can include escaped symbols
 grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
     test -f "$f" || continue

-- 
2.46.1



  parent reply	other threads:[~2024-09-23 13:09 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 13:09 [PATCH v2 00/16] Range of copy-firmware/check_whence fixes Emil Velikov
2024-09-23 13:09 ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 01/16] check_whence.py: use consistent naming Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 02/16] check_whence.py: ban link-to-a-link Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 03/16] check_whence.py: LC_ALL=C sort -u the filelist Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 04/16] check_whence.py: annotate replacement strings as raw Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 05/16] editorconfig: add initial config file Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 06/16] Style update yaml files Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 07/16] copy-firmware.sh: flesh out and fix dedup-firmware.sh Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 08/16] Revert "copy-firmware: Support additional compressor options" Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 09/16] copy-firmware.sh: reset and consistently handle destdir Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 10/16] copy-firmware.sh: fix indentation Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 11/16] copy-firmware.sh: add err() helper Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 12/16] copy-firmware.sh: warn if the destination folder is not empty Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` Emil Velikov [this message]
2024-09-23 13:09   ` [PATCH v2 13/16] copy-firmware.sh: call ./check_whence.py before parsing the file Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 14/16] copy-firmware.sh: remove no longer reachable test -f Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 15/16] copy-firmware.sh: remove no longer reachable test -L Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-09-23 13:09 ` [PATCH v2 16/16] copy-firmware.sh: rename variables in symlink hanlding Emil Velikov
2024-09-23 13:09   ` Emil Velikov via B4 Relay
2024-10-10  3:25 ` [PATCH v2 00/16] Range of copy-firmware/check_whence fixes Mario Limonciello

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=20240923-misc-fixes-v2-13-397f23443628@gmail.com \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.