Discussion:
[PATCH] timedated: gather timezone from /etc/localtime sym target
(too old to reply)
Shawn Landen
2012-08-07 00:31:03 UTC
Permalink
keep other method for now, consider dropping later.

Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
---
src/timedate/timedated.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 09fd808..456e409 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>

#include "util.h"
#include "strv.h"
@@ -174,9 +175,35 @@ static void verify_timezone(void) {

static int read_data(void) {
int r;
+ struct stat st;

free_data();

+ r = lstat("/etc/localtime", &st);
+ if (r < 0) {
+ log_warning("lstat() of %s failed: %m", "/etc/localtime");
+ } else if (!S_ISLNK(st.st_mode)) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in /usr/share/zoneinfo/");
+ } else {
+ char *t;
+
+ r = readlink_malloc("/etc/localtime", &t);
+ if (r < 0) {
+ log_warning("Failed to get target of %s: %m", "/etc/localtime");
+ } else if (!startswith(t, "/usr/share/zoneinfo/")) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in /usr/share/zoneinfo/");
+ } else {
+ tz.zone = strdup(t + strlen("/usr/share/zoneinfo/"));
+ free(t);
+ if (!tz.zone)
+ return log_oom();
+
+ goto have_timezone;
+ }
+
+ free(t);
+ }
+
r = read_one_line_file("/etc/timezone", &tz.zone);
if (r < 0) {
if (r != -ENOENT)
@@ -192,6 +219,7 @@ static int read_data(void) {
#endif
}

+have_timezone:
if (isempty(tz.zone)) {
free(tz.zone);
tz.zone = NULL;
--
1.7.10.4
Lennart Poettering
2012-08-08 16:51:40 UTC
Permalink
Post by Shawn Landen
keep other method for now, consider dropping later.
Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
Hmm, I am not entirely sure this is really the best thing to do. Always
requiring a symlink for /etc/localtime breaks a couple of things: we
can't just bind mount things over in an nspawn container, embedded
devices have to ship /usr/share/zoneinfo/, which is probably something
they might want to avoid.

So, dunno, I think this is something to think about first, discuss the
pros and cons. I see that just having this as symlink is much simpler,
no doubt, but does it have more benefits? And possibly more
disadvantages?

Lennart
Post by Shawn Landen
---
src/timedate/timedated.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 09fd808..456e409 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "util.h"
#include "strv.h"
@@ -174,9 +175,35 @@ static void verify_timezone(void) {
static int read_data(void) {
int r;
+ struct stat st;
free_data();
+ r = lstat("/etc/localtime", &st);
+ if (r < 0) {
+ log_warning("lstat() of %s failed: %m", "/etc/localtime");
+ } else if (!S_ISLNK(st.st_mode)) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in /usr/share/zoneinfo/");
+ } else {
+ char *t;
+
+ r = readlink_malloc("/etc/localtime", &t);
+ if (r < 0) {
+ log_warning("Failed to get target of %s: %m", "/etc/localtime");
+ } else if (!startswith(t, "/usr/share/zoneinfo/")) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in /usr/share/zoneinfo/");
+ } else {
+ tz.zone = strdup(t + strlen("/usr/share/zoneinfo/"));
+ free(t);
+ if (!tz.zone)
+ return log_oom();
+
+ goto have_timezone;
+ }
+
+ free(t);
+ }
+
r = read_one_line_file("/etc/timezone", &tz.zone);
if (r < 0) {
if (r != -ENOENT)
@@ -192,6 +219,7 @@ static int read_data(void) {
#endif
}
if (isempty(tz.zone)) {
free(tz.zone);
tz.zone = NULL;
Lennart
--
Lennart Poettering - Red Hat, Inc.
Kay Sievers
2012-08-08 17:12:25 UTC
Permalink
On Wed, Aug 8, 2012 at 6:51 PM, Lennart Poettering
Post by Lennart Poettering
Post by Shawn Landen
keep other method for now, consider dropping later.
Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
Hmm, I am not entirely sure this is really the best thing to do. Always
requiring a symlink for /etc/localtime breaks a couple of things: we
can't just bind mount things over in an nspawn container,
Just mount the symlink pointing to /usr/share/zoneinfo/ in the
container, or possibly to a copy of localtime stored the container's
/run, if there isn't anything in the container's zoneinfo?
Post by Lennart Poettering
embedded
devices have to ship /usr/share/zoneinfo/, which is probably something
they might want to avoid.
I wouldn't see much of a problem if we can't determine the time zone
text in exotic and custom setups. If we don't have stuff available to
link to from /etc, we just leave it alone.
Post by Lennart Poettering
So, dunno, I think this is something to think about first, discuss the
pros and cons. I see that just having this as symlink is much simpler,
no doubt, but does it have more benefits? And possibly more
disadvantages?
Stuff in /etc invites to manual edit and "administration". Two files,
with very different names, describing the very same thing, which need
to be in sync, are so bad, that in the end, there is no real question
here, I guess. :)

Kay
Tom Gundersen
2012-08-08 18:51:08 UTC
Permalink
On Wed, Aug 8, 2012 at 6:51 PM, Lennart Poettering
Post by Lennart Poettering
So, dunno, I think this is something to think about first, discuss the
pros and cons. I see that just having this as symlink is much simpler,
no doubt, but does it have more benefits? And possibly more
disadvantages?
I'd very much like /etc/timezone to go away.

Mainly due to two reasons: /etc/localtime and /etc/timezone are likely
to get out-of-sync (we have the same problem now in Arch where the
timezone is stored in /etc/rc.conf rather than in /etc/timezone and it
brings us nothing but grief). Also, if /etc/localtime is not a symlink
we would need to update it every time the timezone package is updated,
this would of course be possible, but it seems unnecessary.

-t
Shawn Landen
2012-08-08 19:29:41 UTC
Permalink
Not exactly sure how to make this defined from autoconf, but this way, if you
#define ZONEINFO_PATH "/etc/" then you can have something very similar to
the existing setup for embedded symtems, e.g.
/etc/localtime -> /etc/Etc/UTC
if the devices want to support more than one timezone, then they have to support the full-fledged
/usr/share/zoneinfo anyways.
Shawn Landen
2012-08-08 19:29:42 UTC
Permalink
keep other method for now, consider dropping later.

Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.

v2 - Add ZONEINFO_PATH
- Restructured the patch so its very straight forward to remove
support for the old methods. (some log_warning()s should then be converted
to log_error() too)
---
src/timedate/timedated.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 09fd808..01d01b6 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>

#include "util.h"
#include "strv.h"
@@ -74,6 +75,10 @@
BUS_GENERIC_INTERFACES_LIST \
"org.freedesktop.timedate1\0"

+#ifndef ZONEINFO_PATH
+# define ZONEINFO_PATH "/usr/share/zoneinfo/"
+#endif
+
const char timedate_interface[] _introspect_("timedate1") = INTERFACE;

typedef struct TZ {
@@ -174,9 +179,37 @@ static void verify_timezone(void) {

static int read_data(void) {
int r;
+ struct stat st;

free_data();

+ r = lstat("/etc/localtime", &st);
+ if (r < 0) {
+ log_warning("lstat() of %s failed: %m", "/etc/localtime");
+ } else if (!S_ISLNK(st.st_mode)) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in %s", ZONEINFO_PATH);
+ } else {
+ char *t;
+
+ r = readlink_malloc("/etc/localtime", &t);
+ if (r < 0) {
+ log_warning("Failed to get target of %s: %m", "/etc/localtime");
+ } else if (!startswith(t, ZONEINFO_PATH)) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in %s", ZONEINFO_PATH);
+ } else {
+ tz.zone = strdup(t + strlen(ZONEINFO_PATH));
+ if (!tz.zone) {
+ free(t);
+ return log_oom();
+ }
+
+ free(t);
+ goto have_timeone;
+ }
+
+ free(t);
+ }
+
r = read_one_line_file("/etc/timezone", &tz.zone);
if (r < 0) {
if (r != -ENOENT)
@@ -192,6 +225,7 @@ static int read_data(void) {
#endif
}

+have_timezone:
if (isempty(tz.zone)) {
free(tz.zone);
tz.zone = NULL;
--
1.7.10.4
Lennart Poettering
2012-08-08 20:56:31 UTC
Permalink
Post by Shawn Landen
keep other method for now, consider dropping later.
Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
v2 - Add ZONEINFO_PATH
- Restructured the patch so its very straight forward to remove
support for the old methods. (some log_warning()s should then be converted
to log_error() too)
---
src/timedate/timedated.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 09fd808..01d01b6 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "util.h"
#include "strv.h"
@@ -74,6 +75,10 @@
BUS_GENERIC_INTERFACES_LIST \
"org.freedesktop.timedate1\0"
+#ifndef ZONEINFO_PATH
+# define ZONEINFO_PATH "/usr/share/zoneinfo/"
+#endif
+
const char timedate_interface[] _introspect_("timedate1") = INTERFACE;
typedef struct TZ {
@@ -174,9 +179,37 @@ static void verify_timezone(void) {
static int read_data(void) {
int r;
+ struct stat st;
free_data();
+ r = lstat("/etc/localtime", &st);
+ if (r < 0) {
+ log_warning("lstat() of %s failed: %m", "/etc/localtime");
+ } else if (!S_ISLNK(st.st_mode)) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in %s", ZONEINFO_PATH);
+ } else {
Coding style: "if" blocks containing only one line are generally written
without {} in the systemd codebase.
Post by Shawn Landen
+ char *t;
+
+ r = readlink_malloc("/etc/localtime", &t);
Please invoke this call right-away, don't bother with the lstat() as
readlink() will return EINVAL anyway if it isn't a symbolic link what
you are reading. It's good to have this "as atomic as possible"...

Maybe use readlink_and_make_absolute() here? Or even
readlink_and_canonicalize()? That's the one-stop solution to getting a
useful file name out of a symlink...

Hmm, I think it would make sense to write /etc/timezone only if it
already exists.

Also, we probably should drop the man page timezone(5) at the same time,
as we are not pushing that anymore then. But maybe we should add
localtime(5) instead which explains the semantics of the symlink?

Lennart
--
Lennart Poettering - Red Hat, Inc.
s***@gmail.com
2012-08-08 21:42:59 UTC
Permalink
From: Shawn Landen <***@gmail.com>

keep other method for now, consider dropping later.

Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
---
src/timedate/timedated.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 09fd808..d0812fa 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>

#include "util.h"
#include "strv.h"
@@ -74,6 +75,11 @@
BUS_GENERIC_INTERFACES_LIST \
"org.freedesktop.timedate1\0"

+/* Must start and end with '/' */
+#ifndef ZONEINFO_PATH
+# define ZONEINFO_PATH "/usr/share/zoneinfo/"
+#endif
+
const char timedate_interface[] _introspect_("timedate1") = INTERFACE;

typedef struct TZ {
@@ -174,9 +180,32 @@ static void verify_timezone(void) {

static int read_data(void) {
int r;
+ struct stat st;
+ char *t;

free_data();

+ r = readlink_malloc("/etc/localtime", &t);
+ if (r < 0) {
+ if (errno == EINVAL)
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in %s", ZONEINFO_PATH);
+ else
+ log_warning("Failed to get target of %s: %m", "/etc/localtime");
+ } else if (!startswith(t, ZONEINFO_PATH))
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in %s", ZONEINFO_PATH);
+ else {
+ tz.zone = strdup(t + strlen(ZONEINFO_PATH));
+ if (!tz.zone) {
+ free(t);
+ return log_oom();
+ }
+
+ free(t);
+ goto have_timeone;
+ }
+
+ free(t);
+
r = read_one_line_file("/etc/timezone", &tz.zone);
if (r < 0) {
if (r != -ENOENT)
@@ -192,6 +221,7 @@ static int read_data(void) {
#endif
}

+have_timezone:
if (isempty(tz.zone)) {
free(tz.zone);
tz.zone = NULL;
--
1.7.10.4
shawn
2012-08-08 21:54:53 UTC
Permalink
Post by Lennart Poettering
Post by Shawn Landen
static int read_data(void) {
int r;
+ struct stat st;
free_data();
+ r = lstat("/etc/localtime", &st);
+ if (r < 0) {
+ log_warning("lstat() of %s failed: %m", "/etc/localtime");
+ } else if (!S_ISLNK(st.st_mode)) {
+ log_warning("/etc/localtime should be an absolute symlink to a timezone data file in %s", ZONEINFO_PATH);
+ } else {
Coding style: "if" blocks containing only one line are generally written
without {} in the systemd codebase.
fixed
Post by Lennart Poettering
Post by Shawn Landen
+ char *t;
+
+ r = readlink_malloc("/etc/localtime", &t);
Please invoke this call right-away, don't bother with the lstat() as
readlink() will return EINVAL anyway if it isn't a symbolic link what
you are reading. It's good to have this "as atomic as possible"...
using the EINVAL behavior made it much cleaner, just realized i forgot
to
remove <sys/stat.h>....
Post by Lennart Poettering
Maybe use readlink_and_make_absolute() here? Or even
readlink_and_canonicalize()? That's the one-stop solution to getting a
useful file name out of a symlink...
The problem is that canonicalize resolves symlinks inside
of /usr/share/zoneinfo
as is mentioned in the changelog, which ruins the detection of the
timezone.

A hack could be to use
char *o;
...
readlink_and_make_absolute("/etc/localtime", &t);
..
if (!(o = strstr(t, ZONEINFO_PATH)))
...
strdup(o + strlen(ZONEINFO_PATH));

which would make it work for relative symlinks that do not reside
somewhere in /usr,
but seems really nasty over just requiring an absolute symlink.
Post by Lennart Poettering
Hmm, I think it would make sense to write /etc/timezone only if it
already exists.
I'll look into this, but if its doing that this is a differn't bug that
already exists in the current version when built for Fedora.
Post by Lennart Poettering
Also, we probably should drop the man page timezone(5) at the same time,
as we are not pushing that anymore then. But maybe we should add
localtime(5) instead which explains the semantics of the symlink?
Considering that it must be an absolute symlink in the only sane way I
can think to implement it, and that at least Debian currently ship it as
a normal file, I think that would
be sensible.



Does anyone have a sensible way in which to allow symlinks here? The
complicated ways in which ".." works when directories are themselves
symlinks makes me think this is something too complicated.
--
-Shawn Landden
Shawn Landen
2012-08-09 23:16:39 UTC
Permalink
---
src/shared/util.c | 19 +++++++++++++++++--
src/shared/util.h | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 946b7d5..876eb62 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4851,7 +4851,7 @@ finish:
return r;
}

-int symlink_or_copy_atomic(const char *from, const char *to) {
+static int symlink_atomic_raw(const char *from, const char *to, bool allow_copy) {
char *t, *x;
const char *fn;
size_t k;
@@ -4880,7 +4880,14 @@ int symlink_or_copy_atomic(const char *from, const char *to) {

*x = 0;

- r = symlink_or_copy(from, t);
+ if (allow_copy)
+ r = symlink_or_copy(from, t);
+ else {
+ r = symlink(from, t);
+ if (r < 0)
+ r = -errno;
+ }
+
if (r < 0) {
unlink(t);
free(t);
@@ -4898,6 +4905,14 @@ int symlink_or_copy_atomic(const char *from, const char *to) {
return r;
}

+int symlink_or_copy_atomic(const char *from, const char *to) {
+ return symlink_atomic_raw(from, to, true);
+}
+
+int symlink_atomic(const char *from, const char *to) {
+ return symlink_atomic_raw(from, to, false);
+}
+
bool display_is_local(const char *display) {
assert(display);

diff --git a/src/shared/util.h b/src/shared/util.h
index d5a48eb..24fa240 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -436,6 +436,7 @@ int vt_disallocate(const char *name);
int copy_file(const char *from, const char *to);
int symlink_or_copy(const char *from, const char *to);
int symlink_or_copy_atomic(const char *from, const char *to);
+int symlink_atomic(const char *from, const char *to);

int fchmod_umask(int fd, mode_t mode);
--
1.7.10.4
Shawn Landen
2012-08-09 23:16:40 UTC
Permalink
keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo"
---
src/timedate/timedated.c | 56 ++++++++++++++++++++++++++++++++++++++--------
1 file changed, 47 insertions(+), 9 deletions(-)

diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 09fd808..b21d930 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>

#include "util.h"
#include "strv.h"
@@ -74,6 +75,9 @@
BUS_GENERIC_INTERFACES_LIST \
"org.freedesktop.timedate1\0"

+/* Must start and end with '/' */
+#define ZONEINFO_PATH "/usr/share/zoneinfo/"
+
const char timedate_interface[] _introspect_("timedate1") = INTERFACE;

typedef struct TZ {
@@ -151,13 +155,16 @@ static void verify_timezone(void) {
if (!tz.zone)
return;

- p = strappend("/usr/share/zoneinfo/", tz.zone);
- if (!p) {
- log_oom();
+ j = read_full_file("/etc/localtime", &a, &l);
+
+ /* allow /etc/localtime to not exist */
+ if (j == -ENOENT)
return;
- }

- j = read_full_file("/etc/localtime", &a, &l);
+ p = strappend("/usr/share/zoneinfo/", tz.zone);
+ if (!p)
+ return (void)log_oom();
+
k = read_full_file(p, &b, &q);

free(p);
@@ -174,9 +181,36 @@ static void verify_timezone(void) {

static int read_data(void) {
int r;
+ char *t;
+ /* we only support the trivial relative link of ..$ABSOLUTE */
+ bool relative_link = false;

free_data();

+ r = readlink_malloc("/etc/localtime", &t);
+ if (r < 0) {
+ if (errno == EINVAL)
+ log_warning("/etc/localtime should be a symbolic link to a timezone data file in %s", ZONEINFO_PATH);
+ else
+ log_warning("Failed to get target of %s: %m", "/etc/localtime");
+ } else if (!startswith(t, ZONEINFO_PATH) && !(startswith(t, "..") && startswith(t + strlen(".."), ZONEINFO_PATH)))
+ log_warning("/etc/localtime should be a symbolic link to a timezone data file in %s", ZONEINFO_PATH);
+ else {
+ if (startswith(t, ".."))
+ relative_link = true;
+
+ tz.zone = strdup(t + (relative_link ? strlen("..") : 0) + strlen(ZONEINFO_PATH));
+ if (!tz.zone) {
+ free(t);
+ return log_oom();
+ }
+
+ free(t);
+ goto have_timezone;
+ }
+
+ free(t);
+
r = read_one_line_file("/etc/timezone", &tz.zone);
if (r < 0) {
if (r != -ENOENT)
@@ -192,6 +226,7 @@ static int read_data(void) {
#endif
}

+have_timezone:
if (isempty(tz.zone)) {
free(tz.zone);
tz.zone = NULL;
@@ -207,6 +242,7 @@ static int read_data(void) {
static int write_data_timezone(void) {
int r = 0;
char *p;
+ struct stat st;

if (!tz.zone) {
if (unlink("/etc/timezone") < 0 && errno != ENOENT)
@@ -222,15 +258,17 @@ static int write_data_timezone(void) {
if (!p)
return log_oom();

- r = symlink_or_copy_atomic(p, "/etc/localtime");
+ r = symlink_atomic(p, "/etc/localtime");
free(p);

if (r < 0)
return r;

- r = write_one_line_file_atomic("/etc/timezone", tz.zone);
- if (r < 0)
- return r;
+ if (stat("/etc/timezone", &st) == 0 && S_ISREG(st.st_mode)) {
+ r = write_one_line_file_atomic("/etc/timezone", tz.zone);
+ if (r < 0)
+ return r;
+ }

return 0;
}
--
1.7.10.4
Shawn Landden
2012-08-10 00:07:08 UTC
Permalink
---
Makefile.am | 2 +-
man/localtime.xml | 93 ++++++++++++++++++++++++++++++++++++
man/timezone.xml | 90 ----------------------------------
units/systemd-timedated.service.in | 2 +-
4 files changed, 95 insertions(+), 92 deletions(-)
create mode 100644 man/localtime.xml
delete mode 100644 man/timezone.xml

diff --git a/Makefile.am b/Makefile.am
index ad8f71d..88babf2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -468,7 +468,7 @@ MANPAGES = \
man/systemd.conf.5 \
man/tmpfiles.d.5 \
man/hostname.5 \
- man/timezone.5 \
+ man/localtime.5 \
man/machine-id.5 \
man/locale.conf.5 \
man/os-release.5 \
diff --git a/man/localtime.xml b/man/localtime.xml
new file mode 100644
index 0000000..09df161
--- /dev/null
+++ b/man/localtime.xml
@@ -0,0 +1,93 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+ Copyright 2012 Shawn Landden
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="localtime">
+ <refentryinfo>
+ <title>/etc/localtime</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Lennart</firstname>
+ <surname>Poettering</surname>
+ <email>***@poettering.net</email>
+ </author>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Shawn</firstname>
+ <surname>Landden</surname>
+ <email>***@gmail.com</email>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>localtime</refentrytitle>
+ <manvolnum>5</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>localtime</refname>
+ <refpurpose>Local time zone configuration file</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <para><filename>/etc/localtime</filename> -> <filename>/usr/share/zoneinfo/…</filename></para>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>The <filename>/etc/localtime</filename> file
+ configures the system-wide time zone of the local
+ system that is used by applications for presentation
+ to the user. It should be an absolute symbolic link
+ with a destination of <filename>/usr/share/zoneinfo/</filename>,
+ fallowed by a time zone identifier such as
+ <literal>Europe/Berlin</literal> or <literal>Etc/UTC</literal>.
+ The resulting link should point to the corresponding binary
+ <citerefentry><refentrytitle>tzfile</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ time zone data for the configured time zone.</para>
+
+ <para>As the time zone identifier is extracted from the name of
+ the target of <filename>/etc/localtime</filename> this file may
+ not be a normal file or hardlink.</para>
+
+ <para>The time zone may be overridden for individual
+ programs by using the TZ environment variable. See
+ <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+ <para>
+ <citerefentry><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/timezone.xml b/man/timezone.xml
deleted file mode 100644
index dedb7d9..0000000
--- a/man/timezone.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-
-<refentry id="timezone">
- <refentryinfo>
- <title>/etc/timezone</title>
- <productname>systemd</productname>
-
- <authorgroup>
- <author>
- <contrib>Developer</contrib>
- <firstname>Lennart</firstname>
- <surname>Poettering</surname>
- <email>***@poettering.net</email>
- </author>
- </authorgroup>
- </refentryinfo>
-
- <refmeta>
- <refentrytitle>timezone</refentrytitle>
- <manvolnum>5</manvolnum>
- </refmeta>
-
- <refnamediv>
- <refname>timezone</refname>
- <refpurpose>Local time zone configuration file</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <para><filename>/etc/timezone</filename></para>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
-
- <para>The <filename>/etc/timezone</filename> file
- configures the system-wide time zone of the local
- system that is used by applications for presentation
- to the user. It should contain a single
- newline-terminated line consisting of a time zone
- identifier such as
- <literal>Europe/Berlin</literal>. The file
- <filename>/etc/localtime</filename> corresponds with
- <filename>/etc/timezone</filename> and contains the
- binary time zone data for the time zone. These files
- should always be changed simultaneously and kept in
- sync.</para>
-
- <para>The time zone may be overridden for individual
- programs by using the TZ environment variable. See
- <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
- </refsect1>
-
- <refsect1>
- <title>History</title>
-
- <para>The simple configuration file format of
- <filename>/etc/timezone</filename> originates from
- Debian GNU/Linux.</para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- </para>
- </refsect1>
-
-</refentry>
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
index 1944a71..dd3eb1b 100644
--- a/units/systemd-timedated.service.in
+++ b/units/systemd-timedated.service.in
@@ -7,7 +7,7 @@

[Unit]
Description=Time & Date Service
-Documentation=man:systemd-timedated.service(8) man:timezone(5)
+Documentation=man:systemd-timedated.service(8) man:localtime(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/timedated

[Service]
--
1.7.9.5
Shawn Landden
2012-08-11 22:22:45 UTC
Permalink
From: Shawn Landen <***@gmail.com>

unlike symlink_or_copy_atomic(), this function creates a symlink even if the
oldname and newname (from and to) are on differn't devices. (stat.st_dev)
---
src/shared/util.c | 19 +++++++++++++++++--
src/shared/util.h | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 946b7d5..876eb62 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4851,7 +4851,7 @@ finish:
return r;
}

-int symlink_or_copy_atomic(const char *from, const char *to) {
+static int symlink_atomic_raw(const char *from, const char *to, bool allow_copy) {
char *t, *x;
const char *fn;
size_t k;
@@ -4880,7 +4880,14 @@ int symlink_or_copy_atomic(const char *from, const char *to) {

*x = 0;

- r = symlink_or_copy(from, t);
+ if (allow_copy)
+ r = symlink_or_copy(from, t);
+ else {
+ r = symlink(from, t);
+ if (r < 0)
+ r = -errno;
+ }
+
if (r < 0) {
unlink(t);
free(t);
@@ -4898,6 +4905,14 @@ int symlink_or_copy_atomic(const char *from, const char *to) {
return r;
}

+int symlink_or_copy_atomic(const char *from, const char *to) {
+ return symlink_atomic_raw(from, to, true);
+}
+
+int symlink_atomic(const char *from, const char *to) {
+ return symlink_atomic_raw(from, to, false);
+}
+
bool display_is_local(const char *display) {
assert(display);

diff --git a/src/shared/util.h b/src/shared/util.h
index d5a48eb..24fa240 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -436,6 +436,7 @@ int vt_disallocate(const char *name);
int copy_file(const char *from, const char *to);
int symlink_or_copy(const char *from, const char *to);
int symlink_or_copy_atomic(const char *from, const char *to);
+int symlink_atomic(const char *from, const char *to);

int fchmod_umask(int fd, mode_t mode);
--
1.7.9.5
Shawn Landden
2012-08-11 22:22:46 UTC
Permalink
From: Shawn Landen <***@gmail.com>

/etc/localtime -> /usr/share/zoneinfo/...

or

/etc/localtime -> ../usr/share/zoneinfo/...

(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())

keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Zbigniew Jędrzejewski-Szmek
2012-08-12 11:08:38 UTC
Permalink
Hi,
could you prefix the patch header like [PATCH 2/3 v3], adding the same
version number to all patches that are supposed to go together, to make
it easier for people who are not following the thread closely...

Thanks,
Zbyszek
Shawn Landden
2012-08-13 05:36:37 UTC
Permalink
unlike symlink_or_copy_atomic(), this function creates a symlink even if the
oldname and newname (from and to) are on differn't devices. (stat.st_dev)
---
src/shared/util.c | 19 +++++++++++++++++--
src/shared/util.h | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 946b7d5..876eb62 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4851,7 +4851,7 @@ finish:
return r;
}

-int symlink_or_copy_atomic(const char *from, const char *to) {
+static int symlink_atomic_raw(const char *from, const char *to, bool allow_copy) {
char *t, *x;
const char *fn;
size_t k;
@@ -4880,7 +4880,14 @@ int symlink_or_copy_atomic(const char *from, const char *to) {

*x = 0;

- r = symlink_or_copy(from, t);
+ if (allow_copy)
+ r = symlink_or_copy(from, t);
+ else {
+ r = symlink(from, t);
+ if (r < 0)
+ r = -errno;
+ }
+
if (r < 0) {
unlink(t);
free(t);
@@ -4898,6 +4905,14 @@ int symlink_or_copy_atomic(const char *from, const char *to) {
return r;
}

+int symlink_or_copy_atomic(const char *from, const char *to) {
+ return symlink_atomic_raw(from, to, true);
+}
+
+int symlink_atomic(const char *from, const char *to) {
+ return symlink_atomic_raw(from, to, false);
+}
+
bool display_is_local(const char *display) {
assert(display);

diff --git a/src/shared/util.h b/src/shared/util.h
index d5a48eb..24fa240 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -436,6 +436,7 @@ int vt_disallocate(const char *name);
int copy_file(const char *from, const char *to);
int symlink_or_copy(const char *from, const char *to);
int symlink_or_copy_atomic(const char *from, const char *to);
+int symlink_atomic(const char *from, const char *to);

int fchmod_umask(int fd, mode_t mode);
--
1.7.9.5
Shawn Landden
2012-08-13 05:36:38 UTC
Permalink
/etc/localtime -> /usr/share/zoneinfo/...

or

/etc/localtime -> ../usr/share/zoneinfo/...

(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())

keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Frederic Crozat
2012-08-14 08:32:23 UTC
Permalink
Post by Shawn Landden
/etc/localtime -> /usr/share/zoneinfo/...
or
/etc/localtime -> ../usr/share/zoneinfo/...
(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())
keep other method for now, consider dropping later.
Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Frederic Crozat
2012-08-14 09:17:57 UTC
Permalink
Post by Shawn Landden
/etc/localtime -> /usr/share/zoneinfo/...
or
/etc/localtime -> ../usr/share/zoneinfo/...
(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())
keep other method for now, consider dropping later.
Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Frederic Crozat
2012-08-14 09:25:40 UTC
Permalink
Post by Shawn Landden
/etc/localtime -> /usr/share/zoneinfo/...
or
/etc/localtime -> ../usr/share/zoneinfo/...
(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())
keep other method for now, consider dropping later.
Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Shawn Landden
2012-08-14 17:56:55 UTC
Permalink
/etc/localtime -> /usr/share/zoneinfo/...

or

/etc/localtime -> ../usr/share/zoneinfo/...

(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())

keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Shawn Landden
2012-08-13 05:36:39 UTC
Permalink
---
Makefile.am | 2 +-
man/{timezone.xml => localtime.xml} | 49 +++++++++++++++++++----------------
units/systemd-timedated.service.in | 2 +-
3 files changed, 28 insertions(+), 25 deletions(-)
rename man/{timezone.xml => localtime.xml} (59%)

diff --git a/Makefile.am b/Makefile.am
index 9062dd6..3422a75 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -468,7 +468,7 @@ MANPAGES = \
man/systemd.conf.5 \
man/tmpfiles.d.5 \
man/hostname.5 \
- man/timezone.5 \
+ man/localtime.5 \
man/machine-id.5 \
man/locale.conf.5 \
man/os-release.5 \
diff --git a/man/timezone.xml b/man/localtime.xml
similarity index 59%
rename from man/timezone.xml
rename to man/localtime.xml
index dedb7d9..09df161 100644
--- a/man/timezone.xml
+++ b/man/localtime.xml
@@ -7,6 +7,7 @@
This file is part of systemd.

Copyright 2010 Lennart Poettering
+ Copyright 2012 Shawn Landden

systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
@@ -22,9 +23,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->

-<refentry id="timezone">
+<refentry id="localtime">
<refentryinfo>
- <title>/etc/timezone</title>
+ <title>/etc/localtime</title>
<productname>systemd</productname>

<authorgroup>
@@ -34,38 +35,46 @@
<surname>Poettering</surname>
<email>***@poettering.net</email>
</author>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Shawn</firstname>
+ <surname>Landden</surname>
+ <email>***@gmail.com</email>
+ </author>
</authorgroup>
</refentryinfo>

<refmeta>
- <refentrytitle>timezone</refentrytitle>
+ <refentrytitle>localtime</refentrytitle>
<manvolnum>5</manvolnum>
</refmeta>

<refnamediv>
- <refname>timezone</refname>
+ <refname>localtime</refname>
<refpurpose>Local time zone configuration file</refpurpose>
</refnamediv>

<refsynopsisdiv>
- <para><filename>/etc/timezone</filename></para>
+ <para><filename>/etc/localtime</filename> -> <filename>/usr/share/zoneinfo/…</filename></para>
</refsynopsisdiv>

<refsect1>
<title>Description</title>

- <para>The <filename>/etc/timezone</filename> file
+ <para>The <filename>/etc/localtime</filename> file
configures the system-wide time zone of the local
system that is used by applications for presentation
- to the user. It should contain a single
- newline-terminated line consisting of a time zone
- identifier such as
- <literal>Europe/Berlin</literal>. The file
- <filename>/etc/localtime</filename> corresponds with
- <filename>/etc/timezone</filename> and contains the
- binary time zone data for the time zone. These files
- should always be changed simultaneously and kept in
- sync.</para>
+ to the user. It should be an absolute symbolic link
+ with a destination of <filename>/usr/share/zoneinfo/</filename>,
+ fallowed by a time zone identifier such as
+ <literal>Europe/Berlin</literal> or <literal>Etc/UTC</literal>.
+ The resulting link should point to the corresponding binary
+ <citerefentry><refentrytitle>tzfile</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ time zone data for the configured time zone.</para>
+
+ <para>As the time zone identifier is extracted from the name of
+ the target of <filename>/etc/localtime</filename> this file may
+ not be a normal file or hardlink.</para>

<para>The time zone may be overridden for individual
programs by using the TZ environment variable. See
@@ -73,16 +82,10 @@
</refsect1>

<refsect1>
- <title>History</title>
-
- <para>The simple configuration file format of
- <filename>/etc/timezone</filename> originates from
- Debian GNU/Linux.</para>
- </refsect1>
-
- <refsect1>
<title>See Also</title>
<para>
+ <citerefentry><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para>
</refsect1>
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
index 1944a71..dd3eb1b 100644
--- a/units/systemd-timedated.service.in
+++ b/units/systemd-timedated.service.in
@@ -7,7 +7,7 @@

[Unit]
Description=Time & Date Service
-Documentation=man:systemd-timedated.service(8) man:timezone(5)
+Documentation=man:systemd-timedated.service(8) man:localtime(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/timedated

[Service]
--
1.7.9.5
Shawn Landden
2012-08-11 22:22:47 UTC
Permalink
---
Makefile.am | 2 +-
man/{timezone.xml => localtime.xml} | 49 +++++++++++++++++++----------------
units/systemd-timedated.service.in | 2 +-
3 files changed, 28 insertions(+), 25 deletions(-)
rename man/{timezone.xml => localtime.xml} (59%)

diff --git a/Makefile.am b/Makefile.am
index 9062dd6..3422a75 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -468,7 +468,7 @@ MANPAGES = \
man/systemd.conf.5 \
man/tmpfiles.d.5 \
man/hostname.5 \
- man/timezone.5 \
+ man/localtime.5 \
man/machine-id.5 \
man/locale.conf.5 \
man/os-release.5 \
diff --git a/man/timezone.xml b/man/localtime.xml
similarity index 59%
rename from man/timezone.xml
rename to man/localtime.xml
index dedb7d9..09df161 100644
--- a/man/timezone.xml
+++ b/man/localtime.xml
@@ -7,6 +7,7 @@
This file is part of systemd.

Copyright 2010 Lennart Poettering
+ Copyright 2012 Shawn Landden

systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
@@ -22,9 +23,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->

-<refentry id="timezone">
+<refentry id="localtime">
<refentryinfo>
- <title>/etc/timezone</title>
+ <title>/etc/localtime</title>
<productname>systemd</productname>

<authorgroup>
@@ -34,38 +35,46 @@
<surname>Poettering</surname>
<email>***@poettering.net</email>
</author>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Shawn</firstname>
+ <surname>Landden</surname>
+ <email>***@gmail.com</email>
+ </author>
</authorgroup>
</refentryinfo>

<refmeta>
- <refentrytitle>timezone</refentrytitle>
+ <refentrytitle>localtime</refentrytitle>
<manvolnum>5</manvolnum>
</refmeta>

<refnamediv>
- <refname>timezone</refname>
+ <refname>localtime</refname>
<refpurpose>Local time zone configuration file</refpurpose>
</refnamediv>

<refsynopsisdiv>
- <para><filename>/etc/timezone</filename></para>
+ <para><filename>/etc/localtime</filename> -> <filename>/usr/share/zoneinfo/…</filename></para>
</refsynopsisdiv>

<refsect1>
<title>Description</title>

- <para>The <filename>/etc/timezone</filename> file
+ <para>The <filename>/etc/localtime</filename> file
configures the system-wide time zone of the local
system that is used by applications for presentation
- to the user. It should contain a single
- newline-terminated line consisting of a time zone
- identifier such as
- <literal>Europe/Berlin</literal>. The file
- <filename>/etc/localtime</filename> corresponds with
- <filename>/etc/timezone</filename> and contains the
- binary time zone data for the time zone. These files
- should always be changed simultaneously and kept in
- sync.</para>
+ to the user. It should be an absolute symbolic link
+ with a destination of <filename>/usr/share/zoneinfo/</filename>,
+ fallowed by a time zone identifier such as
+ <literal>Europe/Berlin</literal> or <literal>Etc/UTC</literal>.
+ The resulting link should point to the corresponding binary
+ <citerefentry><refentrytitle>tzfile</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ time zone data for the configured time zone.</para>
+
+ <para>As the time zone identifier is extracted from the name of
+ the target of <filename>/etc/localtime</filename> this file may
+ not be a normal file or hardlink.</para>

<para>The time zone may be overridden for individual
programs by using the TZ environment variable. See
@@ -73,16 +82,10 @@
</refsect1>

<refsect1>
- <title>History</title>
-
- <para>The simple configuration file format of
- <filename>/etc/timezone</filename> originates from
- Debian GNU/Linux.</para>
- </refsect1>
-
- <refsect1>
<title>See Also</title>
<para>
+ <citerefentry><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para>
</refsect1>
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
index 1944a71..dd3eb1b 100644
--- a/units/systemd-timedated.service.in
+++ b/units/systemd-timedated.service.in
@@ -7,7 +7,7 @@

[Unit]
Description=Time & Date Service
-Documentation=man:systemd-timedated.service(8) man:timezone(5)
+Documentation=man:systemd-timedated.service(8) man:localtime(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/timedated

[Service]
--
1.7.9.5
Lennart Poettering
2012-08-21 22:26:01 UTC
Permalink
Post by Shawn Landden
unlike symlink_or_copy_atomic(), this function creates a symlink even if the
oldname and newname (from and to) are on differn't
devices. (stat.st_dev)
Hmm, I am not sure I get this patch. Removing the "copy" bit from
symlink_or_copy_atomic() also makes the "atomic" bit of it unnecessary,
since creating symlinks is atomic anyway. Hence: why not invoke
symlink() directly?

(Sorry for the late review...)

Lennart
--
Lennart Poettering - Red Hat, Inc.
Shawn Landden
2012-08-22 06:09:03 UTC
Permalink
/etc/localtime -> /usr/share/zoneinfo/...

or

/etc/localtime -> ../usr/share/zoneinfo/...

(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())

keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Shawn Landden
2012-08-22 06:09:04 UTC
Permalink
---
Makefile.am | 2 +-
man/localtime.xml | 93 ++++++++++++++++++++++++++++++++++++
man/timezone.xml | 90 ----------------------------------
units/systemd-timedated.service.in | 2 +-
4 files changed, 95 insertions(+), 92 deletions(-)
create mode 100644 man/localtime.xml
delete mode 100644 man/timezone.xml

diff --git a/Makefile.am b/Makefile.am
index e6bfc1f..1996956 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -468,7 +468,7 @@ MANPAGES = \
man/systemd.conf.5 \
man/tmpfiles.d.5 \
man/hostname.5 \
- man/timezone.5 \
+ man/localtime.5 \
man/machine-id.5 \
man/locale.conf.5 \
man/os-release.5 \
diff --git a/man/localtime.xml b/man/localtime.xml
new file mode 100644
index 0000000..09df161
--- /dev/null
+++ b/man/localtime.xml
@@ -0,0 +1,93 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+ Copyright 2012 Shawn Landden
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="localtime">
+ <refentryinfo>
+ <title>/etc/localtime</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Lennart</firstname>
+ <surname>Poettering</surname>
+ <email>***@poettering.net</email>
+ </author>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Shawn</firstname>
+ <surname>Landden</surname>
+ <email>***@gmail.com</email>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>localtime</refentrytitle>
+ <manvolnum>5</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>localtime</refname>
+ <refpurpose>Local time zone configuration file</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <para><filename>/etc/localtime</filename> -> <filename>/usr/share/zoneinfo/…</filename></para>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>The <filename>/etc/localtime</filename> file
+ configures the system-wide time zone of the local
+ system that is used by applications for presentation
+ to the user. It should be an absolute symbolic link
+ with a destination of <filename>/usr/share/zoneinfo/</filename>,
+ fallowed by a time zone identifier such as
+ <literal>Europe/Berlin</literal> or <literal>Etc/UTC</literal>.
+ The resulting link should point to the corresponding binary
+ <citerefentry><refentrytitle>tzfile</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ time zone data for the configured time zone.</para>
+
+ <para>As the time zone identifier is extracted from the name of
+ the target of <filename>/etc/localtime</filename> this file may
+ not be a normal file or hardlink.</para>
+
+ <para>The time zone may be overridden for individual
+ programs by using the TZ environment variable. See
+ <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+ <para>
+ <citerefentry><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/timezone.xml b/man/timezone.xml
deleted file mode 100644
index dedb7d9..0000000
--- a/man/timezone.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-
-<refentry id="timezone">
- <refentryinfo>
- <title>/etc/timezone</title>
- <productname>systemd</productname>
-
- <authorgroup>
- <author>
- <contrib>Developer</contrib>
- <firstname>Lennart</firstname>
- <surname>Poettering</surname>
- <email>***@poettering.net</email>
- </author>
- </authorgroup>
- </refentryinfo>
-
- <refmeta>
- <refentrytitle>timezone</refentrytitle>
- <manvolnum>5</manvolnum>
- </refmeta>
-
- <refnamediv>
- <refname>timezone</refname>
- <refpurpose>Local time zone configuration file</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <para><filename>/etc/timezone</filename></para>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
-
- <para>The <filename>/etc/timezone</filename> file
- configures the system-wide time zone of the local
- system that is used by applications for presentation
- to the user. It should contain a single
- newline-terminated line consisting of a time zone
- identifier such as
- <literal>Europe/Berlin</literal>. The file
- <filename>/etc/localtime</filename> corresponds with
- <filename>/etc/timezone</filename> and contains the
- binary time zone data for the time zone. These files
- should always be changed simultaneously and kept in
- sync.</para>
-
- <para>The time zone may be overridden for individual
- programs by using the TZ environment variable. See
- <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
- </refsect1>
-
- <refsect1>
- <title>History</title>
-
- <para>The simple configuration file format of
- <filename>/etc/timezone</filename> originates from
- Debian GNU/Linux.</para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- </para>
- </refsect1>
-
-</refentry>
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
index 1944a71..dd3eb1b 100644
--- a/units/systemd-timedated.service.in
+++ b/units/systemd-timedated.service.in
@@ -7,7 +7,7 @@

[Unit]
Description=Time & Date Service
-Documentation=man:systemd-timedated.service(8) man:timezone(5)
+Documentation=man:systemd-timedated.service(8) man:localtime(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/timedated

[Service]
--
1.7.9.5
Shawn Landden
2012-08-22 06:11:26 UTC
Permalink
/etc/localtime -> /usr/share/zoneinfo/...

or

/etc/localtime -> ../usr/share/zoneinfo/...

(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())

keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Shawn Landden
2012-08-22 06:11:27 UTC
Permalink
---
Makefile.am | 2 +-
man/localtime.xml | 93 ++++++++++++++++++++++++++++++++++++
man/timezone.xml | 90 ----------------------------------
units/systemd-timedated.service.in | 2 +-
4 files changed, 95 insertions(+), 92 deletions(-)
create mode 100644 man/localtime.xml
delete mode 100644 man/timezone.xml

diff --git a/Makefile.am b/Makefile.am
index e6bfc1f..1996956 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -468,7 +468,7 @@ MANPAGES = \
man/systemd.conf.5 \
man/tmpfiles.d.5 \
man/hostname.5 \
- man/timezone.5 \
+ man/localtime.5 \
man/machine-id.5 \
man/locale.conf.5 \
man/os-release.5 \
diff --git a/man/localtime.xml b/man/localtime.xml
new file mode 100644
index 0000000..09df161
--- /dev/null
+++ b/man/localtime.xml
@@ -0,0 +1,93 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+ Copyright 2012 Shawn Landden
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="localtime">
+ <refentryinfo>
+ <title>/etc/localtime</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Lennart</firstname>
+ <surname>Poettering</surname>
+ <email>***@poettering.net</email>
+ </author>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Shawn</firstname>
+ <surname>Landden</surname>
+ <email>***@gmail.com</email>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>localtime</refentrytitle>
+ <manvolnum>5</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>localtime</refname>
+ <refpurpose>Local time zone configuration file</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <para><filename>/etc/localtime</filename> -> <filename>/usr/share/zoneinfo/…</filename></para>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>The <filename>/etc/localtime</filename> file
+ configures the system-wide time zone of the local
+ system that is used by applications for presentation
+ to the user. It should be an absolute symbolic link
+ with a destination of <filename>/usr/share/zoneinfo/</filename>,
+ fallowed by a time zone identifier such as
+ <literal>Europe/Berlin</literal> or <literal>Etc/UTC</literal>.
+ The resulting link should point to the corresponding binary
+ <citerefentry><refentrytitle>tzfile</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ time zone data for the configured time zone.</para>
+
+ <para>As the time zone identifier is extracted from the name of
+ the target of <filename>/etc/localtime</filename> this file may
+ not be a normal file or hardlink.</para>
+
+ <para>The time zone may be overridden for individual
+ programs by using the TZ environment variable. See
+ <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+ <para>
+ <citerefentry><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/timezone.xml b/man/timezone.xml
deleted file mode 100644
index dedb7d9..0000000
--- a/man/timezone.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-
-<refentry id="timezone">
- <refentryinfo>
- <title>/etc/timezone</title>
- <productname>systemd</productname>
-
- <authorgroup>
- <author>
- <contrib>Developer</contrib>
- <firstname>Lennart</firstname>
- <surname>Poettering</surname>
- <email>***@poettering.net</email>
- </author>
- </authorgroup>
- </refentryinfo>
-
- <refmeta>
- <refentrytitle>timezone</refentrytitle>
- <manvolnum>5</manvolnum>
- </refmeta>
-
- <refnamediv>
- <refname>timezone</refname>
- <refpurpose>Local time zone configuration file</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <para><filename>/etc/timezone</filename></para>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
-
- <para>The <filename>/etc/timezone</filename> file
- configures the system-wide time zone of the local
- system that is used by applications for presentation
- to the user. It should contain a single
- newline-terminated line consisting of a time zone
- identifier such as
- <literal>Europe/Berlin</literal>. The file
- <filename>/etc/localtime</filename> corresponds with
- <filename>/etc/timezone</filename> and contains the
- binary time zone data for the time zone. These files
- should always be changed simultaneously and kept in
- sync.</para>
-
- <para>The time zone may be overridden for individual
- programs by using the TZ environment variable. See
- <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
- </refsect1>
-
- <refsect1>
- <title>History</title>
-
- <para>The simple configuration file format of
- <filename>/etc/timezone</filename> originates from
- Debian GNU/Linux.</para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- </para>
- </refsect1>
-
-</refentry>
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
index 1944a71..dd3eb1b 100644
--- a/units/systemd-timedated.service.in
+++ b/units/systemd-timedated.service.in
@@ -7,7 +7,7 @@

[Unit]
Description=Time & Date Service
-Documentation=man:systemd-timedated.service(8) man:timezone(5)
+Documentation=man:systemd-timedated.service(8) man:localtime(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/timedated

[Service]
--
1.7.9.5
Lennart Poettering
2012-09-14 17:28:28 UTC
Permalink
On Tue, 21.08.12 23:11, Shawn Landden (***@gmail.com) wrote:

Applied both. Finally. Sorry for the delay.
Post by Shawn Landden
---
Makefile.am | 2 +-
man/localtime.xml | 93 ++++++++++++++++++++++++++++++++++++
man/timezone.xml | 90 ----------------------------------
units/systemd-timedated.service.in | 2 +-
4 files changed, 95 insertions(+), 92 deletions(-)
create mode 100644 man/localtime.xml
delete mode 100644 man/timezone.xml
diff --git a/Makefile.am b/Makefile.am
index e6bfc1f..1996956 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -468,7 +468,7 @@ MANPAGES = \
man/systemd.conf.5 \
man/tmpfiles.d.5 \
man/hostname.5 \
- man/timezone.5 \
+ man/localtime.5 \
man/machine-id.5 \
man/locale.conf.5 \
man/os-release.5 \
diff --git a/man/localtime.xml b/man/localtime.xml
new file mode 100644
index 0000000..09df161
--- /dev/null
+++ b/man/localtime.xml
@@ -0,0 +1,93 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+ Copyright 2012 Shawn Landden
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="localtime">
+ <refentryinfo>
+ <title>/etc/localtime</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Lennart</firstname>
+ <surname>Poettering</surname>
+ </author>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Shawn</firstname>
+ <surname>Landden</surname>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>localtime</refentrytitle>
+ <manvolnum>5</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>localtime</refname>
+ <refpurpose>Local time zone configuration file</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <para><filename>/etc/localtime</filename> -> <filename>/usr/share/zoneinfo/…</filename></para>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>The <filename>/etc/localtime</filename> file
+ configures the system-wide time zone of the local
+ system that is used by applications for presentation
+ to the user. It should be an absolute symbolic link
+ with a destination of <filename>/usr/share/zoneinfo/</filename>,
+ fallowed by a time zone identifier such as
+ <literal>Europe/Berlin</literal> or <literal>Etc/UTC</literal>.
+ The resulting link should point to the corresponding binary
+ <citerefentry><refentrytitle>tzfile</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ time zone data for the configured time zone.</para>
+
+ <para>As the time zone identifier is extracted from the name of
+ the target of <filename>/etc/localtime</filename> this file may
+ not be a normal file or hardlink.</para>
+
+ <para>The time zone may be overridden for individual
+ programs by using the TZ environment variable. See
+ <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+ <para>
+ <citerefentry><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/timezone.xml b/man/timezone.xml
deleted file mode 100644
index dedb7d9..0000000
--- a/man/timezone.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version='1.0'?> <!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-
-<refentry id="timezone">
- <refentryinfo>
- <title>/etc/timezone</title>
- <productname>systemd</productname>
-
- <authorgroup>
- <author>
- <contrib>Developer</contrib>
- <firstname>Lennart</firstname>
- <surname>Poettering</surname>
- </author>
- </authorgroup>
- </refentryinfo>
-
- <refmeta>
- <refentrytitle>timezone</refentrytitle>
- <manvolnum>5</manvolnum>
- </refmeta>
-
- <refnamediv>
- <refname>timezone</refname>
- <refpurpose>Local time zone configuration file</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <para><filename>/etc/timezone</filename></para>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
-
- <para>The <filename>/etc/timezone</filename> file
- configures the system-wide time zone of the local
- system that is used by applications for presentation
- to the user. It should contain a single
- newline-terminated line consisting of a time zone
- identifier such as
- <literal>Europe/Berlin</literal>. The file
- <filename>/etc/localtime</filename> corresponds with
- <filename>/etc/timezone</filename> and contains the
- binary time zone data for the time zone. These files
- should always be changed simultaneously and kept in
- sync.</para>
-
- <para>The time zone may be overridden for individual
- programs by using the TZ environment variable. See
- <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
- </refsect1>
-
- <refsect1>
- <title>History</title>
-
- <para>The simple configuration file format of
- <filename>/etc/timezone</filename> originates from
- Debian GNU/Linux.</para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
- <para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- </para>
- </refsect1>
-
-</refentry>
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
index 1944a71..dd3eb1b 100644
--- a/units/systemd-timedated.service.in
+++ b/units/systemd-timedated.service.in
@@ -7,7 +7,7 @@
[Unit]
Description=Time & Date Service
-Documentation=man:systemd-timedated.service(8) man:timezone(5)
+Documentation=man:systemd-timedated.service(8) man:localtime(5)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/timedated
[Service]
Lennart
--
Lennart Poettering - Red Hat, Inc.
Lennart Poettering
2012-09-14 18:46:12 UTC
Permalink
Post by Lennart Poettering
Applied both. Finally. Sorry for the delay.
So, after commiting this I thought a bit more about this and made a
couple of additional changes:

- I did introduce symlink_atomic() after all, since symlinks can't
otherwise be overwritten atomically this does make sense after
all. Sorry for the confusion about this earlier.

- I made handling of /etc/timezone a Debian-only thing now

- I changed the code generate a relative symlink rather than an absolute
one. People dealing with OS subtrees will like this

I am quite happy with the new state of affairs I must say.

Lennart
--
Lennart Poettering - Red Hat, Inc.
Frederic Crozat
2012-08-23 12:21:17 UTC
Permalink
@@ -218,19 +248,21 @@ static int write_data_timezone(void) {
return r;
}
- p = strappend("/usr/share/zoneinfo/", tz.zone);
+ p = strappend(ZONEINFO_PATH, tz.zone);
if (!p)
return log_oom();
- r = symlink_or_copy_atomic(p, "/etc/localtime");
+ r = symlink(p, "/etc/localtime");
free(p);
It doesn't work when /etc/localtime already exists, because symlink
returns EEXIST. I guess you should put back your symlink_atomic patch..
--
Frederic Crozat <***@suse.com>
SUSE
shawn
2012-08-24 16:35:35 UTC
Permalink
Post by Frederic Crozat
@@ -218,19 +248,21 @@ static int write_data_timezone(void) {
return r;
}
- p = strappend("/usr/share/zoneinfo/", tz.zone);
+ p = strappend(ZONEINFO_PATH, tz.zone);
if (!p)
return log_oom();
- r = symlink_or_copy_atomic(p, "/etc/localtime");
+ r = symlink(p, "/etc/localtime");
free(p);
It doesn't work when /etc/localtime already exists, because symlink
returns EEXIST. I guess you should put back your symlink_atomic patch..
yes, and the other errors like ENOTDIR and EACCESS and ENOENT that can
result from this action would all be after removing it, if using
symlink() directly with a remove, and not a atomic rename. There were
reasons I created symlink_atomic()...
--
-Shawn Landden
Shawn Landden
2012-08-11 23:37:35 UTC
Permalink
only syscalls set errno
Shawn Landden
2012-08-11 23:37:36 UTC
Permalink
From: Shawn Landen <***@gmail.com>

/etc/localtime -> /usr/share/zoneinfo/...

or

/etc/localtime -> ../usr/share/zoneinfo/...

(note, ../usr is not the same if /etc is a symlink, as this isn't
using canonicalize_file_name())

keep other method for now, consider dropping later.

Supporting relative links here are problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only supports absolute symlinks
"/usr/share/zoneinfo/" and relative symlinks starting with
"../usr/share/zoneinfo/"
Koen Kooi
2012-08-10 11:43:01 UTC
Permalink
Post by Lennart Poettering
Post by Shawn Landen
keep other method for now, consider dropping later.
Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
Hmm, I am not entirely sure this is really the best thing to do. Always
requiring a symlink for /etc/localtime breaks a couple of things: we
can't just bind mount things over in an nspawn container, embedded
devices have to ship /usr/share/zoneinfo/, which is probably something
they might want to avoid.
For the embedded systems that need TZ support I ship a subset of timezones, it's not that much data. If you're worried about the TZ sizes you shouldn't enable TZ support :)

regards,

Koen
Frederic Crozat
2012-08-14 09:20:27 UTC
Permalink
Post by Lennart Poettering
Post by Shawn Landen
keep other method for now, consider dropping later.
Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
Hmm, I am not entirely sure this is really the best thing to do. Always
requiring a symlink for /etc/localtime breaks a couple of things: we
can't just bind mount things over in an nspawn container, embedded
devices have to ship /usr/share/zoneinfo/, which is probably something
they might want to avoid.
So, dunno, I think this is something to think about first, discuss the
pros and cons. I see that just having this as symlink is much simpler,
no doubt, but does it have more benefits? And possibly more
disadvantages?
Well, I just found a major disavantage: openSUSE (and YaST) are not
using a symlink for /etc/localtime but a copy of the zoneinfo file (it
is probably coming from support of separate /usr, when mounting /usr
wasn't handled by initrd). So, this must be fixed to
support /etc/localtime being a copy, at least for reading informations
(currently, the code crashes, I'll see if I can fix it).
--
Frederic Crozat <***@suse.com>
SUSE
Frederic Crozat
2012-08-14 12:54:58 UTC
Permalink
Post by Frederic Crozat
Post by Lennart Poettering
Post by Shawn Landen
keep other method for now, consider dropping later.
Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
Hmm, I am not entirely sure this is really the best thing to do. Always
requiring a symlink for /etc/localtime breaks a couple of things: we
can't just bind mount things over in an nspawn container, embedded
devices have to ship /usr/share/zoneinfo/, which is probably something
they might want to avoid.
So, dunno, I think this is something to think about first, discuss the
pros and cons. I see that just having this as symlink is much simpler,
no doubt, but does it have more benefits? And possibly more
disadvantages?
Well, I just found a major disavantage: openSUSE (and YaST) are not
using a symlink for /etc/localtime but a copy of the zoneinfo file (it
is probably coming from support of separate /usr, when mounting /usr
wasn't handled by initrd). So, this must be fixed to
support /etc/localtime being a copy, at least for reading informations
(currently, the code crashes, I'll see if I can fix it).
After discussing with other SUSE fellows (bnc#773491), I'd say we should
just ignore when /etc/localtime is a hardlink (or a copy) to a timezone
data (since we don't have the name of the timezone in the file itself)
and use /etc/sysconfig/clock as fallback (when available). And when
updating timezone, /etc/localtime should be created as a symlink.
--
Frederic Crozat <***@suse.com>
SUSE
shawn
2012-08-14 17:12:38 UTC
Permalink
Post by Frederic Crozat
Post by Lennart Poettering
Post by Shawn Landen
keep other method for now, consider dropping later.
Supporting relative links here could be problematic as timezones in
/usr/share/zoneinfo are often themselves symlinks (and symlinks to
symlinks), so this implamentation only only support absolute links.
Hmm, I am not entirely sure this is really the best thing to do. Always
requiring a symlink for /etc/localtime breaks a couple of things: we
can't just bind mount things over in an nspawn container, embedded
devices have to ship /usr/share/zoneinfo/, which is probably something
they might want to avoid.
So, dunno, I think this is something to think about first, discuss the
pros and cons. I see that just having this as symlink is much simpler,
no doubt, but does it have more benefits? And possibly more
disadvantages?
Well, I just found a major disavantage: openSUSE (and YaST) are not
using a symlink for /etc/localtime but a copy of the zoneinfo file (it
is probably coming from support of separate /usr, when mounting /usr
wasn't handled by initrd). So, this must be fixed to
support /etc/localtime being a copy, at least for reading informations
(currently, the code crashes, I'll see if I can fix it).
This is because its trying to free() the initialized pointer t, after
readlink() returns EINVAL.
It just has to be initialized to NULL. I'll post a revised 2/3 in a sec.
Otherwise, its fallowing your recommendations. It is
creating /etc/localtime as an *absolute* too.
--
-Shawn Landden
Loading...