<?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>14450</bug_id>
          
          <creation_ts>2021-06-24 16:20:10 +0000</creation_ts>
          <short_desc>update-rc.d: Errors in enabling/disabling startup links</short_desc>
          <delta_ts>2021-07-15 00:48:18 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>General Runtime</product>
          <component>General Runtime</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc> https://git.yoctoproject.org/cgit/cgit.cgi/update-rc.d/tree/update-rc.d#n117</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>3.4 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Einar Gunnarsson">tolvupostur</reporter>
          <assigned_to name="Einar Gunnarsson">tolvupostur</assigned_to>
          <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>90761</commentid>
    <comment_count>0</comment_count>
      <attachid>4809</attachid>
    <who name="Einar Gunnarsson">tolvupostur</who>
    <bug_when>2021-06-24 16:20:10 +0000</bug_when>
    <thetext>Created attachment 4809
Patch that should fix this.

The shell script /usr/sbin/update-rc.d has a couple of issues in line 117.

    newnn=$[100-$oldnn]

https://git.yoctoproject.org/cgit/cgit.cgi/update-rc.d/tree/update-rc.d#n117

1) $[] is only known by bash. Running &apos;update-rc.d script enable&apos; with a POSIX shell creates the links &apos;S$[100-12]script&apos; instead of &apos;S88script&apos;. 
   - Running &apos;update-rc.d script enable&apos; a second time encounters more issues, since the $oldnn just grabs the second and third letter of the symlinks, which are now &apos;$[&apos;.
   - This is an issue since many embedded boards only have busybox shell.

2)  $oldnn is parsed as a number, but a leading 0 means octal so that 08 and 09 fail. Running &apos;update-rc.d weston disable&apos; does not work even when using bash, because S09weston results in $[100-09], which gives errors in any shell.

Both issues could be handled by using $(()), and stripping the leading 0.

     $((100-${oldnn#0})) # oldnn is guaranteed to be 2 chars

Shellcheck also reports 50+ other issues, but the others don&apos;t seem to break anything.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90820</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-07-01 14:37:05 +0000</bug_when>
    <thetext>Einar, Are you able to send the patch to the email list: openembedded-core@lists.openembedded.org

https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

I am usually available to help but I&apos;m on vacation for a week. - Randy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90839</commentid>
    <comment_count>2</comment_count>
    <who name="Einar Gunnarsson">tolvupostur</who>
    <bug_when>2021-07-02 13:37:51 +0000</bug_when>
    <thetext>Done.
https://lists.openembedded.org/g/openembedded-core/message/153466</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90870</commentid>
    <comment_count>3</comment_count>
    <who name="Einar Gunnarsson">tolvupostur</who>
    <bug_when>2021-07-07 08:35:50 +0000</bug_when>
    <thetext>Merged...

https://git.yoctoproject.org/cgit/cgit.cgi/update-rc.d/commit/?id=8636cf478d426b568c1be11dbd9346f67e03adac

Still needs to be tagged and bumped into poky</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90914</commentid>
    <comment_count>4</comment_count>
    <who name="Einar Gunnarsson">tolvupostur</who>
    <bug_when>2021-07-13 11:30:52 +0000</bug_when>
    <thetext>Bumped in poky master
https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=404463335113da2a6d0674e959109e069f9bb576</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90920</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-07-15 00:48:18 +0000</bug_when>
    <thetext>Thanks Einar!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4809</attachid>
            <date>2021-06-24 16:20:10 +0000</date>
            <delta_ts>2021-06-24 16:20:10 +0000</delta_ts>
            <desc>Patch that should fix this.</desc>
            <filename>0001-update-rc.d-Fix-enable-disable-command.patch</filename>
            <type>application/octet-stream</type>
            <size>1188</size>
            <attacher name="Einar Gunnarsson">tolvupostur</attacher>
            
              <data encoding="base64">RnJvbSA1YmU0YTFiNDI3Y2QyYWU1ZjkxODNmODg4Y2Q5NTQ2NWY4ZDQ0MDZhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBFaW5hciBHdW5uYXJzc29uIDx0b2x2dXBvc3R1ckBnbWFpbC5j
b20+CkRhdGU6IFRodSwgMjQgSnVuIDIwMjEgMTg6MDQ6MzkgKzAyMDAKU3ViamVjdDogW1BBVENI
XSB1cGRhdGUtcmMuZDogRml4IGVuYWJsZS9kaXNhYmxlIGNvbW1hbmQKCiRbXSBpcyBhIGJhc2hp
c20gYW5kIGRvZXMgbm90IHdvcmsgb24gUE9TSVggc2hlbGxzCgplbmFibGUvZGlzYWJsZSBvbiBs
aW5rcyBudW1iZXJlZCAwOCBhbmQgMDkgZ2l2ZXMgdGhlIGVycm9yOgonYmFzaDogMTAwLTA4OiB2
YWx1ZSB0b28gZ3JlYXQgZm9yIGJhc2UgKGVycm9yIHRva2VuIGlzICIwOCIpJwotLS0KIHVwZGF0
ZS1yYy5kIHwgMiArLQogMSBmaWxl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