<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13269</bug_id>
          
          <creation_ts>2019-04-08 15:54:32 +0000</creation_ts>
          <short_desc>Build fails if host &apos;file&apos; has seccomp enabled</short_desc>
          <delta_ts>2019-10-19 11:10:11 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>oe-core other</component>
          <version>0.0.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Juro Bystricky">juro.bystricky</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>New (Never tested)</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83482</commentid>
    <comment_count>0</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2019-04-08 15:54:32 +0000</bug_when>
    <thetext>If the yocto host system has seccomp provisions, any packaging command will fail with the following (example):

Command &apos;[&apos;file&apos;, &apos;-b&apos;, &apos;/home/juro/yocto/poky/build-thud/tmp/work/armv5e-poky-linux-gnueabi/file/5.34-r0/package/usr/lib/libmagic.so.1.0.0&apos;]&apos; died with &lt;Signals.SIGSYS: 31&gt;.: Traceback (most recent call last):                                       
  File &quot;/home/juro/yocto/poky/meta/lib/oe/utils.py&quot;, line 272, in run                                                                                                                                                                                    
    ret = self._target(*self._args, **self._kwargs)                                                                                                                                                                                                      
  File &quot;/home/juro/yocto/poky/meta/lib/oe/package.py&quot;, line 70, in is_elf                                                                                                                                                                                
    result = subprocess.check_output([&quot;file&quot;, &quot;-b&quot;, path], stderr=subprocess.STDOUT).decode(&quot;utf-8&quot;)                                                                                                                                                     
  File &quot;/usr/lib/python3.7/subprocess.py&quot;, line 395, in check_output                                                                                                                                                                                     
    **kwargs).stdout                                                                                                                                                                                                                                     
  File &quot;/usr/lib/python3.7/subprocess.py&quot;, line 487, in run                                                                                                                                                                                              
    output=stdout, stderr=stderr)                                                                                                                                                                                                                        
subprocess.CalledProcessError: Command &apos;[&apos;file&apos;, &apos;-b&apos;, &apos;/home/juro/yocto/poky/build-thud/tmp/work/armv5e-poky-linux-gnueabi/file/5.34-r0/package/usr/lib/libmagic.so.1.0.0&apos;]&apos; died with &lt;Signals.SIGSYS: 31&gt;.                                            


ERROR: file-5.34-r0 do_package: Function failed: split_and_strip_files

This patch fixes the problem:

===================

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index efd36b3758..38afeb4244 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -67,7 +67,7 @@ def is_kernel_module_signed(path):
 # 16 - kernel module
 def is_elf(path):
     exec_type = 0
-    result = subprocess.check_output([&quot;file&quot;, &quot;-b&quot;, path], stderr=subprocess.STDOUT).decode(&quot;utf-8&quot;)
+    result = subprocess.check_output([&quot;file&quot;, &quot;-bS&quot;, path], stderr=subprocess.STDOUT).decode(&quot;utf-8&quot;)
 
     if &quot;ELF&quot; in result:
         exec_type |= 1
=====================

(see man file &quot;S&quot; option)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83483</commentid>
    <comment_count>1</comment_count>
      <attachid>4464</attachid>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2019-04-08 15:55:13 +0000</bug_when>
    <thetext>Created attachment 4464
patch fixing the reported problem</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83485</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-04-08 16:16:07 +0000</bug_when>
    <thetext>Interestingly my build of file-native from master doesn&apos;t have a -S option.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83489</commentid>
    <comment_count>3</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2019-04-08 16:42:05 +0000</bug_when>
    <thetext>On my host:

$ file --version
file-5.36
magic file from /usr/share/file/magic</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83490</commentid>
    <comment_count>4</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2019-04-08 16:44:10 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Interestingly my build of file-native from master doesn&apos;t have a -S option.

The &quot;file&quot; being used comes from HOSTTOOLS, I am not sure why we don&apos;t use our file-native.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84619</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-08-08 15:19:30 +0000</bug_when>
    <thetext>What host distro was this?  I&apos;m guessing Clear Linux.  Can you still replicate this?

There&apos;s presumably some conflict between seccomp and pseudo.  I wonder if it&apos;s possible to disable seccomp in file without passing an option so we don&apos;t need to detect if seccomp is enabled before every invocation of file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84620</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-08-08 15:20:04 +0000</bug_when>
    <thetext>Current thinking is &quot;can we just mandate that seccomp isn&apos;t enabled&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84621</commentid>
    <comment_count>7</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2019-08-08 15:27:54 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; Current thinking is &quot;can we just mandate that seccomp isn&apos;t enabled&quot;?

The latest &quot;file&quot; allows the switch -S without seccomp being available.
(Up until then -S was treated as an error in that case). But it will take some time for this to percolate to all distros. So the patch I posted will not work with the old &quot;file&quot; package.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84622</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-08-08 15:30:58 +0000</bug_when>
    <thetext>Yes, I saw that. It landed in file five days ago and we still support Centos 7 which is based on Fedora 19, so I don&apos;t expect to be able to assume &apos;file -S&apos; works for a good few years yet.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84710</commentid>
    <comment_count>9</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-08-19 11:36:25 +0000</bug_when>
    <thetext>Interestingly LWN has an article about how Debian tried enabling seccomp for file, and had to turn it off because they use fakeroot (thus, LD_PRELOAD) during package building too:

https://lwn.net/SubscriberLink/796108/95ab278a062b5838/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84729</commentid>
    <comment_count>10</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-08-22 14:58:23 +0000</bug_when>
    <thetext>We expect that seccomp for file does now work in general and any distro trying to do so will eventually revet that feature.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84735</commentid>
    <comment_count>11</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-08-22 16:28:36 +0000</bug_when>
    <thetext>Correction: 
 seccomp for &apos;file&apos; does *not* work in general</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85372</commentid>
    <comment_count>12</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-10-17 15:10:39 +0000</bug_when>
    <thetext>Clear agree that seccomp is stupid and are reverting this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85398</commentid>
    <comment_count>13</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-10-19 11:10:11 +0000</bug_when>
    <thetext>GNU file and seccomp and LD_PRELOAD (thus, pseudo) just don&apos;t get on.

As per comment #9 this isn&apos;t specific to us, Debian has come to the same conclusion.

Clear was the only distribution that enabled seccomp in file and as of this commit it doesn&apos;t do that any more:

https://github.com/clearlinux-pkgs/file/commit/74624ebb5d803a9ce7cd8c956830983f54451d41

Closing as WONTFIX.  I guess an alternative would be to remove file-native from ASSUME_PROVIDED on these platforms and ensure that file-native is marked as a dependency where it is used, but I don&apos;t know if this would actually be possible.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4464</attachid>
            <date>2019-04-08 15:55:13 +0000</date>
            <delta_ts>2019-04-08 15:55:13 +0000</delta_ts>
            <desc>patch fixing the reported problem</desc>
            <filename>package.py.patch</filename>
            <type>text/plain</type>
            <size>524</size>
            <attacher name="Juro Bystricky">juro.bystricky</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL21ldGEvbGliL29lL3BhY2thZ2UucHkgYi9tZXRhL2xpYi9vZS9wYWNrYWdl
LnB5CmluZGV4IGVmZDM2YjM3NTguLjM4YWZlYjQyNDQgMTAwNjQ0Ci0tLSBhL21ldGEvbGliL29l
L3BhY2thZ2UucHkKKysrIGIvbWV0YS9saWIvb2UvcGFja2FnZS5weQpAQCAtNjcsNyArNjcsNyBA
QCBkZWYgaXNfa2VybmVsX21vZHVsZV9zaWduZWQocGF0aCk6CiAjIDE2IC0ga2VybmVsIG1vZHVs
ZQogZGVmIGlzX2VsZihwYXRoKToKICAgICBleGVjX3R5cGUgPSAwCi0gICAgcmVzdWx0ID0gc3Vi
cHJvY2Vzcy5jaGVja19vdXRwdXQoWyJmaWxlIiwgIi1iIiwgcGF0aF0sIHN0ZGVycj1zdWJwcm9j
ZXNzLlNURE9VVCkuZGVjb2RlKCJ1dGYtOCIpCisgICAgcmVzdWx0ID0gc3VicHJvY2Vzcy5jaGVj
a19vdXRwdXQoWyJmaWxlIiwgIi1iUyIsIHBhdGhdLCBzdGRlcnI9c3VicHJvY2Vzcy5TVERPVVQp
LmRlY29kZSgidXRmLTgiKQogCiAgICAgaWYgIkVMRiIgaW4gcmVzdWx0OgogICAgICAgICBleGVj
X3R5cGUgfD0gMQo=
</data>

          </attachment>
      

    </bug>

</bugzilla>