Your message dated Fri, 22 Jul 2016 07:03:35 +0200
with message-id <[email protected]>
and subject line Re: ntpdate: Please use flock(1) in 
/etc/network/if-up.d/ntpdate
has caused the Debian Bug report #731976,
regarding ntpdate: Please use flock(1) in /etc/network/if-up.d/ntpdate
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
731976: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731976
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: ntpdate
Version: 1:4.2.6.p5+dfsg-2
Severity: normal
Tags: patch

Dear Maintainer,

the code in /etc/network/if-up.d/ntpdate tries to prevent parallel
excution of ntpdate-debian by perusing the lockfile-progs package. If
this is not installed - and it seldom is here -, the script proceeds
without. Plan B works quite well: The listening port of an ntpdate
process which will cause any second one to fail - unless "-u" has been
added to NTPOPTIONS in /etc/default/ntpdate, which I did for certain
reasons. Then, several ntpdate processes may happily try to correct
the time, causing multiple jumps, like in

Dec 11 21:47:46 host ntpdate[2452]: step time server 192.168.29.1 offset 
617.710431 sec
Dec 11 21:47:46 host ntpdate[2432]: step time server 192.168.29.1 offset 
617.710419 sec

As a result, the system time was somewhat ten minutes into the future,
additionally causing nasty fsck warnings during the reboot I had to do
a few seconds later.

Here's my suggestion: Use flock(1) instead, provided by the essential
util-linux package thus avaiable everywhere. Also the code is shorter
now. If the semaphore is locked, no second ntpdate process is started
at all, assuming one is good enough.

Regards,

    Christoph

--- /etc/network/if-up.d/ntpdate        2008-07-09 17:23:38.000000000 +0200
+++ /etc/network/if-up.d/ntpdate        2013-12-11 22:08:23.000000000 +0100
@@ -32,18 +32,10 @@

 LOCKFILE=/var/lock/ntpdate

-# Avoid running more than one at a time
-if [ -x /usr/bin/lockfile-create ]; then
-       lockfile-create $LOCKFILE
-       lockfile-touch $LOCKFILE &
-       LOCKTOUCHPID="$!"
-fi
+(
+    flock --exclusive --nonblock 9 || exit 0

-/usr/sbin/ntpdate-debian -s $OPTS 2>/dev/null || :
-
-if [ -x /usr/bin/lockfile-create ] ; then
-       kill $LOCKTOUCHPID
-       lockfile-remove $LOCKFILE
-fi
+    /usr/sbin/ntpdate-debian -s $OPTS 2>/dev/null || :
+) 9>"$LOCKFILE"

 ) &



-- System Information:
Debian Release: 7.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.10.17 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ntpdate depends on:
ii  dpkg         1.16.12
ii  libc6        2.13-38
ii  libssl1.0.0  1.0.1e-2
ii  netbase      5.0

Versions of packages ntpdate recommends:
pn  lockfile-progs  <none>

ntpdate suggests no packages.

-- Configuration Files:
/etc/default/ntpdate changed [not included]

-- no debconf information

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
fixed 731976 1:4.2.8p8+dfsg-1
thanks

Christoph Biedl wrote...

> Here's my suggestion: Use flock(1) instead, provided by the essential
> util-linux package thus avaiable everywhere.

This has been implemented somewhen in the stretch development cycle,
closing.

    Christoph

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to