Patchwork package.py: log rpmdeps call

login
register
mail settings
Submitter Martin Jansa
Date Feb. 18, 2014, 12:27 p.m.
Message ID <1392726422-6634-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/66917/
State New
Headers show

Comments

Martin Jansa - Feb. 18, 2014, 12:27 p.m.
* I've noticed errors like this in log.do_package:

  DEBUG: Executing python function package_do_filedeps
  sh: 1: Syntax error: "(" unexpected
  sh: 1: Syntax error: "(" unexpected
  DEBUG: Python function package_do_filedeps finished

  which are actually caused by some filenames included in package
  containing '()' characters

  Maybe we should change meta/classes/package.bbclass to
  fail when some filedeprunner call fails like this and fix
  filedeprunner to escape '()' and other possibly dangerous chars
  it's called like this:
  processed = list(pool.imap(oe.package.filedeprunner, pkglist))

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/lib/oe/package.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Chris Larson - Feb. 18, 2014, 9:09 p.m.
On Tue, Feb 18, 2014 at 5:27 AM, Martin Jansa <martin.jansa@gmail.com>wrote:

>   Maybe we should change meta/classes/package.bbclass to
>   fail when some filedeprunner call fails like this and fix
>   filedeprunner to escape '()' and other possibly dangerous chars
>   it's called like this:
>   processed = list(pool.imap(oe.package.filedeprunner, pkglist))
>

We'd likely be better off just avoiding os.popen entirely in favor of
subprocess based operations, which generally support specifying the command
arguments as a list, and can bypass the shell entirely, avoiding the need
to escape anything. Alternatively, use os.popen2(), which can accept a list
to bypass the shell as well.
Martin Jansa - Feb. 23, 2014, 9:07 a.m.
On Tue, Feb 18, 2014 at 01:27:02PM +0100, Martin Jansa wrote:
> * I've noticed errors like this in log.do_package:
> 
>   DEBUG: Executing python function package_do_filedeps
>   sh: 1: Syntax error: "(" unexpected
>   sh: 1: Syntax error: "(" unexpected
>   DEBUG: Python function package_do_filedeps finished
> 
>   which are actually caused by some filenames included in package
>   containing '()' characters
> 
>   Maybe we should change meta/classes/package.bbclass to
>   fail when some filedeprunner call fails like this and fix
>   filedeprunner to escape '()' and other possibly dangerous chars
>   it's called like this:
>   processed = list(pool.imap(oe.package.filedeprunner, pkglist))

Please don't merge this one yet, It's possible that it's causing
ValueError: insecure string pickle:
http://lists.openembedded.org/pipermail/openembedded-core/2014-February/089805.html

> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta/lib/oe/package.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> index 9a0ddb8..1f78a8d 100644
> --- a/meta/lib/oe/package.py
> +++ b/meta/lib/oe/package.py
> @@ -89,7 +89,9 @@ def filedeprunner(arg):
>  
>          return provides, requires
>  
> -    dep_pipe = os.popen(rpmdeps + " " + " ".join(pkgfiles))
> +    rpmdepscmd = rpmdeps + " " + " ".join(pkgfiles)
> +    bb.debug(1, "runrpmdeps: %s" % rpmdepscmd)
> +    dep_pipe = os.popen(rpmdepscmd)
>  
>      provides, requires = process_deps(dep_pipe, pkg, pkgdest, provides, requires)
>  
> -- 
> 1.8.5.3
>

Patch

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 9a0ddb8..1f78a8d 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -89,7 +89,9 @@  def filedeprunner(arg):
 
         return provides, requires
 
-    dep_pipe = os.popen(rpmdeps + " " + " ".join(pkgfiles))
+    rpmdepscmd = rpmdeps + " " + " ".join(pkgfiles)
+    bb.debug(1, "runrpmdeps: %s" % rpmdepscmd)
+    dep_pipe = os.popen(rpmdepscmd)
 
     provides, requires = process_deps(dep_pipe, pkg, pkgdest, provides, requires)