-----Original Message----- From: Paul Eggert [mailto:eggert@twinsun.com] Sent: Thursday, March 14, 2002 7:19 PM To: Olson, Arthur David (NCI) Cc: tz@elsie.nci.nih.gov Subject: Re: symlinks
Unfortunately that code won't work if toname is of the form FOO/BAR, where FOO is a symbolic link to some other place in the filesystem.
The simplest fix is to remove the HAVE_SYMLINK code entirely, and to fail if the hard-link call fails. It's one less thing to configure in Makefile and in private.h. But if you want to support situations where hard links don't work, I think it would be simpler and more portable to make a copy instead of a link.
Checking the legislative history, I discovered that the item attached below is what got the symlink ball rolling. What I'm after is something that handles such real-world cases correctly; I'm willing to let non-real-world cases slide. --ado
From OLSONA@dc37a.nci.nih.gov Sat Jan 17 14:32:28 1998 Return-Path: <OLSONA@dc37a.nci.nih.gov> Received: from imc.nih.gov by elsie.nci.nih.gov (4.1/SMI-4.1) id AA06211; Sat, 17 Jan 98 14:32:28 EST Message-Id: <9801171932.AA06211@elsie.nci.nih.gov> Received: by imc.nih.gov with Internet Mail Service (5.0.1458.49) id <DCQ5RJ2X>; Sat, 17 Jan 1998 14:32:17 -0500 From: "Olson, Arthur David" <OLSONA@dc37a.nci.nih.gov> To: 'tz' <tz@elsie.nci.nih.gov>, "'aj@arthur.rhein-neckar.de'" <aj@arthur.rhein-neckar.de> Subject: FW: zic using hardlinks:-( Date: Sat, 17 Jan 1998 14:31:18 -0500 X-Priority: 3 X-Mailer: Internet Mail Service (5.0.1458.49) Status: RO
Andreas Jaeger is not on the time zone list; be sure to include Andreas in any reply. --ado ---------- From: Andreas Jaeger[SMTP:aj@arthur.rhein-neckar.de] Sent: Thursday, January 15, 1998 3:34 PM To: tz@elsie.nci.nih.gov Subject: zic using hardlinks:-( Hi, I received the following bug report for GNU libc. Jochen says that using a hard link doesn't work for his system since /etc and /usr/share are on different filesystems. zic is from tzcode1997h. I see three possibilities: - changing the link call in zic.c to symlink. - if link fails with error EXDEV (oldpath and newpath are not on the same filesystem) retry with a symlink. - leave it the way it is. Should symbolic links used in general or only for localtime? Andreas -- Andreas Jaeger aj@arthur.rhein-neckar.de
Number: 413 Category: libc Synopsis: `zic -l' tries to hard link a file between different disk partitions Confidential: no Severity: non-critical Priority: low Responsible: libc-gnats State: open Class: sw-bug Submitter-Id: unknown Arrival-Date: Thu Jan 15 07:32:17 EST 1998 Last-Modified: Originator: Jochen Voss Organization: Department of Mathematics, University of Kaiserslautern/Germany Release: libc-2.0.6 Environment: Host type: i486-pc-linux-gnu System: Linux tatonka 2.0.33 #2 Fri Jan 9 20:20:45 MET 1998 i486 Architecture: i486
Addons: localedata crypt linuxthreads Build CFLAGS: -O3 -m486 -fomit-frame-pointer Build CC: gcc -B$(common-objpfx) Build shared: yes Build profile: no Build omitfp: no Stdio: libio
Description: The command "zic -l MET" should set the local time zone by linking the file "/usr/share/zoneinfo/MET" to "/etc/localtime". It uses a hard link for this purpose. On my system this fails, because the directories "/etc" and "/usr/share/zoneinfo" are located on different disk partitions on my system. This results in the output
zic: Kann nicht von /usr/share/zoneinfo/MET nach /etc/localtime linken: Ungltiger Link ber Gertegrenzen hinweg when I execaute the above command (obviously I use `LANG=de').
How-To-Repeat: Find a system, which uses disk partitions as described above, and execute the command "zic -l MET". Fix: Modify the code in "time/zic.c" to use symlinks (if available) or to copy the file if the hard link fails. Audit-Trail: Unformatted: