Skip to content

data: Escape back quotes in environment

Mathieu Dubois-Briand bitbake-devel 1 version In review

Get series with b4
b4 am 20251114-mathieu-back_quote_devshell-v1-0-45e83df2f362@bootlin.com change-id 20251114-mathieu-back_quote_devshell-b1b19d3c4042

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2data: Escape back quotes in environmentlib/bb/data.py+1 -00 replies
2/2tests: data: Add tests on emitting environment variableslib/bb/tests/data.py+105 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] data: Escape back quotes in environment

Fixing devshell when some environment variables contain a back quote. On my side I had this issue using kitty terminal emulator, which sets the KITTY_PUBLIC_KEY environment variable [1]:
KITTY_PUBLIC_KEY=1:`TB}~6^vgiFD2v6d}JRgt!X|qx#0~mO?&N=A1jfi

Trying to use devshell failed silently, but the parse error is visible while launching the do_terminal script by hand:

tmp/work/qemux86_64-poky-linux/linux-yocto/6.16.11+git/temp/run.do_terminal.2972397: line 120: unexpected EOF while looking for matching ``'
WARNING: tmp/work/qemux86_64-poky-linux/linux-yocto/6.16.11+git/temp/run.do_terminal.2972397:119 exit 2 from 'export KITTY_PID="1985830"'
WARNING: Backtrace (BB generated script):

	#1: main, tmp/work/qemux86_64-poky-linux/linux-yocto/6.16.11+git/temp/run.do_terminal.2972397, line 119

Escaping back quotes allows to launch the devshell correctly.

Also adding a non-regression test. The whole bb.data.emit_var() function was not tested, I'm not sure if it was by choice or not, but I added some.

I tested the most basic code paths of bb.data.emit_var() but I'm not fully exhaustive. Notably, the return value remains untested as I was not able to figure out what it means and it appears to be unused.

[1]: https://sw.kovidgoyal.net/kitty/glossary/#envvar-KITTY_PUBLIC_KEY

---
Mathieu Dubois-Briand (2):
data: Escape back quotes in environment
tests: data: Add tests on emitting environment variables

 lib/bb/data.py       |   1 +
 lib/bb/tests/data.py | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)

---
base-commit: ce90d59ff1c96d04856ca5e41a963af00d1783f1
change-id: 20251114-mathieu-back_quote_devshell-b1b19d3c4042

Best regards,

Signature · 1 line
Mathieu Dubois-Briand <[email protected]>