base.bbclass: Replace os.system with subprocess call.
PATCH 1/1 base.bbclass: Replace os.system with subprocess call.
Often gzip is reporting broken pipe errors with do_unpack of tar.gz files.
If you use the commands described above to extract a tar.gz file, gzip sometimes emits a Broken pipe error message. This can safely be ignored if tar extracted all files without any other error message.
We do not let python install its SIGPIPE handler and use subprocess call to invoke the command.
This is based on the following python bug report.
http://bugs.python.org/issue1652
--- classes/base.bbclass | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
classes/base.bbclass +7 -2
@@ -728,9 +728,14 @@ base_do_buildall() { : } +def subprocess_setup(): + import signal, subprocess + # Python installs a SIGPIPE handler by default. This is usually not what + # non-Python subprocesses expect. + signal.signal(signal.SIGPIPE, signal.SIG_DFL) def oe_unpack_file(file, data, url = None): - import bb, os + import bb, os, signal, subprocess if not url: url = "file://%s" % file dots = file.split(".")
@@ -799,7 +804,7 @@ def oe_unpack_file(file, data, url = None): cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) bb.note("Unpacking %s to %s/" % (base_path_out(file, data), base_path_out(os.getcwd(), data))) - ret = os.system(cmd) + ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) os.chdir(save_cwd)
Signature · 1 line
1.6.3.3
Quoted 2 lines · On Monday 24 August 2009 04:31:41 Khem Raj wrote:
This is based on the following python bug report.
http://bugs.python.org/issue1652
What about giving credit to the guy on irc that:
- Pointed you to the gzip faq
- The launchpad ticket
- The blogpost
- And the above URL?
z.
Quoted 6 lines · Holger Hans Peter Freyther
Quoted 2 lines · On Monday 24 August 2009 04:31:41 Khem Raj wrote:
This is based on the following python bug report.
http://bugs.python.org/issue1652What about giving credit to the guy on irc that:
indeed. I should edit the git emails before sending them out.
Quoted 4 lines
- Pointed you to the gzip faq
- The launchpad ticket
- The blogpost
- And the above URL?
All of above Zecke's courtesy :) I can put this in git log too before pushing.
Quoted 8 lines
z.
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Quoted 7 lines · On Monday 24 August 2009 04:31:41 Khem Raj wrote:
Often gzip is reporting broken pipe errors with
do_unpackof tar.gz files.If you use the commands described above to extract a tar.gz file, gzip sometimes emits a Broken pipe error message. This can safely be ignored if tar extracted all files without any other error message.
Quoted 7 lines
We do not let python install its SIGPIPE handler and use subprocess call to invoke the command.
This is based on the following python bug report.
http://bugs.python.org/issue1652Signed-off-by Khem Raj <[email protected]>
Quoted 9 lines
--- classes/base.bbclass | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)classes/base.bbclass +0
-0
classes/base.bbclass base_do_buildall() { · line 735
Quoted 8 lines
classes/base.bbclass +5
-0@@ -728,9 +728,14 @@ base_do_buildall() { } +def subprocess_setup(): + import signal, subprocess + # Python installs a SIGPIPE handler by default. This is usually not what + # non-Python subprocesses expect. + signal.signal(signal.SIGPIPE, signal.SIG_DFL)
you don't need to import subprocess here...
classes/base.bbclass base_do_buildall() { · line 738
Quoted 4 lines
classes/base.bbclass +1
-1def oe_unpack_file(file, data, url = None): - import bb, os + import bb, os, signal, subprocess
no need for import signal...
Quoted 11 lines
classes/base.bbclass +1
-0if not url: url = "file://%s" % file dots = file.split(".")@@ -799,7 +804,7 @@ def oe_unpack_file(file, data, url = None): cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) bb.note("Unpacking %s to %s/" % (base_path_out(file, data), base_path_out(os.getcwd(), data))) - ret = os.system(cmd) + ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) os.chdir(save_cwd)
As a general reminder, please avoid import statements in functions. They're just wasting cycles. Put them into global scope.
:M:
Quoted 2 lines · Michael 'Mickey' Lauer
As a general reminder, please avoid import statements in functions. They're just wasting cycles. Put them into global scope.
OK. I will redo this part.
Quoted 10 lines
:M:
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Quoted 2 lines · Michael 'Mickey' Lauer
As a general reminder, please avoid import statements in functions. They're just wasting cycles. Put them into global scope.
looking at base.bbclass I decided to leave it as it is to conform to other functions coding style but may be we should move the import to global scope at once sometime.
Thanks
-Khem
Quoted 9 lines
:M:
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Quoted 11 lines · Holger Hans Peter Freyther
Quoted 10 lines · On Monday 24 August 2009 04:31:41 Khem Raj wrote:
Often gzip is reporting broken pipe errors with
do_unpackof tar.gz files.If you use the commands described above to extract a tar.gz file, gzip sometimes emits a Broken pipe error message. This can safely be ignored if tar extracted all files without any other error message.
We do not let python install its SIGPIPE handler and use subprocess call to invoke the command.
Quoted 6 lines
Quoted 4 lines
This is based on the following python bug report.
http://bugs.python.org/issue1652Signed-off-by Khem Raj <[email protected]>Acked-by Holger Freyther <[email protected]>
Thanks, I've been seeing reports of this and have just merged into Poky! :)
Cheers,
Richard