Hi Ralph,
On Apr 14, 2021, at 11:13 AM, Ralph Lange via Core-talk <core-talk at aps.anl.gov> wrote:
>
> AppData is one of quite a few standard Windows variables. Obviously, introducing my own variables would work and make the whole thing non-portable.
>
> The getenv() call works just fine, mixed paths work fine, I can read directly from the environment and have utilities that convert forward to backslashes etc etc.
> The one and only real show stopper is that the iocShell's macro expansion changes the value of those standard environment variables when you use them.
Even epicsEnvSet preserves back-slashes in the values it sets. The macLib routines are supposed to preserve strings inside single quotes, but then they don’t expand the macros inside. I just experimented with various ways of quoting stuff, but that doesn’t seem to help at all:
> epics> epicsEnvShow APPDATA
> APPDATA=C:\Users\jenkins\AppData\Roaming
> epics> echo $(APPDATA)
> C:UsersjenkinsAppDataRoaming
> epics> echo "$(APPDATA)”
> C:UsersjenkinsAppDataRoaming
> epics> echo '$(APPDATA)'
> $(APPDATA)
> epics> epicsEnvSet q "'"
> epics> epicsEnvShow q
> q='
> epics> echo $(q)$(APPDATA)$(q)
> C:UsersjenkinsAppDataRoaming
> epics> echo "$(q)$(APPDATA)$(q)"
> C:UsersjenkinsAppDataRoaming
> epics> epicsEnvSet eq "\'"
> epics> epicsEnvShow eq
> eq=\'
> epics> echo "$(eq)$(APPDATA)$(eq)"
> 'C:UsersjenkinsAppDataRoaming'
> epics> epicsEnvSet d '"'
> epics> epicsEnvShow d
> d="
> epics> echo "$(d)$(APPDATA)$(d)"
> C:UsersjenkinsAppDataRoaming
> epics> epicsEnvSet b "\"
> epics> epicsEnvShow b
> b=\
> epics> echo "$(b)$(APPDATA)$(b)"
> C:UsersjenkinsAppDataRoaming
> epics> epicsEnvSet bb "\\"
> epics> epicsEnvShow bb
> bb=\\
> epics> echo "$(bb)$(APPDATA)$(bb)"
> C:UsersjenkinsAppDataRoaming
> epics> epicsEnvSet bbb "\\\"
> epics> epicsEnvShow bbb
> bbb=\\\
> epics> echo "$(bbb)$(APPDATA)$(bbb)"
> \C:UsersjenkinsAppDataRoaming\
> epics> epicsEnvSet ed '\"'
> epics> epicsEnvShow ed
> ed=\"
> epics> echo "$(ed)$(APPDATA)$(ed)"
> C:UsersjenkinsAppDataRoaming
> epics> epicsEnvSet eeq "\\'"
> epics> epicsEnvShow eeq
> eeq=\\'
> epics> echo "$(eeq)$(APPDATA)$(eeq)"
> C:UsersjenkinsAppDataRoaming
> epics> epicsEnvSet eeeq "\\\'"
> epics> epicsEnvShow eeeq
> eeeq=\\\'
> epics> echo "$(eeeq)$(APPDATA)$(eeeq)"
> 'C:UsersjenkinsAppDataRoaming’
> epics> epicsEnvSet eed '\\"'
> epics> epicsEnvShow eed
> eed=\\"
> epics> echo "$(eed)$(APPDATA)$(eed)"
> C:UsersjenkinsAppDataRoaming
> epics> epicsEnvSet eeed '\\\"'
> epics> epicsEnvShow eeed
> eeed=\\\"
> epics> echo "$(eeed)$(APPDATA)$(eeed)"
> Unbalanced quote.
That last error (from iocsh, not macLib) is interesting, but probably not useful.
Do we need some syntax in macros to prevent them from escaping back-slashes when expanding values? I’m not sure how easy it would be to implement that, but it might be possible. Any other suggestions on what might be changed?
- Andrew
--
Complexity comes for free, simplicity you have to work for.
- Replies:
- Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- References:
- Windows paths inside iocShell Ralph Lange via Core-talk
- Re: [EXTERNAL] Windows paths inside iocShell Kasemir, Kay via Core-talk
- Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Navigate by Date:
- Prev:
Build failed in Jenkins: epics-example-win64 #664 APS Jenkins via Core-talk
- Next:
Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Index:
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: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Next:
Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|