This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

typo in timezone/zic.c update from tzcode2005c


The zic.c cleanup of the linking fallback code in the dolink() function introduces a typo in the fallback option. If the hardlink fails, it builds up paths for the symlink which are not complete. Basically, the code uses fromfile instead of fromname when building the target of the symlink. This creates a dangling symlink. For example, if TZDIR/directory = "/usr/share/zoneinfo" and the toname = /etc/localtime, then the symlink created for localtime with this code would point to ../America/New_York since "America/New_York" is the fromfile, whereas it should have used fromname (directory+fromfile) to create a symlink to ../usr/share/zoneinfo/America/New_York

The attached patch resolves this typo and fixes the problem. The source of the issue can be seen in a diff from zic.c 1.17 to 1.18 in glibc cvs, noted as the update to tzcode2005c. Since this appears to be a direct result of updating to that code, maybe there is something I am missing; but from what I understand, using `zic -l America/New_York` should create a proper symlink at /etc/localtime if hardlinking fails (such as /etc and /usr being on different physical media). In my case this produces a dangling symlink.

Thanks,
Phil Estes
pestes@us.ibm.com
diff -Naur glibc-2.3.orig/timezone/zic.c glibc-2.3/timezone/zic.c
--- glibc-2.3.orig/timezone/zic.c	2005-11-30 15:58:57.000000000 -0500
+++ glibc-2.3/timezone/zic.c	2005-11-30 15:59:17.000000000 -0500
@@ -650,7 +650,7 @@
 						"../");
 					symlinkcontents =
 						ecatalloc(symlinkcontents,
-						fromfile);
+						fromname);
 					result = symlink(symlinkcontents,
 						toname);
 					if (result == 0)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]