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: [Bug 1940283] Re: Misleading Error: Invalid character '"'
From: Andrew Johnson via Core-talk <core-talk at aps.anl.gov>
To: core-talk at aps.anl.gov
Date: Tue, 17 Aug 2021 18:20:41 -0000
This change

diff --git a/modules/database/src/ioc/dbStatic/dbLex.l b/modules/database/src/ioc/dbStatic/dbLex.l
index 33185133c..19812c9da 100644
--- a/modules/database/src/ioc/dbStatic/dbLex.l
+++ b/modules/database/src/ioc/dbStatic/dbLex.l
@@ -130,6 +130,14 @@ static int yyreset(void)
 
 <INITIAL,JSON>{whitespace}  ;
 
+<JSON>{doublequote}({stringchar}|{escape})*{doublequote} { /* bad JSON */
+    yyerrorAbort("Bad character in JSON string");
+}
+
+<JSON>{singlequote}({stringchar}|{escape})*{singlequote} { /* bad JSON */
+    yyerrorAbort("Bad character in JSON string");
+}
+
 <INITIAL,JSON>. {
     char message[40];
     YY_BUFFER_STATE *dummy=0;

results in this error message:

woz$ softIoc -d ~/db/test.db 
Error: Bad character in JSON string
 at or before ""a	b"" in file "/Users/anj/db/test.db" line 5
Error: Invalid character ')'
Error: syntax error
dbLoadRecords: failed to load '/Users/anj/db/test.db'
Error: Failed to load: /Users/anj/db/test.db

which is better, although not perfect because of the messages
afterwards. Instead of just calling yyerrorAbort() it could take a look
at the string (found in yytext) and explain what's wrong with it.
Contributions welcomed...

-- 
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/1940283

Title:
  Misleading Error: Invalid character '"'

Status in EPICS Base:
  New

Bug description:
  When using a tab character in a field, EPICS 7 prints a misleading
  error message, not hinting at the tab but at the closing(?) quote.

  Example 1:  field(DESC,  "a	b")
  Example 2:  info(TAB,  "a	b")

  Error: Invalid character '"'
   at or before """ in path "."  file "..." line ...

  
  BTW: Is there a reason why I cannot use a tab in my (info) fields?

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


References:
[Bug 1940283] [NEW] Misleading Error: Invalid character '"' Dirk Zimoch via Core-talk

Navigate by Date:
Prev: [Bug 1940283] Re: Misleading Error: Invalid character '"' Andrew Johnson via Core-talk
Next: [Bug 1940283] Re: Misleading Error: Invalid character '"' 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  <20212022  2023  2024 
Navigate by Thread:
Prev: [Bug 1940283] Re: Misleading Error: Invalid character '"' Andrew Johnson via Core-talk
Next: [Bug 1940283] Re: Misleading Error: Invalid character '"' 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  <20212022  2023  2024 
ANJ, 17 Aug 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·