Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] Make "set -x" in postinst scripts not break rootfs
@ 2015-05-21 20:36 Peter Seebach
  2015-05-21 20:36 ` [PATCH 1/1] rootfs.py: Make set -x not break rootfs creation Peter Seebach
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Seebach @ 2015-05-21 20:36 UTC (permalink / raw)
  To: openembedded-core

I was trying to debug a postinstall script, so I added set -x, so rootfs
creation broke. The issue is that set -x caused lines of code to be emitted
in a place where the log file checker saw them. It's totally okay for
a postinstall script to exit 1; that moves it into etc/rpm-postinsts, and
then it runs on the target.

So it shouldn't prevent rootfs creation from "succeeding". Solution: Don't
process lines preceeded by a "+", because that's probably set -x output.

The following changes since commit fe7780a9bbbfa4dcbbe457618a0842e91a3c6a0e:

  libxdmcp: make libbsd usage deterministic (2015-05-21 10:48:41 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib seebs/setminusx
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/setminusx

Peter Seebach (1):
  rootfs.py: Make set -x not break rootfs creation

 meta/lib/oe/rootfs.py | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.3.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] rootfs.py: Make set -x not break rootfs creation
  2015-05-21 20:36 [PATCH 0/1] Make "set -x" in postinst scripts not break rootfs Peter Seebach
@ 2015-05-21 20:36 ` Peter Seebach
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Seebach @ 2015-05-21 20:36 UTC (permalink / raw)
  To: openembedded-core

The rootfs logfile check errors out if it finds an "exit 1" in
a log. But consider the shell idiom:
	if ! $command; then exit 1; fi
and consider a postinstall script with a "set -x" for debugging
purposes (to get log output in /var/log/postinstall.log.)

Solution: Ignore lines prefixed with a +, because those show shell
code even if a specific fragment won't be executed.

Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
---
 meta/lib/oe/rootfs.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 6fb749f..5d27d2f 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -401,6 +401,9 @@ class RpmRootfs(Rootfs):
             for line in log.read().split('\n'):
                 if 'log_check' in line:
                     continue
+                # sh -x may emit code which isn't actually executed
+                if line.startswith('+'):
+		    continue
 
                 m = r.search(line)
                 if m:
-- 
2.3.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-21 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-21 20:36 [PATCH 0/1] Make "set -x" in postinst scripts not break rootfs Peter Seebach
2015-05-21 20:36 ` [PATCH 1/1] rootfs.py: Make set -x not break rootfs creation Peter Seebach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox