Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Feb 2012 07:17:29 GMT
From:      "dteske@vicor.com" <Devin.Teske@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/164976: [PATCH] tzsetup(8): Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option
Message-ID:  <201202110717.q1B7HTZn083181@red.freebsd.org>
Resent-Message-ID: <201202110720.q1B7K6UO049142@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 11 07:20:06 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     dteske@vicor.com
>Release:        9.0-RELEASE
>Organization:
FIS Global, Inc.
>Environment:
FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012
root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
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.
>How-To-Repeat:
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.
>Fix:
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
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
 #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);
 #endif
 			return (DITEM_LEAVE_MENU);
 		}


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202110717.q1B7HTZn083181>