Experimental Physics and Industrial Control System
Hi Andrew & Mark,
Thanks for the suggestions. They both look potentially very helpful.
On Fri, 7 Sep 2012 10:47:48 -0500
Andrew Johnson <[email protected]> wrote:
> As to your patch, it looks reasonable, but I wonder what abs_path() is doing
> that rel2abs() isn't? Is it working around an automounter issue, or are you
> using soft links?
The issue is that rel2abs() specifically doesn't make any filesystem
checks, so does not expand /../ inside paths. ie, for a path like:
$(TOP)/../../base
Expand TOP and you might get:
/path/to/epics/modules/somemodule/../../base
The simple case is this path is equal to:
/path/to/epics/base/
... but if there's a symlink in the chain somewhere it might not, so
the only way to expand it safely is to check the
filesystem, which rel2abs can't do.
On the other hand, if the path exists (the -e check), then we can
safely call abs_path() which will collapse the /../ elements and give
us a canonical path to the actual element.
I didn't call abs_path() for non-existent files for the same reason as
the warning in the comment above EPICS::AbsPath(), which is that it
will return undef if any of the path elements before the last one are
non-existent.
(You'd think path canonicalisation would be simple, wouldn't you!)
Cheers,
Angus
>
> > Index: base/src/tools/EPICS/Path.pm
> > ===================================================================
> > --- base/src/tools/EPICS/Path.pm (revision 1268)
> > +++ base/src/tools/EPICS/Path.pm (revision 1269)
> > @@ -123,6 +123,9 @@
> >
> > # Now calculate the absolute path
> > my $abs = File::Spec->rel2abs($path, abs_path($cwd));
> > + if (-e $abs) {
> > + $abs = abs_path($abs);
> > + }
> >
> > return LocalPath($abs);
> > }
>
> - Andrew
> --
> Never interrupt your enemy when he is making a mistake.
> -- Napoleon Bonaparte
--
Angus Gratton, Computer Control Specialist
ANU Department of Nuclear Physics
(02) 6125 2091
- References:
- EPICS build system, RELEASE file, and relative paths Angus Gratton
- Re: EPICS build system, RELEASE file, and relative paths Andrew Johnson
- Navigate by Date:
- Prev:
Re: Epics driver using BLT or CBLT to read FIFO wanted Michael Davidsaver
- Next:
Doubt regarding standards followed by EPICS manta santosh aditya santosh_aditya
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: EPICS build system, RELEASE file, and relative paths Andrew Johnson
- Next:
sequencer release 2.1.10 Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024