Skip to contentSkip to conversation

terminal.bbclass: do not export PS1

PATCH In review Anders Darander 2 participants 3 messages Jan 10, 2014

lore
Share & tools
lore
#0 lore raw

cover terminal.bbclass: do not export PS1

terminal.bbclass: do not export PS1

With a complex PS1 setup, PS1 might not have all characters correctly escaped when terminal.bbclass writes the export. This caused the run.do_terminal.PID to terminate, making it impossible to use the devshell.

As the spawned shell will parse e.g. .bashrc (or whatever rc-file is being used), PS1 will be reset in the devshell.
The following changes since commit 1028ac813fa9803ebfff6bcfa7f8b67012609b27:

sstate: add do_package to the noexec list in setscene_depvalid (2014-01-07 13:58:28 +0000)

are available in the git repository at:

git://github.com/darander/oe-core terminal.bbclass
https://github.com/darander/oe-core/tree/terminal.bbclass

Anders Darander (1):
terminal.bbclass: do not export PS1

 meta/classes/terminal.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 1/1 terminal.bbclass: do not export PS1

With a complex PS1 setup, PS1 might not have all characters correctly escaped when terminal.bbclass writes the export. This caused the run.do_terminal.PID to terminate, making it impossible to use the devshell.

As the spawned shell will parse e.g. .bashrc (or whatever rc-file is being used), PS1 will be reset in the devshell.

---
 meta/classes/terminal.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes/terminal.bbclass +4 -0
index 774f055..e577c6d 100644
@@ -64,6 +64,10 @@ def oe_terminal(command, title, d):
             envdata.setVar(key, str(value))
             envdata.setVarFlag(key, 'export', 1)
 
+    # A complex PS1 might need more escaping of chars.
+    # Lets not export PS1 instead.
+    envdata.delVar("PS1")
+
     # Replace command with an executable wrapper script
     command = emit_terminal_func(command, envdata, d)
 
Signature · 1 line
1.8.5.2
#2 lore raw
Quoted 2 lines · Anders Darander

With a complex PS1 setup, PS1 might not have all characters correctly escaped

I think, this must be solved in other layers (bitbake?). Using 'pipes.quote()' seems to be a proper way to escape things correctly.

Enrico