misc/164976: [PATCH] tzsetup(8): Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option

dteske at vicor.com Devin.Teske at FreeBSD.org
Sat Feb 11 07:20:08 UTC 2012

>Number:         164976
>Category:       misc
>Synopsis:       [PATCH] tzsetup(8): Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 11 07:20:06 UTC 2012
>Originator:     dteske at vicor.com
>Release:        9.0-RELEASE
FIS Global, Inc.
FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012
root at obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
In SVN 230299, the hunk at line 702 (r230299) is incomplete (shown below):

705 +#ifdef VERBOSE
706 +                        snprintf(prompt, sizeof(prompt),
707 +                            "Removed %s", path_localtime);
708 +#endif
709                          return (DITEM_LEAVE_MENU);

Two issues:
1. prompt is assigned a value but then not used (evident by the return which occurs after assignment).
2. prompt is not global in nature and thus the value is lost upon return.

Attached patch.txt:
1. Adds code to utilize the assigned value.
Compiled with VERBOSE and select the "UTC" menu option. Before this patch, you are not informed that /etc/localtime was unlink(2)ed. This is inconsistent with selecting other options (informs you that you have created a symlink or copied a zonefile). After this patch, selecting the UTC option informs you that /etc/localtime was removed.
See attached patch.txt.

Patch attached with submission follows:

--- src/usr.sbin/tzsetup/tzsetup.c.orig	Tue Feb  7 21:03:04 2012
+++ src/usr.sbin/tzsetup/tzsetup.c	Fri Feb 10 22:59:18 2012
@@ -703,8 +703,13 @@ install_zoneinfo_file(const char *zonein
 #ifdef VERBOSE
+			snprintf(title, sizeof(title), "Done");
 			snprintf(prompt, sizeof(prompt),
 			    "Removed %s", path_localtime);
+			if (usedialog)
+				dialog_msgbox(title, prompt, 8, 72, 1);
+			else
+				fprintf(stderr, "%s\n", prompt);
 			return (DITEM_LEAVE_MENU);


More information about the freebsd-bugs mailing list