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  2021  2022  <20232024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: [Bug 2004463] Re: iocsh on vxWorks broken
From: Dirk Zimoch via Core-talk <core-talk at aps.anl.gov>
To: core-talk at aps.anl.gov
Date: Wed, 01 Feb 2023 09:27:00 -0000
The reason is in iocsh.cpp line 363:
        if (quote != EOF) {

Here, quote is 0xff but EOF is -1.

quote is initialized in line 265:
        char quote = EOF;

The problem is the usage of EOF in function split().

On any architecture, where char is unsigned  (e.g. VxWorks on PPC), the initialization 
        char quote = EOF;
sets quote to (char)-1 = 255.

Later, the comparison (quote != EOF) compares an unsigned char with the
signed int literal -1. Thus the unsigned char gets promoted to a signed
int with the same value 255 which is then then compared to -1. That is
of course not equal.

The possible fixes are:
1. use signed char quote
2. use int quote
3. use 0 instead of EOF

I prefer solution 3. The attached patch has been created with commit
60128ee but can be applied to the current HEAD (bc54524) as well.


** Patch added: "iocsh_fix_for_unsigned_char.patch"
   https://bugs.launchpad.net/epics-base/+bug/2004463/+attachment/5644257/+files/iocsh_fix_for_unsigned_char.patch

-- 
You received this bug notification because you are a member of EPICS
Core Developers, which is subscribed to EPICS Base.
Matching subscriptions: epics-core-list-subscription
https://bugs.launchpad.net/bugs/2004463

Title:
  iocsh on vxWorks broken

Status in EPICS Base:
  New

Bug description:
  Since commit 60128ee9 "Com: separate iocsh argument splitting", iocsh
  is broken on VxWorks (tested with version 6.9.4.12)

  Any command prints the error "Unbalanced quote."

  > iocsh
  epics> echo
  Unbalanced quote.
  epics> "echo"
  Unbalanced quote.
  epics> "echo
  Unbalanced quote.
  epics> echo bla
  Unbalanced quote.
  epics> echo 1 2 3
  Unbalanced quote.
  epics> exit
  Unbalanced quote.

  I have started investigating....

To manage notifications about this bug go to:
https://bugs.launchpad.net/epics-base/+bug/2004463/+subscriptions


References:
[Bug 2004463] [NEW] iocsh on vxWorks broken Dirk Zimoch via Core-talk

Navigate by Date:
Prev: [Bug 2004463] [NEW] iocsh on vxWorks broken Dirk Zimoch via Core-talk
Next: [Bug 2004463] Re: iocsh on vxWorks broken Dirk Zimoch 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  <20232024 
Navigate by Thread:
Prev: [Bug 2004463] [NEW] iocsh on vxWorks broken Dirk Zimoch via Core-talk
Next: [Bug 2004463] Re: iocsh on vxWorks broken Dirk Zimoch 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  <20232024 
ANJ, 01 Feb 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·