<?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>9337</bug_id>
          
          <creation_ts>2016-03-24 07:42:34 +0000</creation_ts>
          <short_desc>systemd .service &quot;WantedBy&quot; lines not parsed correctly by systemctl script</short_desc>
          <delta_ts>2019-09-17 13:07:56 +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></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sandro Stiller">sandro.stiller</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>f.bre</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>60373</commentid>
    <comment_count>0</comment_count>
    <who name="Sandro Stiller">sandro.stiller</who>
    <bug_when>2016-03-24 07:42:34 +0000</bug_when>
    <thetext>If a .service file of a recipe contains a space / tab at the end of the WantedBy line, the service is not enabled in the image.
If a .ipk for the same recipe is installed in the target, the service is enabled after installation.
The problem is in the recipes-core/systemd/systemd-systemctl/systemctl shell script. The &quot;real&quot; systemctl binary on the target system works properly.

Preconditions/Environment
-------------------------
tested with
* Yocto 1.8 and
* the current git version of the systemctl script

Triggering Action/Cause
-----------------------
1. Add a space or tab to the end of the WantedBy line of a .service file
2. build an image
3. start the built system

The problem can also reproduced by simply executing
recipes-core/systemd/systemd-systemctl/systemctl --root=&lt;rootfs-dir&gt; &lt;servicename&gt;.service
and checking the result.

Expectation
-----------
The service should be enabled (symlink created)

Actual Result
-------------
The service is not enabled.
There is no message in the build process about it.

Reproducibility
---------------
always</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60399</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2016-03-24 15:17:28 +0000</bug_when>
    <thetext>As mentioned on the bugboard call, depending on the actual bug, we could add a QA, build time check so that we catch malformed .service files before runtime.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60404</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-03-24 17:01:56 +0000</bug_when>
    <thetext>I don&apos;t have a working systemd build right now, but can you see if changing unit_types_re to:

	unit_types_re=&apos;\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)\s*$&apos;


Fixes this?  Basically, add \s* before the $.  (allow some whitespace before the line end)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60857</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-04-06 19:46:15 +0000</bug_when>
    <thetext>Patch on the list</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61165</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-04-13 15:25:28 +0000</bug_when>
    <thetext>Fixed in oe-core 0395162aa45a416db6a0a38e7ee6c0f808272393.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84994</commentid>
    <comment_count>5</comment_count>
    <who name="">f.bre</who>
    <bug_when>2019-09-17 13:06:40 +0000</bug_when>
    <thetext>The systemctl script in poky/meta/recipes-core/systemd/systemd-systemctl is a bit too complicated for me to understand. But a fast look let me tend that somewhere in the beginning it should do a tr &apos;\r\n&apos; &apos;\n&apos; or something of the whole .service file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84995</commentid>
    <comment_count>6</comment_count>
    <who name="">f.bre</who>
    <bug_when>2019-09-17 13:07:56 +0000</bug_when>
    <thetext>oops sorry, wrong ticked. This should go to Bug 13535</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>