Bug report #14136

Error on opening project file on 2.13 (nightly development build)

Added by Michal Jurewicz over 8 years ago. Updated about 8 years ago.

Status:Closed
Priority:High
Assignee:Sebastian Dietrich
Category:Project Loading/Saving
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:22138

Description

I don't know it is good place to report some error which occurs on developer builds but I can't find any better. I'm using build for OS X from Dakota Cartography because I can't find any actual stable binary for OS X. On KyngChaos last stable version is 2.12.1 and there is some bugs which makes me this version unusable.

QGIS 2.13 ed32f49 worked fine for me for last few days. However, yesterday a have saved my project file and today I couldn't open it. There was error: unexpected character in line 146522 in column 22 in project file. It is this line: <config dokładne reko="dokładne reko" oflagowany="oflagowany" otaśmowany="otaśmowany" NULL="NULL"/>

I have deleted whole line with 1 parent tag:
<widget name="Status">
<config dokładne reko="dokładne reko" oflagowany="oflagowany" otaśmowany="otaśmowany" NULL="NULL"/>
</widget>

I believe it is definition of rule based style format on table (I recognize attribute names) and there is problem with UTF8 special character "ł"

After deleting this line, project file is ok and everything works.

Associated revisions

Revision e99ccb79
Added by Sebastian Dietrich about 8 years ago

remove the accompanying QgsEditorWidgetConfig when removing a field
(refs #14136)

Revision 50aa8058
Added by Matthias Kuhn about 8 years ago

Merge pull request #2778 from SebDieBln/FixOrphanedWidgetConfigs

[Bugfix] Avoid orphaned QgsEditorWidgetConfig (refs #14136)

Revision 58751b50
Added by Matthias Kuhn about 8 years ago

Don't use invalid xml values as attribute names

Fixes #14136

History

#1 Updated by Sebastian Dietrich over 8 years ago

  • Category set to Project Loading/Saving

I don't know it is good place to report some error which occurs on developer builds but I can't find any better.

It is exactly the right place!

QGIS 2.13 ed32f49

+1 for specifying which master you were testing :-)

You can also attach files to this ticket, e.g. your broken project file might be of some help investigating this issue. Please make sure not to reveal any passwords that might be stored in your project.

#2 Updated by Saber Razmjooei over 8 years ago

  • Operating System deleted (OS X)
  • OS version deleted (10.11.2)

I have tested it in Windows using latest master.

While the UTF special charector did not crash QGIS upon opening the project, after saving and opening the project, the attribute table came up with wrong format.

#3 Updated by Saber Razmjooei over 8 years ago

  • Subject changed from Error on opening project file on 2.13 (nightly development build) to Attribute table formating can't handle UTF8 specialr characters
  • Category changed from Project Loading/Saving to Attribute table

#4 Updated by Saber Razmjooei over 8 years ago

  • Subject changed from Attribute table formating can't handle UTF8 specialr characters to Attribute table formating can't handle UTF8 special characters

#5 Updated by Sebastian Dietrich over 8 years ago

Saber Razmjooei wrote:

While the UTF special charector did not crash QGIS upon opening the project, after saving and opening the project, the attribute table came up with wrong format.

That is interesting, too, but it is not what the OP mentioned:
unexpected character in line 146522 in column 22 in project file

So I would kindly ask you to file a new ticket for that and please change the subject of this ticket back to its former value.

The original error is not caused by the UTF special character, but by the "attribute name" dokładne reko. That contains a space and thus makes is two attributes, dokładne and reko, with the first one having no value. That is a violation of the XML-standard and thus the file can not be opened.

#6 Updated by Sebastian Dietrich over 8 years ago

  • Status changed from Open to Feedback
  • Category changed from Attribute table to Project Loading/Saving
@Michal Jurewicz:

Please attach the broken project file.

#7 Updated by Saber Razmjooei over 8 years ago

Michal,

Could you try the followings and report back:
1- saving and opening a project without the conditional formating to your table
2- saving and opening a project with conditional formating to a table without UTF8 special characters

Thanks
Saber

#8 Updated by Sebastian Dietrich over 8 years ago

OK, I think I found the offending line in the code. It seems the attribute name is derived from some user input and not checked to be a valid attribute name. Not checking is the default in Qt.

However, I don't know from where the code is called in this case.

@Saber Razmjooei:
Is this related to the conditional formatting you mentioned? What are the steps to have a <config> tag written to the project? I always get <widgetv2config> tags.

#9 Updated by Michal Jurewicz over 8 years ago

Here is my old project file which caused the problem:
https://www.dropbox.com/s/hk54jlfrnm0otc6/Single%20Kaczawskie%20QGIS-kopia.qgs?dl=0
I realized that this line can be also field definition (attribute map) for a table.

The fixed project file (where I deleted this problematic line) works fine.

#10 Updated by Sebastian Dietrich over 8 years ago

Thanks for posting that (huge) project! I can reproduce on current master.

I tracked the error down to the layer called Przebieg v12.
  • Do you recall what you changed in that layer before you saved the project?
  • It must have something to do with an entity called Status. Is that a field, a relation, or something else?
  • Do you remember where you entered the values dokładne reko, oflagowany, ... ?

I still have troubles finding a QGIS function that saves the

<widget ...>
  <config .../>
</widget>

tags to a project :-(

#11 Updated by Sebastian Dietrich over 8 years ago

When I remove the offending space in dokładne reko the project loads fine (except for all the broken layers, of course).

@Saber Razmjooei
May I kindly ask you again to
- create a new ticket for the newly discovered UTF8 issue regarding the attribute table
- change the title of this ticket back to its former value

Thanks!

#12 Updated by Sebastian Dietrich over 8 years ago

  • Status changed from Feedback to Open

OK, I could finally reproduce the error!

  • Create a new project
  • Create a new memory layer
  • Add a field named NewField to the memory layer
  • Leave editing mode
  • Make the Edit Widget for that field a Value map
  • Enter f o o as value and b a r as description
  • Apply your changes to the layer
  • Delete the field NewField
  • Save the project

You end up with the following lines in the project:

<widget name="NewField">
  <config b a r="f o o"/>
</widget>

This violates the XML-standard and the file will not load in QGIS again.

#13 Updated by Sebastian Dietrich over 8 years ago

  • Status changed from Open to In Progress
  • Assignee set to Sebastian Dietrich

#14 Updated by Sebastian Dietrich about 8 years ago

  • % Done changed from 0 to 70
  • Target version set to Version 2.14

#15 Updated by Sebastian Dietrich about 8 years ago

  • % Done changed from 70 to 100
  • Subject changed from Attribute table formating can't handle UTF8 special characters to Error on opening project file on 2.13 (nightly development build)
  • Pull Request or Patch supplied changed from No to Yes

See PR 2778 for a solution.

#16 Updated by Paolo Cavallini about 8 years ago

  • Subject changed from Error on opening project file on 2.13 (nightly development build) to Attribute table formating can't handle UTF8 special characters

#17 Updated by Sebastian Dietrich about 8 years ago

  • Subject changed from Attribute table formating can't handle UTF8 special characters to Error on opening project file on 2.13 (nightly development build)

#18 Updated by Sebastian Dietrich about 8 years ago

  • % Done changed from 100 to 50

Progress reduced to 50% because there might be more ways to trigger the creation of invalid XML and it is not yet clear whether this issue was triggered by the way I discovered and fixed in PR 2778.

#19 Updated by Anonymous about 8 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF