Bug 9993

Summary: fetch: uninative loader: no error on checksum failure for file:// urls
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Patrick Ohly <patrick.ohly>
Component: devtools / tool chainAssignee: Sawas Etairidis <Falital>
Status: IN PROGRESS REVIEW --- QA Contact:
Severity: normal    
Priority: Medium CC: agnes.agonas, Falital, meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie
Version: 2.1   
Target Milestone: 6.2   
Hardware: x86   
OS: Multiple   
Whiteboard: NEWCOMER
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Patrick Ohly 2016-07-21 19:08:50 UTC
Downloading a uninative tarball which doesn't have the expected content, i.e. doesn't match the UNINATIVE_CHECKSUM, does not trigger any error. Instead, the content gets used.

To reproduce:
- check out 36feb38045b7a2af86ece147fec54b0db3bf491f (current master)
- "bitbake uninative-tarball"
- change UNINATIVE_URL in meta/conf/distro/include/yocto-uninative.inc into "file:///tmp/"
- cp tmp/deploy/sdk/x86_64-nativesdk-libc.tar.bz2 /tmp/
- rm -rf tmp downloads
- "bitbake attr-native" (fairly random example)

Against expectations, this results in downloading the file and unpacking it into tmp/sysroots-uninative. There's no error:

NOTE: Fetching uninative binary shim from file:////fast/build/poky/x86/x86_64-nativesdk-libc.tar.bz2;sha256sum=84e89ed675156d13a27fe56e8433f5fa9662802349bb0bbe9e6eba577fc140d3
Initialising tasks: 100% |############################################################################| Time: 0:00:00
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 79 tasks of which 78 didn't need to be rerun and all succeeded.
Comment 1 Richard Purdie 2016-07-21 19:23:17 UTC
This is because a file:// url is being used and we don't check checksums on file:// urls in general as its assumed the filesystem is reliable. If a checksum is specified, we probably should consider checking it though...
Comment 2 Patrick Ohly 2016-07-22 06:42:16 UTC
That explains it. I think checking a checksum if provided makes sense, because it avoids surprises and catches potential errors (like "checksum not updated"). Not terribly important, though.
Comment 3 Richard Purdie 2025-12-11 16:27:54 UTC
We should make the fetcher error if checksums are specified and they don't match.
Comment 4 Ágnes Agonás 2026-01-29 06:42:26 UTC
bitbake version: cdd79c1768ac396a9c6577e38098da4331507f24 on master

Environment set up with: https://docs.yoctoproject.org/bitbake/dev/bitbake-user-manual/bitbake-user-manual-environment-setup.html

Was not able to reproduce the original issue:

1. Executed bitbake uninative-tarball
2. Copied the file x86_64-nativesdk-libc-5.0.tar.xz to /tmp
3. In openembedded-core/meta/conf/distro/include/yocto-uninative.inc:
set the UNINATIVE_CHECKSUM[x86_64] to "0000000000000000000000000000000000000000000000000000000000000000"
4. Set the UNINATIVE_URL to "file:///tmp/"
5. Deleted the tmp and cache folders.

6. After executing bitbake attr-native

NOTE: Fetching uninative binary shim file:///tmp/x86_64-nativesdk-libc-5.0.tar.xz;sha256sum=0000000000000000000000000000000000000000000000000000000000000000 (will check PREMIRRORS first)
WARNING: Failed to fetch URL file:///tmp/x86_64-nativesdk-libc-5.0.tar.xz;sha256sum=0000000000000000000000000000000000000000000000000000000000000000, attempting MIRRORS if available
ERROR: Fetcher failure: Unable to find file file:///tmp/x86_64-nativesdk-libc-5.0.tar.xz;sha256sum=0000000000000000000000000000000000000000000000000000000000000000 anywhere to download to /tmp/x86_64-nativesdk-libc-5.0.tar.xz. The paths that were searched were:

WARNING: Disabling uninative as unable to fetch uninative tarball: Fetcher failure for URL: 'file:///tmp/x86_64-nativesdk-libc-5.0.tar.xz;sha256sum=0000000000000000000000000000000000000000000000000000000000000000'. Unable to fetch URL from any source.
WARNING: To build your own uninative loader, please bitbake uninative-tarball and set UNINATIVE_TARBALL appropriately.

7. Then I completely deleted the UNINATIVE_CHECKSUM[x86_64], and got the following:

ERROR: Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[x86_64]

8. Then I added the original line back UNINATIVE_CHECKSUM[x86_64] ?= "96045e8b1e242c8a849426a8506c7043f354b39f2bc0035192780e8205e23e9d"

The build finished without error.
Comment 5 Randy MacLeod 2026-05-28 15:11:57 UTC
This patch on the list is good but not quite done:

https://lore.kernel.org/bitbake-devel/20260430-b4-yocto-9993-v1-1-a54d842cd0fd@gmail.com/
Comment 6 Aditya G S 2026-06-10 05:54:02 UTC
I would like to work on this bug.
Comment 7 Aditya G S 2026-07-23 07:38:06 UTC
Hi,

I would like to provide an update on this issue.
I was able to reproduce the behavior locally using a small test recipe with a file:// URL and an intentionally incorrect checksum to verify the current fetcher behavior.

However, I am currently occupied with other higher-priority work and will not be able to dedicate the time required to investigate and complete this issue properly.

As a result, I will be unassigning myself from this bug so that it can be picked up by someone else if needed.

For reference, Comment #5 points to an existing patch on the mailing list which was described as "good but not quite done" and may provide a useful starting point for future work on this issue.

Thanks,
Aditya
Comment 8 Sawas Etairidis 2026-09-23 19:30:22 UTC
Hi,

I will start working on this, I will fix the issues in https://lore.kernel.org/bitbake-devel/20260430-b4-yocto-9993-v1-1-a54d842cd0fd@gmail.com/ and add Jhonata Poma-Hansen as the Co-Author

Regards,
Savvas