Mail Archives: djgpp-workers/1999/11/14/09:33:30
Eli Zaretskii wrote:
> Are getwd and getcwd documented somewhere to return the symlink name,
> rather than the actual directory name? If not, perhaps we are better off
> without recording the symlink in some hidden variable?
It's up to implementation. If we do or do not do that we got following
difference, as pointed out by Alain when we discussed it earlier:
--------
When you say chdir() should be adjust, how ? see two different
behaviours below (Solaris vs GNU/Linux) of chdir() :
# uname -sr
SunOS 5.5.1
# cd /tmp
# mkdir -p Me/You/Him
# cd Me
# ln -s You/Him Her
# ls -l
total 32
lrwxrwxrwx 1 alainm vlsi 7 ao?t 24 10:05 Her -> You/Him/
drwxr-xr-x 3 alainm vlsi 105 ao?t 24 10:05 You/
# cd Her
# pwd
/tmp/Me/You/Him
# cd ..
# pwd
/tmp/Me/You
$ uname -rs
Linux 2.2.5-15
$ cd /tmp
tmp]$ mkdir -p Me/You/Him
tmp]$ cd Me
$ ln -s You/Him Her
$ ls -l
total 1
lrwxrwxrwx 1 alain techies 7 Aug 24 10:14 Her -> You/Him
drwxr-xr-x 3 alain techies 1024 Aug 24 10:13 You
$ pwd
/tmp/Me
$ cd Her
$ pwd
/tmp/Me/Her
$ cd ..
$ pwd
/tmp/Me
----------
I just chose GNUish way; I like it and it wasn't very hard to
implement. To be bulletproof, I also record the real name of
directory - if it does not match with what DOS call returns, do
not return symlink.
> As for the format of the symlink file: is it a good idea to use the SYS
> attribute? Such files will not be shown by DIR and other DOS/Windows
> commands, some archivers might skip them, etc. Perhaps it is better to
> make the symlinks be of some specific size?
I wanted to make symlinks have a rare combination of attributtes (currently
read only + system _but not_ hidden) because that would result in smaller
perfomance penalty - currently in most cases only one additional attributte
check is performed on file if it's not a symlink. IMHO, if DOS/Windows
non-DJGPP and non-CygWin applications do not see them, that's not a big
problem - they won't know what to do with symlinks anyway.
And, BTW, current format is compatible with CygWin's symlinks.
Laurynas Biveinis
- Raw text -