<?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>2915</bug_id>
          
          <creation_ts>2012-08-08 04:40:07 +0000</creation_ts>
          <short_desc>Don&apos;t use /usr/libexec</short_desc>
          <delta_ts>2013-04-26 18:30:53 +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>core</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>(patch review)</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Saul Wold">sgw</assigned_to>
          <cc>enrico.scholz</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>23875</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2012-08-08 04:40:07 +0000</bug_when>
    <thetext>The FHS doesn&apos;t mention /usr/libexec and we should aim to be as FHS-compliant as possible.  Distros without libexec normally use /usr/lib/[source package name]/ instead.

This should be a two minute change to make, but verifying will be harder.  A sanity check that nothing was installed into /usr/libexec will be a start, but can we grep the installed scripts/binaries to verify that nothing has hardcoded /usr/libexec into an executable?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23961</commentid>
    <comment_count>1</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2012-08-13 14:04:58 +0000</bug_when>
    <thetext>The first pass for this will be to add warnings via the sanity test, there is a large list of recipes that have libexec, so it&apos;s not a &quot;two minute change&quot;!

I will work on the first part of the sanity check and then add to it to create the second part, initially these will produce WARNINGS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23974</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-08-13 17:13:01 +0000</bug_when>
    <thetext>Note, we should still support /usr/libexec if the user has configured the system for this.

So any sanity checks should check for the value of ${prefix}/libexec as libexecdir, and then avoid warnings/errors.

The suggested new default libexecdir format is:

${prefix}/lib/${BPN}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26709</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-10-18 11:46:41 +0000</bug_when>
    <thetext>The default has changed in master: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=1d18224b24a515a07170ce36dbd725cb203d3300</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32674</commentid>
    <comment_count>4</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2013-04-26 15:24:54 +0000</bug_when>
    <thetext>Unfortunately, this change breaks multilib and programs using libexecdir.  libexecdir is defined by the GNU standard as

| The definition of ‘libexecdir’ is the same for all packages

[http://www.gnu.org/prep/standards/html_node/Directory-Variables.html]

Making it dependent on architecture and ${PN} breaks programs which try to execute e.g. ${libexecdir}/sftp-server.

Blindly following FHS is a bad idea because FHS is far behind its time and does not provide solutions for problems like multilib.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32675</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2013-04-26 15:31:38 +0000</bug_when>
    <thetext>One thing I bought up in the last few weeks thanks to the multilib/udev/systemd &quot;fun&quot; was that libexecdir should be defined like nonarch_libdir and hardcode &quot;lib&quot; so binaries don&apos;t move.  This doesn&apos;t entirely solve the ML problem as some libraries (ie pango, gdk-pixbuf) ship binaries in libexecdir, so they&apos;ll now conflict.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32676</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2013-04-26 15:39:40 +0000</bug_when>
    <thetext>What I&apos;m used to seeing for libdir is something like:

noarch_libdir/${bpn}

That way the things live in &apos;/usr/lib/recipe&apos;.  No matter what the multilib is, everything will &quot;just work&quot;.

The only tricky bit is if two different packages want to use the same location.  A common one will need to then be defined for both.

I think the real problem is that the libexecdir wasn&apos;t used reliably in the past, so people redefined it.. it lost some of it&apos;s meaning and then with the multilibs and things like systemd/udev it&apos;s made a comeback.  But with other interesting problems.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32677</commentid>
    <comment_count>7</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2013-04-26 15:45:08 +0000</bug_when>
    <thetext>Agreed - probably best to define a non-ML libdir name as &quot;lib&quot; and use it for libexecdir, nonarch_libdir, etc.  Then at least these all not munged by libdir, and we&apos;ve more symbols to re-use in the recipes.

Binaries that are tied to libraries have various forms of prior art - using gdk-pixbuf as an example as a library that has a utility binary, in Debian it&apos;s in the host-specific libdir and in Fedora it gets left in bindir but suffixed with the word size.  Both of these solutions work as the binary is 99% of the time called by postinst scripts.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32678</commentid>
    <comment_count>8</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2013-04-26 15:46:13 +0000</bug_when>
    <thetext>libexecdir should/must not contain the package name because libexecdir is like bindir and programs hardcode calls to &apos;${libexecdir}/foreign-script&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32679</commentid>
    <comment_count>9</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2013-04-26 15:55:57 +0000</bug_when>
    <thetext>Well we&apos;re not the only distro to put libexecdir into /usr/lib/[package], and it hasn&apos;t been a problem.  /usr/libexec *isn&apos;t* on the path and so anything being invoked in it has to use an absolute path anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32680</commentid>
    <comment_count>10</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2013-04-26 16:09:02 +0000</bug_when>
    <thetext>Which other distributions are making libexecdir dependent on ${PN}?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32681</commentid>
    <comment_count>11</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2013-04-26 16:11:24 +0000</bug_when>
    <thetext>Debian and Ubuntu are obvious examples:

$ ls /usr/libexec
ls: cannot access /usr/libexec: No such file or directory</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32682</commentid>
    <comment_count>12</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2013-04-26 16:14:21 +0000</bug_when>
    <thetext>Debian defines libexecdir to be /usr/lib (minus multilib issues).

I speak about ${PN} in libexecdir; e.g. libexecdir would be

   /usr/lib/openssh-server   for openssh.bb
   /usr/lib/dropbear for dropbear.bb

dropbear calls &apos;${libexecdir}/sftp-server&apos; which is valid for openssh but not for dropbear.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32684</commentid>
    <comment_count>13</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2013-04-26 16:33:15 +0000</bug_when>
    <thetext>&gt; I speak about ${PN} in libexecdir; e.g. libexecdir would be

BPN vs PN, since the PN can have the multilib in the name...

&gt;   /usr/lib/openssh-server   for openssh.bb
&gt;   /usr/lib/dropbear for dropbear.bb
&gt;
&gt; dropbear calls &apos;${libexecdir}/sftp-server&apos; which is valid for openssh but not for dropbear.

This is a place where coordination between packages is required.  In this case I&apos;d expect openssh to set the standard and dropbear to either define it&apos;s own or use the definition from openssh.

I think the key thing is to define a reasonable value for the libexecdir, and then make sure recipes can override it easily as necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32685</commentid>
    <comment_count>14</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2013-04-26 16:43:25 +0000</bug_when>
    <thetext>&gt; BPN vs PN, since the PN can have the multilib in the name...

ok; there is a difference between BPN and PN. But with both, libexecdir would be inconsistent between packages violating expectations raised by the GNU standard.


&gt; This is a place where coordination between packages is required.  In this case
&gt; I&apos;d expect openssh to set the standard and dropbear to either define it&apos;s own
&gt; or use the definition from openssh.

How would you refer to /usr/lib/openssh/sftp-server from within dropbear by using &apos;${libexecdir}&apos;?  Define a global SFTP_SERVER_PATH variable in bitbake.conf?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32686</commentid>
    <comment_count>15</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2013-04-26 17:00:06 +0000</bug_when>
    <thetext>&gt; How would you refer to /usr/lib/openssh/sftp-server from within dropbear by using &apos;${libexecdir}&apos;?  Define a global SFTP_SERVER_PATH variable in bitbake.conf?

Following that few conversations, I&apos;d have to say:

${nonarch_libdir}/openssh/sftp-server

The coordination is that both the openssh(-sftp) package and dropbear need to agree that the subdirectory &apos;openssh&apos; is correct.  The nonarch_libdir would be /lib or /usr/lib depending on settings.

(Note, I don&apos;t see a nonarch_libdir defined, but I do see &quot;nonarch_base_libdir&quot; defined currently.  So this strategy may require enhancements.)

My suggestion would be:

export nonarch_base_libdir = &quot;${base_prefix}/lib&quot;
export nonarch_libdir = &quot;${exec_prefix}/lib&quot;
export libexecdir = &quot;${nonarch_libdir}/${BPN}&quot;

For things like systemd/udev who need the libexecdir to be in the root, they should be able to define:

libexecdir = &quot;${nonarch_base_libdir}/${BPN}&quot;

for things like the sftp above, both recipes could define:

libexecdir = &quot;${nonarch_libdir}/openssh&quot;

(or even)

libexecdir = &quot;${nonarch_libdir}/sftp&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32687</commentid>
    <comment_count>16</comment_count>
    <who name="Enrico Scholz">enrico.scholz</who>
    <bug_when>2013-04-26 17:07:10 +0000</bug_when>
    <thetext>I disagree with the libexecdir definition.

| export libexecdir = &quot;${nonarch_libdir}&quot;

would be much better and matches nearly all other linux distributions (minus multilib and &apos;libexec&apos; vs. &apos;lib&apos; issues).

libexecdir must expand to the same value for every package.

Usually, packages place files into ${libexecdir}/@PACKAGE@  (aka the non-standard &apos;pkglibexecdir&apos;).  For packages like openssh, an explicit

| EXTRA_OECONF += &quot;--libexecdir=${libexecdir}/openssh&quot;

should be added so that files are not installed directly below /usr/lib</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32688</commentid>
    <comment_count>17</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2013-04-26 18:30:53 +0000</bug_when>
    <thetext>In my experience there isn&apos;t a &quot;usually&quot; for packages installing into $libexecdir/[binary] or $libexecdir/[package]/[binary], both are commonplace.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>