* [STABLE] [PATCH] base.bbclass: Replace os.system with subprocess call.
@ 2009-11-21 20:52 Cory Maccarrone
2009-11-22 18:54 ` Marcin Juszkiewicz
2009-11-23 15:12 ` Philip Balister
0 siblings, 2 replies; 3+ messages in thread
From: Cory Maccarrone @ 2009-11-21 20:52 UTC (permalink / raw)
To: openembedded-devel
(This patch is being submitted on behalf of Khem Raj. I am not the original
author, nor do I claim any part of this work.)
--------------
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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
classes/base.bbclass | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/classes/base.bbclass b/classes/base.bbclass
index e622aee..69d1979 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -716,9 +716,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(".")
@@ -787,7 +792,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)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [STABLE] [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-11-21 20:52 [STABLE] [PATCH] base.bbclass: Replace os.system with subprocess call Cory Maccarrone
@ 2009-11-22 18:54 ` Marcin Juszkiewicz
2009-11-23 15:12 ` Philip Balister
1 sibling, 0 replies; 3+ messages in thread
From: Marcin Juszkiewicz @ 2009-11-22 18:54 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: Text/Plain, Size: 205 bytes --]
Acked-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
Regards,
--
JID: hrw@jabber.org
Website: http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [STABLE] [PATCH] base.bbclass: Replace os.system with subprocess call.
2009-11-21 20:52 [STABLE] [PATCH] base.bbclass: Replace os.system with subprocess call Cory Maccarrone
2009-11-22 18:54 ` Marcin Juszkiewicz
@ 2009-11-23 15:12 ` Philip Balister
1 sibling, 0 replies; 3+ messages in thread
From: Philip Balister @ 2009-11-23 15:12 UTC (permalink / raw)
To: openembedded-devel
Acked-by: Philip Balister <philip@balister.org>
On 11/21/2009 03:52 PM, Cory Maccarrone wrote:
> (This patch is being submitted on behalf of Khem Raj. I am not the original
> author, nor do I claim any part of this work.)
> --------------
>
> 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
>
> Signed-off-by: Khem Raj<raj.khem@gmail.com>
> ---
> classes/base.bbclass | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/classes/base.bbclass b/classes/base.bbclass
> index e622aee..69d1979 100644
> --- a/classes/base.bbclass
> +++ b/classes/base.bbclass
> @@ -716,9 +716,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(".")
> @@ -787,7 +792,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)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-23 15:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-21 20:52 [STABLE] [PATCH] base.bbclass: Replace os.system with subprocess call Cory Maccarrone
2009-11-22 18:54 ` Marcin Juszkiewicz
2009-11-23 15:12 ` Philip Balister
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.