>Number: 164039
>Category: bin
>Synopsis: [PATCH] tzsetup(8): Don't write /var/db/zoneinfo either when
>"-n" is passed or when install_zoneinfo_file returns failure
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Jan 12 05:00:26 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Devin Teske
>Release: FreeBSD 9.0-RELEASE amd64
>Organization:
FIS Global, Inc.
>Environment:
FreeBSD scribe.vicor.com 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30
UTC 2010
[email protected]:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
The "-n" flag is described in tzsetup(8) as "Do not create or copy files," so
it seems like a bug that /var/db/zoneinfo is created without regard to this
flag's presence.
Additionally, since SVN r198350 -- where install_zone_file() was split into
install_zoneinfo_file()/install_zoneinfo() -- the /var/db/zoneinfo file is
written without regard to whether the zoneinfo file was successfully installed
or not.
The attached patch.txt makes it so that /var/db/zoneinfo is only written if (a)
a zoneinfo file was successfully installed (install_zoneinfo_file returns
success) and (b) the "-n" flag is not present.
>How-To-Repeat:
Exec as root: tzsetup some/foo
Notice that /var/db/zoneinfo contains "some/foo" despite given failure to
install any zonefile by that name.
Similarly, exec as root: tzsetup -n America/Los_Angeles
Notice that /var/db/zoneinfo contains "America/Los_Angeles"
>Fix:
See attached patch.txt
Patch attached with submission follows:
--- usr.sbin/tzsetup/tzsetup.c.orig Fri Dec 2 11:19:10 2011
+++ usr.sbin/tzsetup/tzsetup.c Wed Jan 11 20:12:54 2012
@@ -801,9 +801,11 @@ install_zoneinfo(const char *zoneinfo)
rv = install_zoneinfo_file(path_zoneinfo_file);
/* Save knowledge for later */
- if ((f = fopen(path_db, "w")) != NULL) {
- fprintf(f, "%s\n", zoneinfo);
- fclose(f);
+ if (reallydoit && (rv & DITEM_FAILURE) == 0) {
+ if (f = fopen(path_db, "w")) != NULL) {
+ fprintf(f, "%s\n", zoneinfo);
+ fclose(f);
+ }
}
return (rv);
>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"