<?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>11343</bug_id>
          
          <creation_ts>2017-04-12 16:34:40 +0000</creation_ts>
          <short_desc>Wrong execution order of PACKAGESPLITFUNCS</short_desc>
          <delta_ts>2017-11-16 16:29:26 +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>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>2.1.3</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>10944</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Oleksandr Poznyak">oleksandr.poznyak</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>juro.bystricky</cc>
    
    <cc>oleksandr.poznyak</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</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>72390</commentid>
    <comment_count>0</comment_count>
    <who name="Oleksandr Poznyak">oleksandr.poznyak</who>
    <bug_when>2017-04-12 16:34:40 +0000</bug_when>
    <thetext>Current order of PACKAGESPLITFUNCS is:
populate_packages_updatercd populate_packages_updatealternatives systemd_populate_packages package_do_split_locales populate_packages

As You see populate_packages_updatercd is executed before populate_packages_updatealternatives.

As a result we might have following content of DEB package postinst script:

#!/bin/sh
if type update-rc.d &gt;/dev/null 2&gt;/dev/null; then
	if [ -n &quot;$D&quot; ]; then
		OPT=&quot;-r $D&quot;
	else
		OPT=&quot;-s&quot;
	fi
	update-rc.d $OPT syslog start 20 2 3 4 5 . stop 90 0 1 6 .
fi
	update-alternatives --install /etc/init.d/syslog syslog-init /etc/init.d/syslog.syslog-ng 200

update-rc.d will fail in case of absence of syslog target. But syslog target is created after update-rc.d execution.

As You see, update-alternatives should be called BEFORE update-rc.d call.

So at the end we should have this order of PACKAGESPLITFUNCS:
populate_packages_updatealternatives populate_packages_updatercd systemd_populate_packages package_do_split_locales populate_packages</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78258</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-11-16 16:29:26 +0000</bug_when>
    <thetext>update-alternatives and update-rcd just don&apos;t play nicely together, luckily for this example there&apos;s an existing bug which has patches.

*** This bug has been marked as a duplicate of bug 10944 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>