Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 554434 - net-misc/openntpd: shoudl not assume /etc/localtime exists
Summary: net-misc/openntpd: shoudl not assume /etc/localtime exists
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Paul B. Henson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 554402
  Show dependency tree
 
Reported: 2015-07-10 12:07 UTC by Anthony Basile
Modified: 2015-07-12 18:21 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
New ebuild cleaning up localtime copy (openntpd-5.7_p4-r1.ebuild,2.91 KB, text/plain)
2015-07-11 02:05 UTC, Paul B. Henson
Details
patch ebuild from 5.7_p4 to 5.7_p4-r1 (openntpd-5.7_p4-r1.ebuild.patch,1.55 KB, patch)
2015-07-11 02:06 UTC, Paul B. Henson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Basile gentoo-dev 2015-07-10 12:07:15 UTC
/etc/localtime is used by glibc but not uclibc which uses /etc/TZ.  openntpd builds fine on a uclibc system, but pkg_config() fails because it assumes /etc/localtime exists and it may not.  The assumption in pkg_config() behind the hard linking is dangerous because /etc/localhost may not exist for any number of reasons.

My recommendation is to remove the die from this line:

cp "${EROOT%/}"/etc/localtime "${EROOT%/}${NTP_HOME}"/etc/localtime || die

and guard it in an if statement which, if it fails, alerts the user to manually copy localtime to "${EROOT%/}${NTP_HOME}"/etc/localtime.

Reproducible: Always
Comment 1 Paul B. Henson 2015-07-11 01:42:08 UTC
This whole copying around localtime thing pre-dates me. I guess there was some ancient bug that said ntpd syslog output wasn't in the right timezone because it couldn't access /etc/localtime in the chroot. I wasn't able to reproduce that failure but left the legacy stuff in.

I don't think we need it anymore:

# rm -rf /var/lib/openntpd/chroot/etc

# strace -f /usr/sbin/ntpd -f /etc/ntpd.conf 2>/tmp/ntp.out

# egrep 'chroot|localtime|clone' /tmp/ntp.out
open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2294, ...}) = 0
clone(Process 18931 attached
clone(Process 18932 attached
[pid 18932] clone(Process 18933 attached
[pid 18932] stat("/var/lib/openntpd/chroot", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
[pid 18932] chroot("/var/lib/openntpd/chroot" <unfinished ...>
[pid 18932] <... chroot resumed> )      = 0


ntpd only accesses /etc/localtime before the chroot occurs. I think we should just just rip the copy out of the ebuild and clean up any localtime found in an existing chroot during an update. I'll put together a new ebuild and attach.
Comment 2 Christoph Junghans (RETIRED) gentoo-dev 2015-07-11 01:45:57 UTC
Sounds good to me!
Comment 3 Paul B. Henson 2015-07-11 02:05:29 UTC
Created attachment 406484 [details]
New ebuild cleaning up localtime copy
Comment 4 Paul B. Henson 2015-07-11 02:06:11 UTC
Created attachment 406486 [details, diff]
patch ebuild from 5.7_p4 to 5.7_p4-r1
Comment 5 Christoph Junghans (RETIRED) gentoo-dev 2015-07-12 18:20:33 UTC
+*openntpd-5.7_p4-r1 (12 Jul 2015)
+
+  12 Jul 2015; Christoph Junghans <ottxor@gentoo.org>
+  +openntpd-5.7_p4-r1.ebuild:
+  fixed uclibc compatibility (bug #554434)
+