Re: [bitbake-devel] [PATCH] parse: warn on trailing whitespace after line continuation backslash
Jaipaul Cheernam <[email protected]>
| Newsgroups | org.openembedded.lists.bitbake-devel |
|---|---|
| Message-ID | <[email protected]> |
On 2026-08-04 13:37, Richard Purdie wrote: > On Tue, 2026-08-04 at 12:37 +0200, Jaipaul Cheernam wrote: >> Hi Richard, >> >> Fair point — it doesn't break parsing itself and the code churn is >> larger than ideal for a warning. >> >> Would you prefer if I just submitted the oe-core fixes to clean up >> the affected recipes instead and dropped this bitbake change? That >> solves the immediate problem without adding complexity to the parser. > You should definitely send that clean up for oe-core. Hi Richard, Thanks for the detailed feedback. I will send a clean-up patch. > I was toying with the idea we just make whitespace after a line break > character a fatal parsing error. Most of the fatal errors are inside > feeder() rather than where you changed the code. That would be the cleanest long-term. A fatal error for whitespace after \ makes sense since the backslash must be the last character — anything after it is always wrong. > I then looked at the code further and it isn't just trailing whitespace > after "\" that is an issue. For example, after "}" closing a function > could also be an issue in the same way. I didn't look in detail beyond > that, there will be further similar issues though and that does mean > your patch is incomplete :/. Good point, I hadn't considered that. >> Alternatively, I could reduce this to a bb.note() (debug-level) so >> it's only visible with -v, keeping it minimal. > I think this needs further thought and some wider testing of how > widespread trailing whitespace is. > > We might just want to make any trailing spaces a warning since we > currently just swallow and hide it unconditionally? I tried this — warned on any trailing whitespace in all parsed lines (comparing raw line minus newline against rstrip'd version). Running core-image-minimal: - 1665 total warnings (due to repeated re-parse of same files) - 59 unique (distinct file:line) - 31 files affected (.bbclass, .bb, .inc, .conf) Most are in bbclass files like sanity.bbclass, buildstats.bbclass, useradd.bbclass, kernel-yocto.bbclass, libc-package.bbclass etc. The duplication from re-parsing makes it noisy without some form of dedup. A few options for v2: 1. Keep it narrow — only warn after \ and } (the cases that actually cause patch conflicts). Around 10 unique warnings. 2. Warn on everything but with dedup (a module-level set). Cleaner output but adds state to the parser. 3. Warn on everything and send a cleanup series fixing all 59 instances in oe-core. Then the warning stays as a guard for future submissions. What would you prefer? Thanks, Jaipaul > > Cheers, > > Richard >