[Pkg-sysvinit-devel] Bug#584862: sysv-rc: calculate the seconds correctly :)

Peter Pentchev roam at ringlet.net
Wed Jul 21 20:58:14 UTC 2010


On Wed, Jul 21, 2010 at 10:02:16PM +0200, Petter Reinholdtsen wrote:
> tags 584862 + patch
> thanks
> 
> [Peter Pentchev]
> > Hi,
> > 
> > First of all, thanks for your work on sysvinit and friends!
> 
> Thank you.
> 
> > What do you think of the following patch which handles the case of the time
> > zone changing while rc*.d scripts are being run?  Currently, /etc/init.d/rc
> > may report things like "Running scripts in rc0.d/ tool -10787 seconds" :)
> > And yes, I know it's marked to be removed before Squeeze is out, but still,
> > if there is a sysvinit upload in the meantime, this might be a quick and
> > easy thing to fix :)
> > 
> > Once again, thanks for your work on sysvinit and Debian in general!
> > 
> > G'luck,
> > Peter
> 
> Sound like a useful patch for bug #584862.  Thank you.  Cc to the BTS
> report and tagging it patch.

Oops, I didn't actually notice the bug report... sorry!

> > Index: debian/src/sysv-rc/etc/init.d/rc
> > ===================================================================
> > --- debian/src/sysv-rc/etc/init.d/rc	(revision 1940)
> > +++ debian/src/sysv-rc/etc/init.d/rc	(working copy)
> > @@ -336,7 +336,10 @@
> >  # This code should be removed when Squeeze freeze is getting closer
> >  # - Petter 2010-05-18
> >  endtime=$(date +%s)
> > -duration=$(($endtime - $starttime))
> > +duration=$((($endtime - $starttime) % 3600))
> > +if [ "$duration" -lt 0 ]; then
> > +	duration=$(($duration + 3600))
> > +fi
> >  log_action_msg "Running scripts in rc$runlevel.d/ took $duration seconds"
> >  
> >  exit 0
> 
> Did you test this change with dash as /bin/sh?

Yes, I was kind of surprised that dash did $((arithmetic)), although I guess
I shouldn't have been, given all the discussion on the Austin Group list
recently, but - in short - yes, and it seems to work just as well.

G'luck,
Peter

-- 
Peter Pentchev	roam at space.bg    roam at ringlet.net    roam at FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
The rest of this sentence is written in Thailand, on
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-sysvinit-devel/attachments/20100721/eca4c0f9/attachment.pgp>


More information about the Pkg-sysvinit-devel mailing list