Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nonsense code causes infinite regress in error reports #37739

Closed
jamesp670 opened this issue Jul 10, 2020 · 1 comment
Closed

nonsense code causes infinite regress in error reports #37739

jamesp670 opened this issue Jul 10, 2020 · 1 comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Modeller Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@jamesp670
Copy link

jamesp670 commented Jul 10, 2020

Describe the bug

When I type totally bogus code into the field calculator, I get an infinite number of error messages.

How to Reproduce

This is just like my bug #37737

  1. Go to Processing/Graphical Modeler
  2. Click on Algorithms. Search "field ca". Double click Vector table/Field calculator.
  3. Configure the calculator to make a new attribute, called 'snam2'.
  4. Configure the calculator to have a totally rediculous formula. I used ' 5/0 + dkdkdkd and his is this -'.
  5. Run the model.

What I expect: immediate syntax error, model will never execute, marked as invalid syntax in the XML, big red X on the screen when it's open in the graphical modeler, all because the formula '5/0 + dkdkdkd and his is this -' is not parsable by any rational computer language including the qgis one. Errors in parsing like this, 'syntax errors', can be easily detected by running the code through the parser: especially the inclusion of the '-' on the end without the second argument to the minus operator is detectable. Probably also the other words appearing in positions where keywords would be expected and aren't. And - what language allows a random long rambling sequence of keywords (or variables for that matter) like 'dkdkdkd and his is this'? Not SQL certainly, which I think is what this language is trying to implement: SQL has a very strict sequence of words that must appear in order.

What I get instead:

Unlike my 37737 bug, this one is caught when the code is run. However, it's caught too many times. In fact I get:

"OK. Execution took 19.039 s (1 outputs).
Prepare algorithm: qgis:fieldcalculator_1
Running Field calculator [2/2]
Input Parameters:
{ FIELD_LENGTH: 10, FIELD_NAME: 'snam2', FIELD_PRECISION: 3, FIELD_TYPE: 0, FORMULA: '5/0 + dkdkdkd and his is this -', INPUT: 'memory://MultiLineString?crs=USER:100000&field=fid:long(0,0)&field=cat:integer(0,0)&field=length:double(0,0)&field=localid:integer(0,0)&field=zero:integer(0,0)&field=prefix:string(14,0)&field=streetname:string(50,0)&field=ftype:string(13,0)&field=leftadd1:integer(0,0)&field=leftadd2:integer(0,0)&field=rgtadd1:integer(0,0)&field=rgtadd2:integer(0,0)&field=leftzip:integer(0,0)&field=rightzip:integer(0,0)&field=type:integer(0,0)&field=lcounty:string(4,0)&field=rcounty:string(4,0)&field=lcity:string(4,0)&field=rcity:string(4,0)&field=roadtypeid:integer(0,0)&field=emissionsingramsperhr:double(0,0)&field=DN:integer(0,0)&field=length_2:double(0,0)&uid={d628594b-4822-4073-b5f2-1cf3fc71a5b6}', NEW_FIELD: True, OUTPUT: 'TEMPORARY_OUTPUT' }
No root node! Parsing failed?
No root node! Parsing failed?
No root node! Parsing failed?
No root node! Parsing failed?
No root node! Parsing failed?
No root node! Parsing failed?
No root node! Parsing failed?
No root node! Parsing failed? [...]".

QGIS should report a meaningful error message and then abort after the first report. "SYNTAX ERROR LINE 1" is enough, one time.

QGIS and OS versions

  • QGIS dev version fetched just a few days ago.
  • OS is Debian 10

The about screen appears completely black with no controls or text.

Additional context

c.f. #37737

@jamesp670 jamesp670 added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jul 10, 2020
@gioman gioman added Processing Relating to QGIS Processing framework or individual Processing algorithms Modeller labels Jul 10, 2020
@nyalldawson
Copy link
Collaborator

This is fixed in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Modeller Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

3 participants