Re: [PATCH] checksum: only split file-checksums entries at right-most colon

Richard Purdie <[email protected]>
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <6163fabfba1e616cdd3ef01d79ef47d81b198553.camel@linuxfoundation.org>
On Wed, 2026-05-13 at 12:55 +0200, Rasmus Villemoes wrote:
> While paths generally do not contain :, it is not forbidden. Even when
> ordinary files do not contain : anywhere in the path, there is a
> real-world example where the current code ends up emitting a false
> warning:
> 
> meta-rauc's bundle.bbclass [*] expects the user to set RAUC_KEY_FILE
> and RAUC_CERT_FILE to point at the key/certificate used for signing a
> RAUC bundle. Since those files are not in SRC_URI but are used
> directly in the do_bundle task, they set
> 
> do_bundle[file-checksums] += "${RAUC_CERT_FILE}:False ${RAUC_KEY_FILE}:False"
> 
> The :False is because they also allow these variables to be pkcs#11
> uris. However, in that case, it will be something like
> 
>   RAUC_KEY_FILE = "pkcs11:object=some-id"
> 
> and the file-checksums entry ends up being
> "pkcs11:object=some-id:False". So the python code ends up seeing
> "object=some-id" as the [1] entry in the split and "pkcs11" as the [0]
> entry, and the whole thing ends up doing
> 
> WARNING: Unable to get checksum for system-bundle SRC_URI entry pkcs11: [Errno 2] No such file or directory: 'pkcs11'
> 
> The code really just wants the right-most, colon-delimited field, with
> anything before being the path. So change to use .rsplit(":", 1)
> instead. This should make no functional change for items that contain
> exactly one :, and matches the change done in a70a7376a ("cache:
> correctly handle file names containing colons").
> 
> [*] https://github.com/rauc/meta-rauc/blob/master/classes-recipe/bundle.bbclass
> 
> Signed-off-by: Rasmus Villemoes <[email protected]>
> ---
> 
> Note: I'm not really sure meta-rauc's use of [file-checksums] in this
> way is correct; it seems that the flag should reflect whether the file
> actually exists, not whether it is guaranteed to exist. But
> regardless, this patch should be correct.

Your patch is probably fine but meta-rauc is not using those correctly,
I suspect it simply won't work or do what they're expecting and the
code is actually pointless in the current form.

Cheers,

Richard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.