EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Strange warning from asSetFilename
From: Dirk Zimoch <[email protected]>
To: [email protected]
Date: Mon, 30 Sep 2013 09:20:02 +0200
To circumvent this problem, asSetFilename could prefix a relative path with its CWD at the time it is called. The users can then cd without invalidating the file path.

Dirk

On 27.09.2013 18:25, Andrew Johnson wrote:
Hi Michael,

On 09/27/2013 02:57 AM, [email protected] wrote:
In EPICS 3.14.12 I am rather surprised to see the following warning
generated by asSetFilename:

asSetFilename: Warning - relative paths won't usually work

Forgive me, but EPICS has no business making such judgements, and
seeing this message flags up a very nasty future possibility that I'd
like to forestall: no library ever has any business changing the
working directory, and if anybody is thinking of adding such code,
please don't!

I know this is only a warning: but it's not true, and it has no
business being true. So long as you avoid obvious mistakes, relative
paths will always work, so long as nobody calls chdir() without prior
agreement from the application.

The asSetFilename command is not called asLoadFile; it merely stores the
filename to be used for the access security rules file, but does /not/
cause the file to be loaded at the moment when the command is run. The
rules file will first be loaded during iocInit, and can subsequently be
reloaded at any time after that by the user running asInit from the
shell, or by processing a subroutine record that calls asSubProcess().
Thus if you give a relative path to asSetFilename it will be applied
relative to the CWD at the time the file gets loaded.

This warning therefore is not there because other libraries may change
the CWD, it's because a console user may run a cd command in the shell
at any time after iocInit. VxWorks and RTEMS only have a single CWD
which is shared by all threads — does anyone know if that is true of
Linux and/or Windows as well? Can you guarantee that they/you will never
leave the IOC's CWD pointing to somewhere other than where the developer
was expecting it to be (and is that the iocBoot/iocXxx startup
directory, or some other location?).

The consequences of a failure when reloading the access security rules
file is that the IOC turns off both read and write access to *all* PVs,
which is pretty drastic but when this system was designed it was felt
that this could be an indication that someone is trying to break into
the system.

Thus giving asSetFilename a relative path results in unintuitive
behaviour, and could easily result in your control system shutting down.
Do you still think we should remove the warning message? If you have
suggestions for improvements in the text I will be happy to hear them,
but I don't think it's possible to condense the above description into
anything meaningful.

The Application Developers Guide does talk about this in 8.3.6
http://www.aps.anl.gov/epics/base/R3-14/12-docs/AppDevGuide/node9.html#SECTION00936000000000000000


- Andrew


References:
Strange warning from asSetFilename michael.abbott
Re: Strange warning from asSetFilename Andrew Johnson

Navigate by Date:
Prev: Re: Strange warning from asSetFilename Michael Abbott
Next: Text in EDM Michael Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Strange warning from asSetFilename Michael Abbott
Next: MEDM -cmap Switch Poff, Mark A
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·