bitbake-setup: Add strip to value from settings.conf
PATCH v2 1/1 bitbake-setup: Add strip to value from settings.conf
If user add "" to dl-dir as DL_DIR, it will show FetchError as following.
raise FetchError("Unable to fetch URL from any source.", u)
bb.fetch2.FetchError: Fetcher failure for URL: 'git://git.openembedded.org/bitbake;protocol=https;rev=master;branch=master;destsuffix=bitbake'. Unable to fetch URL from any source.
But from this log, user can't locate the real reason which is that the path "/aa/bb" is invalid.
So I make this fix, even if user add "" to dl-dir, the dl-dir will be the valid path. Other settings value also need this fix.
--- bin/bitbake-setup | 6 ++++++ 1 file changed, 6 insertions(+)
bin/bitbake-setup +6 -0
@@ -869,6 +869,12 @@ def load_settings(settings_path): if os.path.exists(settings_path): logger.info('Loading settings from {}'.format(settings_path)) settings.read_file(open(settings_path)) + + for section in settings.sections(): + for key in settings[section]: + value = settings[section][key] + settings[section][key] = value.strip('"') + return settings def change_setting(top_dir, args):
Signature · 1 line
2.43.0
bin/bitbake-setup def load_settings(settings_path): · line 876
Quoted 4 lines · Yiding Liu (Fujitsu) via lists.openembedded.org
bin/bitbake-setup +4
-0+ for section in settings.sections(): + for key in settings[section]: + value = settings[section][key] + settings[section][key] = value.strip('"')
I think this is okay, but should we strip both single ' and double " quotes? Sorry I didn't realize this earlier.
Alex
Quoted 13 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Alexander Kanavin via lists.openembedded.org
Sent: den 6 februari 2026 12:47
To: [email protected]
Cc: [email protected]
Subject: Re: [bitbake-devel][PATCH v2] bitbake-setup: Add strip to value from settings.confbin/bitbake-setup def load_settings(settings_path): · line 876
Quoted 4 lines · Yiding Liu (Fujitsu) via lists.openembedded.org
bin/bitbake-setup +4
-0+ for section in settings.sections(): + for key in settings[section]: + value = settings[section][key] + settings[section][key] = value.strip('"')
Quoted 4 lines
I think this is okay, but should we strip both single ' and double " quotes? Sorry I didn't realize this earlier.
Alex
Maybe it would be better to abort if any odd characters are found in any of the settings? Because I assume the situation would be equally bad if someone somehow has ended up with a path like foo/"bar", i.e., with a quote in the middle. Aborting would allow bitbake-setup to give a meaningful error, rather than silently hiding the misconfiguration.
//Peter
Quoted 5 lines · Peter Kjellerstedt
Quoted 5 lines
Quoted 4 lines
bin/bitbake-setup +4
-0+ for section in settings.sections(): + for key in settings[section]: + value = settings[section][key] + settings[section][key] = value.strip('"')
Quoted 7 lines
Quoted 2 lines
I think this is okay, but should we strip both single ' and double " quotes? Sorry I didn't realize this earlier.
Maybe it would be better to abort if any odd characters are found in any of the settings? Because I assume the situation would be equally bad if someone somehow has ended up with a path like foo/"bar", i.e., with a quote in the middle. Aborting would allow bitbake-setup to give a meaningful error, rather than silently hiding the misconfiguration.
But on what condition would the abort happen? I'm not sure I can come up with a simple one.
Now that you say it, I'm not sure how paths with spaces in them should be handled, as those do need to be quoted or do they? This can turn out into a rabbit hole :-/
Alex
Quoted 17 lines
-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: den 6 februari 2026 14:16
To: Peter Kjellerstedt <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [bitbake-devel][PATCH v2] bitbake-setup: Add strip to value from settings.confQuoted 8 lines · Peter Kjellerstedt
Quoted 7 lines
bin/bitbake-setup def load_settings(settings_path): · line 876
Quoted 4 lines
bin/bitbake-setup +4
-0+ for section in settings.sections(): + for key in settings[section]: + value = settings[section][key] + settings[section][key] = value.strip('"')I think this is okay, but should we strip both single ' and double " quotes? Sorry I didn't realize this earlier.
Quoted 8 lines
Quoted 5 lines
Maybe it would be better to abort if any odd characters are found in any of the settings? Because I assume the situation would be equally bad if someone somehow has ended up with a path like foo/"bar", i.e., with a quote in the middle. Aborting would allow bitbake-setup to give a meaningful error, rather than silently hiding the misconfiguration.
But on what condition would the abort happen? I'm not sure I can come up with a simple one.
One way would be to start with a (small and) well defined set of characters that are supported. Then if someone has a use case that requires a character that is not supported, they would have to make a case for it, and the consequences of allowing that character too can be handled on a character by character basis. I do not know what are in those settings though, so it may be hard to define a set that works for all of them.
Quoted 5 lines
Now that you say it, I'm not sure how paths with spaces in them should be handled, as those do need to be quoted or do they? This can turn out into a rabbit hole :-/
Alex
While handling paths with spaces is of course the right thing to do, I am not sure you actually need to handle that case since OE will fail badly if you try using such paths. But maybe bitbake (and thus bitbake-setup) does handle paths with spaces correctly? I have never thought about that...
//Peter