[fpc-pascal] fpc in symlinked directory
Mattias Gaertner
nc-gaertnma at netcologne.de
Wed Mar 26 15:20:47 CET 2014
On Wed, 26 Mar 2014 14:31:19 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:
>[...]
> > What problem do they have? /tmp/link is a valid file name.
>
> Only because it is a full path. Then it doesn't matter whether you resolve or not.
>
> But things like ../link may end up wildly on wildly different places depending
> on whether the start path is logical or physical.
>
> Example:
>
> /home/michael/projects/lazarus/lazarus.lpi
> /home/michael/lazarus -> /home/michael/projects/lazarus
Note: Two different lazarus directories should use two different config
directories, because the config directory also contains absolute file
names.
> /home/michael/packages/synapse/laz_synapse.lpk
>
> If I open
> /home/michael/projects/lazarus/lazarus.lpi
> then the path to laz_synapse is
> ../../../synapse/laz_synapse
>
> If I open
> /home/michael/lazarus/lazarus.lpi
> then the path to laz_synapse is (omitting the units/platform for simplicity)
> ../../synapse/laz_synapse
>
> Specifying the latter to the compiler fails, because the compiler uses physical paths.
When does Lazarus pass '../../synapse/laz_synapse' to the
compiler?
>[...]
> > Just add a syntax error to unit1.pas and compile once in /tmp/link and
> > once outside. You see once the physical directory and once the
> > logical.
>
> So ? You just need to check the inode.
Is there a function to list all files pointing to an inode?
> >> and the OS do the same.
> >
> > The problem is the following:
> > The user opens /tmp/link/project1.lpr in the source editor and runs
> > it. When there is a syntax error or when the debugger stops they report
> > a source file name '/tmp/orig/unit1.pas' and the user wonders why.
> > The IDE automatically opens the file '/tmp/orig/unit1.pas', but since
> > it shows in the tab only the 'unit1.pas' the user may confuse that
> > with the right file.
>
> ? it IS the right file. It is the SAME file, after all.
We could make a poll. I guess the majority expects that when the
IDE compiles /tmp/link/project1.pas then it should
work with /tmp/link/uni1.pas, not /somewhereelse/unit1.pas.
>[...]
> > For instance:
> > One include file used in different contexts. Depending on its file
> > name different units use it and parse it differently. FPC reports the
> > logical file name on an error and so the IDE knows the right context.
> > The IDE opens the file two times and with different settings.
>
> Which IMHO is totally misplaced behaviour.
Yes, and still: some people do that.
> Lazarus sometimes tries to be too clever. This is one of these times...
Actually the symlink solution is a workaround for Lazarus not being so
clever.
Mattias
More information about the fpc-pascal
mailing list