<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>158548</bug_id>
          
          <creation_ts>2006-12-19 08:11 0000</creation_ts>
          <short_desc>etc-update preserves timestamps</short_desc>
          <delta_ts>2006-12-21 00:48:11 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Core system</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>uberlord@gentoo.org</reporter>
          <assigned_to>dev-portage@gentoo.org</assigned_to>
          <cc>base-system@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2006-12-19 08:11:18 0000</bug_when>
            <thetext>etc-updates preserves the timestamp of the ._cfg files it updates. This is bad, like so

/etc/init.d/checkfs - depends on checkroot and has a timestamp of 1
baselayout upgrade
/etc/init.d/._cfgcheckfs - depends on checkroot and volumes and has a timestamp of 2
baselayout does depscan.sh -u, to force a deptree update and has a timestamp of 3
user etc-updates checkfs
user reboots - but because checkfs timestamp is older than deptree, we don&apos;t recalc the deptree.

Solution is to touch the file updated to ensure that the timestamp is newer.
If this bug is not solved, people will have a big problem with the baselayout-1.13 upgrade if they use LVM, RAID, or anything listed in RC_VOLUMES.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2006-12-19 08:30:16 0000</bug_when>
            <thetext>Created an attachment (id=104364)
Touch file after updating.

This fixes the issue.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>zmedico@gentoo.org</who>
            <bug_when>2006-12-19 12:45:30 0000</bug_when>
            <thetext>(In reply to comment #1)
&gt; Created an attachment (id=104364) [edit]
&gt; Touch file after updating.
&gt; 
&gt; This fixes the issue.
&gt; 

Is there any other alternative?  Due to bug 16162, this change will reopen bug 8423.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>zmedico@gentoo.org</who>
            <bug_when>2006-12-19 12:52:59 0000</bug_when>
            <thetext>(In reply to comment #0)
&gt; user etc-updates checkfs
&gt; user reboots - but because checkfs timestamp is older than deptree, we don&apos;t
&gt; recalc the deptree.

The timestamp represents the time that the file is merged.  Isn&apos;t that enough to force a recalc of the deptree if the user runs etc-update just after the baselayout update (like they&apos;re supposed to)?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2006-12-20 02:07:07 0000</bug_when>
            <thetext>(In reply to comment #2)
&gt; Is there any other alternative?  Due to bug 16162, this change will reopen bug
&gt; 8423.

Sure there are alternatives, but remember that the test is run each time a service is started/stopped.

Testing the mtime of a file in /etc against the mtime of the deptree is very fast as bash supports this in conditions. Another method, like say store the mtime or md5sum in a file and compare if it&apos;s changed or not would be slower. Also, no tools to do this are available in /bin or /sbin which is where they would need to be.

There is another alternative though - force an update the deptree after etc-update if any where updated.

[[ -x /sbin/depscan.sh ]] &amp;&amp; /sbin/depscan.sh -u

But don&apos;t be to hasty in doing that either, because if ANY other program relies on mtimes in /etc to regenerate anything they will be broken too.

Lastly, I&apos;d like to see this patch or the old behavior restored anyway as logically, if etc-update needs to update file foo, then I would expect the mtime to be updated to when that file was updated by me or etc-update.

(In reply to comment #3)
&gt; The timestamp represents the time that the file is merged.  Isn&apos;t that enough
&gt; to force a recalc of the deptree if the user runs etc-update just after the
&gt; baselayout update (like they&apos;re supposed to)?

No, as we don&apos;t store the timestamp of the file to comapre as we don&apos;t have the tools in /bin or /sbin. Also, that&apos;s a bit of a speed hit too.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2006-12-20 02:09:06 0000</bug_when>
            <thetext>Just a note to say that this behavior breaks stable baselayout too - a good job that the portage version this bug is in isn&apos;t stable :)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2006-12-20 08:20:02 0000</bug_when>
            <thetext>(In reply to comment #0)
&gt; If this bug is not solved, people will have a big problem with the
&gt; baselayout-1.13 upgrade if they use LVM, RAID, or anything listed in
&gt; RC_VOLUMES.

OK, baselayout-1.12.8-r1 and 1.13.0_alpha10-r1 also check the mtime of /etc/init.d and /etc/conf.d
As 1.13 adds a new init script, the mtime is updated and thus depscan.sh can pick this up.

However, this bug is still valid if devs update deps in init scripts they can no-longer rely on etc-update completing the upgrade as the user will have to manually run &quot;depscan.sh -u&quot; until portage team can solve this one.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>zmedico@gentoo.org</who>
            <bug_when>2006-12-20 18:20:13 0000</bug_when>
            <thetext>(In reply to comment #6)
&gt; However, this bug is still valid if devs update deps in init scripts they can
&gt; no-longer rely on etc-update completing the upgrade as the user will have to
&gt; manually run &quot;depscan.sh -u&quot; until portage team can solve this one.

I don&apos;t understand why they need to manually run &quot;depscan.sh -u&quot;.  If a file is updated then the timestamp on it&apos;s parent directory changes, so shouldn&apos;t the service script detect that automatically or am I missing something?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2006-12-20 19:20:49 0000</bug_when>
            <thetext>the mtime of the directory is *not* updated when files inside of it are modified</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>zmedico@gentoo.org</who>
            <bug_when>2006-12-20 19:24:20 0000</bug_when>
            <thetext>(In reply to comment #8)
&gt; the mtime of the directory is *not* updated when files inside of it are
&gt; modified

When the contents changes, such as when one file replaces another (like etc-update does), the directory mtime does change (at least that&apos;s what my experience shows).</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2006-12-20 19:28:19 0000</bug_when>
            <thetext>it isnt about file contents, it&apos;s about the directory contents ... so modifying a file will not update the mtime</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>zmedico@gentoo.org</who>
            <bug_when>2006-12-20 19:58:34 0000</bug_when>
            <thetext>(In reply to comment #10)
&gt; it isnt about file contents, it&apos;s about the directory contents ... so modifying
&gt; a file will not update the mtime

Okay, but don&apos;t the service scripts check the mtime of both to see if any one of them is newer than the depscan cache?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2006-12-21 00:09:34 0000</bug_when>
            <thetext>(In reply to comment #11)
&gt; Okay, but don&apos;t the service scripts check the mtime of both to see if any one
&gt; of them is newer than the depscan cache?

They do as of 1.12.8-r1, but that&apos;s no good if an upgrade only replaces files that already exist. If the deps in the init scripts have changed AND depscan.sh has updated the deptree BEFORE the user etc-updates but AFTER the time merged then the etc-updated mtime will be older than the deptree which causes depscan.sh to think it doesn&apos;t need to run as it was created AFTER the new init script, which is wrong.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>zmedico@gentoo.org</who>
            <bug_when>2006-12-21 00:27:44 0000</bug_when>
            <thetext>I&apos;m sorry, but I still fail to see how bumping the mtime on the directory could be any less useful than bumping the mtime on the file.  It&apos;s just a boolean flag, isn&apos;t it?  Why does it matter whether you use a single file mtime or a combination of file and directory mtimes for this boolean flag?  If not, I guess you guys will have to explain this to me on irc because I&apos;m just not getting in here. :)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>uberlord@gentoo.org</who>
            <bug_when>2006-12-21 00:48:11 0000</bug_when>
            <thetext>I must be having a brain fart - the act of moving the ._cfg file to the new file will of course bump the mtime on the directory.</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>104364</attachid>
            <date>2006-12-19 08:30 0000</date>
            <desc>Touch file after updating.</desc>
            <filename>etc-update.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIGV0Yy11cGRhdGUub3JpZwkyMDA2LTEyLTE5IDE2OjI4OjE0LjAwMDAwMDAwMCArMDAwMAor
KysgZXRjLXVwZGF0ZQkyMDA2LTEyLTE5IDE2OjI5OjAxLjAwMDAwMDAwMCArMDAwMApAQCAtMzM1
LDYgKzMzNSw4IEBACiAJCWNhc2UgJHtteV9pbnB1dH0gaW4KIAkJCTEpIGVjaG8gIlJlcGxhY2lu
ZyAke29maWxlfSB3aXRoICR7ZmlsZX0iCiAJCQkgICBtdiAke212X29wdHN9ICR7ZmlsZX0gJHtv
ZmlsZX0KKwkJCSAgICMgRW5zdXJlIHRoYXQgdGhlIHRpbWVzdGFtcCBpcyBub3csIHNlZSBidWcg
IzE1ODU0OC4KKwkJCSAgIHRvdWNoICR7b2ZpbGV9CiAJCQkgICBbIC1uICIke09WRVJXUklURV9B
TEx9IiBdICYmIG15X2lucHV0PS0xCiAJCQkgICBjb250aW51ZQogCQkJICAgOzsK
</data>        

          </attachment>
    </bug>

</bugzilla>