From: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
To: Paul Barker <paul@pbarker.dev>, openembedded-core@lists.openembedded.org
Cc: Randy.MacLeod@windriver.com, Sundeep.Kokkonda@windriver.com
Subject: Re: [OE-core] [PATCH] sanity.bbclass: warn on .cargo/config.toml outside the build tree
Date: Thu, 25 Jun 2026 12:31:12 +0530 [thread overview]
Message-ID: <17171ab1-eafa-4303-bc3d-8a4c99ecb79c@windriver.com> (raw)
In-Reply-To: <f9be9a387e024dc86312a45e2a4b029e5cbf2ec2.camel@pbarker.dev>
On 24-06-2026 01:11 pm, Paul Barker wrote:
> On Tue, 2026-06-23 at 23:42 -0700, Hemanth Kumar M D via
> lists.openembedded.org wrote:
>> From: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
>>
>> Cargo walks from CWD up to the filesystem root merging every
>> .cargo/config.toml it finds. Any such file above TOPDIR is silently
>> picked up and can override Yocto's linker, registry or compiler
>> settings, leading to build failures.
>>
>> Until cargo provides a proper fix upstream, add a warning so users
>> get a clear diagnostic instead of a build error.
>>
>> Upstream meta-issue: https://github.com/rust-lang/cargo/issues/9769
>>
>> [YOCTO #15637]
>>
>> Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
>> ---
>> meta/classes-global/sanity.bbclass | 33 ++++++++++++++++++++++++++++++
>> 1 file changed, 33 insertions(+)
>>
>> diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
>> index bdfa7f059d..c67c7b8f03 100644
>> --- a/meta/classes-global/sanity.bbclass
>> +++ b/meta/classes-global/sanity.bbclass
>> @@ -854,6 +854,38 @@ def sanity_check_locale(d):
>> except locale.Error:
>> raise_sanity_error("Your system needs to support the en_US.UTF-8 locale.", d)
>>
>> +def check_cargo_config(d):
>> + # Cargo merges .cargo/config.toml from every directory between CWD and
>> + # the filesystem root. Warn for anything found in ancestor directories
>> + # above TOPDIR that Cargo would pick up silently.
>> + import os
>> +
>> + topdir = d.getVar('TOPDIR')
Hi Paul,
Thanks for the review!
please find the v2 -
https://lists.openembedded.org/g/openembedded-core/topic/patch_v2_sanity_bbclass/119970000
> TMPDIR and each package's WORKDIR are under TOPDIR by default, but this
> can be overridden. Perhaps we should be checking ancestors of
> BASE_WORKDIR instead.
Agreed, updated to use BASE_WORKDIR in v2.
>> + ancestor = os.path.dirname(topdir)
>> + found = []
>> + last_ancestor = None
>> + while True:
>> + for name in ('config.toml', 'config'):
>> + cfg = os.path.join(ancestor, '.cargo', name)
>> + if os.path.exists(cfg):
>> + found.append(cfg)
>> + last_ancestor = ancestor
>> + break
> This `break` should be dropped so that we tell the user about all
> offending Cargo config files.
Keeping the `break` ,
Cargo docs say if both 'config' and 'config.toml'
exist in the same directory, only 'config' is read. So only one file per
directory is ever active. I've also fixed the probe order to check
'config'
before 'config.toml' to match this.
Ref: https://doc.rust-lang.org/cargo/reference/config.html
> The rest of this patch LGTM, thanks!
>
> Best regards,
>
--
Regards,
Hemanth Kumar M D
prev parent reply other threads:[~2026-06-25 7:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 6:42 [PATCH] sanity.bbclass: warn on .cargo/config.toml outside the build tree Hemanth.KumarMD
2026-06-24 7:41 ` [OE-core] " Paul Barker
2026-06-25 7:01 ` Hemanth Kumar M D [this message]
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=17171ab1-eafa-4303-bc3d-8a4c99ecb79c@windriver.com \
--to=hemanth.kumarmd@windriver.com \
--cc=Randy.MacLeod@windriver.com \
--cc=Sundeep.Kokkonda@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul@pbarker.dev \
/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.