EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: [EXTERNAL] Windows paths inside iocShell
From: Ralph Lange via Core-talk <core-talk at aps.anl.gov>
To: EPICS Core Talk <core-talk at aps.anl.gov>
Date: Wed, 14 Apr 2021 19:32:47 +0200
Hi Andrew,

On Wed, 14 Apr 2021 at 18:56, Johnson, Andrew N. <anj at anl.gov> wrote:
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> 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?

Looking at the macLib code, I was getting the _expression_ that the original intention might have been to do it right.
    /* discard quotes and escapes if level is > 0 (i.e. if these aren't
       the user's quotes and escapes) */

Or not? (Shouldn't quotes and escapes only be discarded when they are the user's, and kept through replacements?)
Well, at least there was an intention.

What if using a variable wouldn't change its content? After the second line, I would expect PP and QQ to be the same.
epics> epicsEnvSet PP a\\b\\c
epics> epicsEnvSet QQ $(PP)
epics> epicsEnvShow
[...]
PP=a\b\c
QQ=abc

We could maybe add another bracket character pair for verbatim usage.
epics> echo $[eeed]

I am afraid that changing the current behaviour - even if it was "correcting" it - would add a pretty high risk of breaking things for users.

Cheers,
~Ralph


Replies:
Re: [EXTERNAL] Windows paths inside iocShell Johnson, Andrew N. 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
Re: [EXTERNAL] Windows paths inside iocShell Johnson, Andrew N. via Core-talk

Navigate by Date:
Prev: Re: [EXTERNAL] Windows paths inside iocShell Johnson, Andrew N. via Core-talk
Next: Re: [EXTERNAL] Windows paths inside iocShell Johnson, Andrew N. via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: Re: [EXTERNAL] Windows paths inside iocShell Johnson, Andrew N. via Core-talk
Next: Re: [EXTERNAL] Windows paths inside iocShell Johnson, Andrew N. via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 14 Apr 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·