[fpc-pascal] fpc in symlinked directory

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Mar 26 13:15:04 CET 2014


On Wed, 26 Mar 2014 11:25:19 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:

>[...]
> > Keep in mind that /tmp/link/unit1.pas and /tmp/orig/uni1.pas must be
> > treated as two different files and within one project you must use
> > only one of them.
> 
> There you are wrong. They must be treated as the same file. 
> They ARE the same file, after all.

When a user tells a program to open file /tmp/link/unit1.pas,
he expects it to work with /tmp/link/unit1.pas
not /tmp/orig/unit1.pas. Almost all editors do that and so does Lazarus.

 
> That is why FPC resolves everything. 

Not true.
For example when I leave out the 'cd /tmp/link' and my cwd
is /home/mattias, then fpc creates the debugging info
"../../tmp/link/unit1.pas".


> /proc/self/cwd does the same: it resolves the directory.

This is the physical cwd.

 
> cadwal: >ls /proc/self/cwd -l
> lrwxrwxrwx 1 michael michael 0 Mar 26 11:18 /proc/self/cwd -> /tmp/src1/
> 
> So I still think that the FPC behaviour is the only correct behaviour.

What is incorrect with using the logical cwd?

 
> And likewise, I think that Lazarus is still wrong using relative paths.

AFAIK the only issue with symlinks are the '..', as this works on the
physical parent. There is no problem with a relative path like
'foo/bar'.
I don't see how absolute paths can work platform independently.
Relative paths are more readable.

Mattias



More information about the fpc-pascal mailing list