Skip to contentSkip to conversation

ntp: fix path to driftfile

PATCH In review [email protected] 2 participants 6 messages Oct 10, 2014 – Oct 11, 2014

lore
Share & tools
lore
#0 lore raw

cover ntp: fix path to driftfile

From: Wenzong Fan <[email protected]>

Default path to driftfile is "/etc/ntp.drift", that doesn't work since ntp daemon is always started with "ntp" user. It should be created at the home directory of "ntp" which is "/var/lib/ntp/".

The following changes since commit 17ff23b4a4a0e5ed7efde107fb00296f1ebd5fdd:

xf86-video-geode: fix build with new glibc-2.20 (2014-10-06 01:07:53 +0200)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/ntp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/ntp

Wenzong Fan (1):
ntp: fix path to driftfile

 meta-networking/recipes-support/ntp/ntp.inc |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ntp: fix path to driftfile

From: Wenzong Fan <[email protected]>

Default path to driftfile is "/etc/ntp.drift", that doesn't work since ntp daemon is always started with "ntp" user. It should be created at the home directory of "ntp" which is "/var/lib/ntp/".

---
 meta-networking/recipes-support/ntp/ntp.inc |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
meta-networking/recipes-support/ntp/ntp.inc +15 -0
index f55a39a..f685274 100644
@@ -53,6 +53,7 @@ PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging"
 do_install_append() {
     install -d ${D}${sysconfdir}/init.d
     install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir}
+    sed -i 's!/etc/ntp.drift!/var/lib/ntp/drift!g' ${D}${sysconfdir}/ntp.conf
     install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d
     install -d ${D}${bindir}
     install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync
@@ -72,6 +73,18 @@ do_install_append() {
     install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate
     install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/
 
+    # Create tmpfiles
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+        install -d ${D}/${sysconfdir}/default/volatiles
+        echo "d ntp ntp 0755 /var/lib/ntp none" \
+            > ${D}/${sysconfdir}/default/volatiles/99_ntpd
+    fi
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d /var/lib/ntp 0755 ntp ntp -" \
+            > ${D}${sysconfdir}/tmpfiles.d/99-ntpd.conf
+    fi
+
     install -d ${D}/${sysconfdir}/network/if-up.d
     ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d
 
@@ -112,6 +125,8 @@ RSUGGESTS_${PN} = "iana-etc"
 
 FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir} \
     ${systemd_unitdir}/ntp-units.d/60-ntpd.list \
+    ${sysconfdir}/default/volatiles \
+    ${sysconfdir}/tmpfiles.d \
 "
 FILES_${PN}-tickadj = "${sbindir}/tickadj"
 FILES_${PN}-utils = "${sbindir}"
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to [email protected]
Quoted 5 lines · On 10/09/2014 10:22 PM, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Default path to driftfile is "/etc/ntp.drift", that doesn't work since ntp daemon is always started with "ntp" user. It should be created at the home directory of "ntp" which is "/var/lib/ntp/".

Could you provide a bit more detail on why this "doesn't work"? Does it violate the FHS, or complicate securing an image, or...?

I see that Debian apparently puts the file in /var/lib/ntp.

I certainly don't object to the change, but "doesn't work" suggests this patch fixes a functional bug, not an inconsistency with policy. More detail in the commit message will help us occasional contributors understand how things are supposed to be done and why.

Thanks.

Peter

Quoted 16 lines

The following changes since commit 17ff23b4a4a0e5ed7efde107fb00296f1ebd5fdd:

   xf86-video-geode: fix build with new glibc-2.20 (2014-10-06 01:07:53 +0200)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/ntp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/ntp

Wenzong Fan (1):
ntp: fix path to driftfile

  meta-networking/recipes-support/ntp/ntp.inc |   15 +++++++++++++++
  1 file changed, 15 insertions(+)
#3 lore raw
Quoted 10 lines · Peter A. Bigot
Quoted 5 lines · On 10/09/2014 10:22 PM, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Default path to driftfile is "/etc/ntp.drift", that doesn't work since ntp daemon is always started with "ntp" user. It should be created at the home directory of "ntp" which is "/var/lib/ntp/".

Could you provide a bit more detail on why this "doesn't work"? Does it violate the FHS, or complicate securing an image, or...?

Quoted 6 lines

I see that Debian apparently puts the file in /var/lib/ntp.

I certainly don't object to the change, but "doesn't work" suggests this patch fixes a functional bug, not an inconsistency with policy. More detail in the commit message will help us occasional contributors understand how things are supposed to be done and why.

Sorry for the confusions, the "doesn't work" means ntp user can't create driftfile under "/etc".

The fix refer to other distributions, just move driftfile to "/var/lib/ntp".

Thanks
Wenzong

Quoted 25 lines

Thanks.

Peter

Quoted 18 lines

The following changes since commit
17ff23b4a4a0e5ed7efde107fb00296f1ebd5fdd:

   xf86-video-geode: fix build with new glibc-2.20 (2014-10-06

01:07:53 +0200)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/ntp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/ntp

Wenzong Fan (1):
ntp: fix path to driftfile

  meta-networking/recipes-support/ntp/ntp.inc |   15 +++++++++++++++
  1 file changed, 15 insertions(+)
#4 lore raw
In reply to [email protected]
Quoted 5 lines · On 10/09/2014 10:22 PM, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Default path to driftfile is "/etc/ntp.drift", that doesn't work since ntp daemon is always started with "ntp" user. It should be created at the home directory of "ntp" which is "/var/lib/ntp/".

The patch in the git repository also adds tmpfile support, which I believe should at least be described in the commit message, and preferably done in a separate commit since it's not related to the location of ntp.drift AFAICT.

Peter

Quoted 15 lines

The following changes since commit 17ff23b4a4a0e5ed7efde107fb00296f1ebd5fdd:

   xf86-video-geode: fix build with new glibc-2.20 (2014-10-06 01:07:53 +0200)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/ntp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/ntp

Wenzong Fan (1):
ntp: fix path to driftfile

  meta-networking/recipes-support/ntp/ntp.inc |   15 +++++++++++++++
  1 file changed, 15 insertions(+)
#5 lore raw
Quoted 12 lines · Peter A. Bigot
Quoted 5 lines · On 10/09/2014 10:22 PM, [email protected] wrote:

From: Wenzong Fan <[email protected]>

Default path to driftfile is "/etc/ntp.drift", that doesn't work since ntp daemon is always started with "ntp" user. It should be created at the home directory of "ntp" which is "/var/lib/ntp/".

The patch in the git repository also adds tmpfile support, which I believe should at least be described in the commit message, and preferably done in a separate commit since it's not related to the location of ntp.drift AFAICT.

Creating tmpfile is for the location changes, so I put them to the same commit.

Thanks for your suggestions, I'll update the commit log and send out V2 patch.

Thanks
Wenzong

Quoted 20 lines

Peter

Quoted 17 lines

The following changes since commit
17ff23b4a4a0e5ed7efde107fb00296f1ebd5fdd:

   xf86-video-geode: fix build with new glibc-2.20 (2014-10-06

01:07:53 +0200)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib wenzong/ntp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/ntp

Wenzong Fan (1):
ntp: fix path to driftfile

  meta-networking/recipes-support/ntp/ntp.inc |   15 +++++++++++++++
  1 file changed, 15 insertions(+)