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
--
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock
- Replies:
- Re: Strange warning from asSetFilename Michael Abbott
- Re: Strange warning from asSetFilename Dirk Zimoch
- References:
- Strange warning from asSetFilename michael.abbott
- Navigate by Date:
- Prev:
Re: agenda for the EPICS users' meeting pthomas
- Next:
Re: MEDM -cmap Switch Andrew Johnson
- 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:
Strange warning from asSetFilename michael.abbott
- Next:
Re: Strange warning from asSetFilename Michael Abbott
- 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
|