Bug#726650: Openntpd pid file is missing

2013-12-23 Thread Sergey B Kirpichev
 Were you able to try applying this patch?

Yes, it seems working (start/stop/restart tested) for few days.

See attached patch.
From 37fb75461c7102617fedd9f270baaf8fe32bcbaa Mon Sep 17 00:00:00 2001
From: Sergey B Kirpichev skirpic...@gmail.com
Date: Mon, 23 Dec 2013 19:11:30 +0400
Subject: [PATCH 1/2] Add a -p option to openntpd to create a pidfile (Closes:
 #726650)

---
 debian/openntpd.init|2 +
 debian/patches/06-pid.patch |  144 +++
 debian/patches/series   |1 +
 3 files changed, 147 insertions(+)
 create mode 100644 debian/patches/06-pid.patch

diff --git a/debian/openntpd.init b/debian/openntpd.init
index 6859368..e3e29db 100644
--- a/debian/openntpd.init
+++ b/debian/openntpd.init
@@ -28,6 +28,8 @@ if [ -f /etc/default/openntpd ]; then
 	. /etc/default/openntpd
 fi
 
+DAEMON_OPTS=${DAEMON_OPTS:-} -p /var/run/openntpd.pid
+
 set -e
 
 case $1 in
diff --git a/debian/patches/06-pid.patch b/debian/patches/06-pid.patch
new file mode 100644
index 000..6479c70
--- /dev/null
+++ b/debian/patches/06-pid.patch
@@ -0,0 +1,144 @@
+Description: adding a -p option to openntpd to create a pidfile
+Origin: https://bugs.gentoo.org/show_bug.cgi?id=493082
+Bug-Debian: http://bugs.debian.org/726650
+
+---
+ ntpd.8 |6 +-
+ ntpd.c |   39 ++-
+ ntpd.h |1 +
+ 3 files changed, 40 insertions(+), 6 deletions(-)
+
+--- a/ntpd.8
 b/ntpd.8
+@@ -25,6 +25,7 @@
+ .Bk -words
+ .Op Fl dnSsv
+ .Op Fl f Ar file
++.Op Fl p Ar file
+ .Ek
+ .Sh DESCRIPTION
+ The
+@@ -63,13 +64,16 @@
+ .Xr ntpd.conf 5 .
+ .Pp
+ The options are as follows:
+-.Bl -tag -width -f fileXXX
++.Bl -tag -width -p fileXXX
+ .It Fl d
+ Do not daemonize.
+ If this option is specified,
+ .Nm
+ will run in the foreground and log to
+ .Em stderr .
++.It Fl p Ar file
++Write pid to
++.Ar file
+ .It Fl f Ar file
+ Use
+ .Ar file
+--- a/ntpd.c
 b/ntpd.c
+@@ -78,7 +78,7 @@
+ {
+ 	extern char *__progname;
+ 
+-	fprintf(stderr, usage: %s [-dnSsv] [-f file]\n, __progname);
++	fprintf(stderr, usage: %s [-dnSsv] [-f file] [-p file]\n, __progname);
+ 	exit(1);
+ }
+ 
+@@ -105,7 +105,7 @@
+ 	log_init(1);		/* log to stderr until daemonized */
+ 	res_init();		/* XXX */
+ 
+-	while ((ch = getopt(argc, argv, df:nsSv)) != -1) {
++	while ((ch = getopt(argc, argv, df:np:sSv)) != -1) {
+ 		switch (ch) {
+ 		case 'd':
+ 			lconf.debug = 1;
+@@ -116,6 +116,9 @@
+ 		case 'n':
+ 			lconf.noaction = 1;
+ 			break;
++		case 'p':
++			lconf.pid_file = optarg;
++			break;
+ 		case 's':
+ 			lconf.settime = 1;
+ 			break;
+@@ -157,9 +160,17 @@
+ 	reset_adjtime();
+ 	if (!lconf.settime) {
+ 		log_init(lconf.debug);
+-		if (!lconf.debug)
++		if (!lconf.debug) {
+ 			if (daemon(1, 0))
+ fatal(daemon);
++			else if (lconf.pid_file != NULL) {
++FILE *f = fopen(lconf.pid_file, w);
++if (f == NULL)
++	fatal(couldn't open pid file);
++fprintf(f, %ld\n, (long) getpid());
++fclose(f);
++			}
++		}
+ 	} else
+ 		timeout = SETTIME_TIMEOUT * 1000;
+ 
+@@ -201,9 +212,17 @@
+ 			log_init(lconf.debug);
+ 			log_debug(no reply received in time, skipping initial 
+ 			time setting);
+-			if (!lconf.debug)
++			if (!lconf.debug) {
+ if (daemon(1, 0))
+ 	fatal(daemon);
++else if (lconf.pid_file != NULL) {
++	FILE *f = fopen(lconf.pid_file, w);
++	if (f == NULL)
++		fatal(couldn't open pid file);
++	fprintf(f, %ld\n, (long) getpid());
++	fclose(f);
++}
++			}
+ 		}
+ 
+ 		if (nfds  0  (pfd[PFD_PIPE].revents  POLLOUT))
+@@ -242,6 +261,8 @@
+ 	msgbuf_clear(ibuf-w);
+ 	free(ibuf);
+ 	log_info(Terminating);
++	if (lconf.pid_file != NULL)
++		unlink(lconf.pid_file);
+ 	return (0);
+ }
+ 
+@@ -316,9 +337,17 @@
+ 			memcpy(d, imsg.data, sizeof(d));
+ 			ntpd_settime(d);
+ 			/* daemonize now */
+-			if (!lconf-debug)
++			if (!lconf-debug) {
+ if (daemon(1, 0))
+ 	fatal(daemon);
++else if (lconf-pid_file != NULL) {
++	FILE *f = fopen(lconf-pid_file, w);
++	if (f == NULL)
++		fatal(couldn't open pid file);
++	fprintf(f, %ld\n, (long) getpid());
++	fclose(f);
++}
++			}
+ 			lconf-settime = 0;
+ 			break;
+ 		case IMSG_HOST_DNS:
+--- a/ntpd.h
 b/ntpd.h
+@@ -178,6 +178,7 @@
+ 	u_int8_t	debug;
+ 	u_int32_t	scale;
+ 	u_int8_t	noaction;
++	char		*pid_file;
+ };
+ 
+ struct buf {
diff --git a/debian/patches/series b/debian/patches/series
index 1f6454e..863a712 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 03-manpage-no-server-by-default.patch
 04-syslog.patch
 05-fix-kfreebsd-ftbfs.patch
+06-pid.patch
-- 
1.7.10.4



Bug#726650: Openntpd pid file is missing

2013-12-16 Thread Dererk
On 15/12/13 12:14, Sergey B Kirpichev wrote:
 On Sun, Dec 15, 2013 at 11:58:36AM -0300, Dererk wrote:
 The reasons for openntpd not carrying this patch (above from it no
 longer applies after the large ntp_adjtime/adjtimex changes), is that I
 considered at that moment it was no longer required because of the
 initscript resting on pidof -o implementation, which replaces this
 functionality.
 It can't, as it carry only about.  Any external programs, which may
 rely on the pid file - are broken (monit - is an example).
Fair enough.

Would you mind reviewing this patch and telling me if it provides the
same functionality as yours did?
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/openntpd/files/openntpd-20080406-pidfile.patch

 If you consider this to be a wrong assessment, I'll be happy to receive
 a refreshed patch
 Ok.  Is there any chance to raise the bug severity and propagate
 this changeset to the stable updates?
There has just been a update to Wheezy, 7.3, so I presume backports
might provide a faster way to update it.

If It works, I will happily port this, as I'm preparing an upload for
another unrelated patch (DNS Timeout resolution) for a stable-backports
package and see what the release team might thing about the stable
candidate one.
Does it work?


Cheers,

Dererk

-- 
BOFH excuse #229:
wrong polarity of neutron flow




signature.asc
Description: OpenPGP digital signature


Bug#726650: Openntpd pid file is missing

2013-12-16 Thread Sergey B Kirpichev
On Mon, Dec 16, 2013 at 01:26:27PM -0300, Dererk wrote:
 Would you mind reviewing this patch and telling me if it provides the
 same functionality as yours did?
 http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/openntpd/files/openntpd-20080406-pidfile.patch

Yes, it looks so.  I'll try to apply this on
the debian package to tell more.

  If you consider this to be a wrong assessment, I'll be happy to receive
  a refreshed patch
  Ok.  Is there any chance to raise the bug severity and propagate
  this changeset to the stable updates?
 There has just been a update to Wheezy, 7.3, so I presume backports
 might provide a faster way to update it.
 
 If It works, I will happily port this, as I'm preparing an upload for
 another unrelated patch (DNS Timeout resolution) for a stable-backports
 package and see what the release team might thing about the stable
 candidate one.
 Does it work?

Backports to who cares about new software and new
functionality.  I don't, for instance.  Anyway, it depends on how
severe you take this problem.  A backport is better then nothing.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#726650: Openntpd pid file is missing

2013-12-15 Thread Dererk
On 17/10/13 15:22, Sergey B Kirpichev wrote:
 Package: openntpd
 Severity: normal
 Version: 20080406p-4

 Hello,

 Why you have *silently* dropped 05-pid.patch?  It was a
 Debian-specific patch, introduced for reason (see #354825).
Hi Sergey!

First of all, please accept my sincere apologies for not providing a
more verbose changelog entry and not letting you know, as patch
provider, the following.

The reasons for openntpd not carrying this patch (above from it no
longer applies after the large ntp_adjtime/adjtimex changes), is that I
considered at that moment it was no longer required because of the
initscript resting on pidof -o implementation, which replaces this
functionality.

If you consider this to be a wrong assessment, I'll be happy to receive
a refreshed patch with the corresponding explanation on why we should
carry it. Just for the sake of sanitization, I'll be closing this bug
with all due respect.

Once again, please accept my sincere apologies for not providing a
proper communication on this subject.


Cheers,

Dererk

-- 
BOFH excuse #69:
knot in cables caused data stream to become twisted and kinked




signature.asc
Description: OpenPGP digital signature


Bug#726650: Openntpd pid file is missing

2013-12-15 Thread Sergey B Kirpichev
On Sun, Dec 15, 2013 at 11:58:36AM -0300, Dererk wrote:
 The reasons for openntpd not carrying this patch (above from it no
 longer applies after the large ntp_adjtime/adjtimex changes), is that I
 considered at that moment it was no longer required because of the
 initscript resting on pidof -o implementation, which replaces this
 functionality.

It can't, as it carry only about.  Any external programs, which may
rely on the pid file - are broken (monit - is an example).

 If you consider this to be a wrong assessment, I'll be happy to receive
 a refreshed patch

Ok.  Is there any chance to raise the bug severity and propagate
this changeset to the stable updates?


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#726650: Openntpd pid file is missing

2013-10-17 Thread Sergey B Kirpichev
Package: openntpd
Severity: normal
Version: 20080406p-4

Hello,

Why you have *silently* dropped 05-pid.patch?  It was a
Debian-specific patch, introduced for reason (see #354825).


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org