View Issue Details

IDProjectCategoryView StatusLast Update
0001776FreeCADBugpublic2015-01-25 11:49
Reportermore11 Assigned Towmayer  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformDell XPSOSWindows 7OS Version64 bit
Product Version0.14 
Summary0001776: Illegal character when opening project
DescriptionFatal Error at file C:/Users/more10.HOLISTICODE/Horn/2227 midbashorn/midbashorn.FCStd, line 171, char 49
Invalid Document.xml: invalid character 0x19 in attribute value 'name'
Fatal Error at file GuiDocument.xml, line 8029, char 27
Reading failed from embedded file: GuiDocument.xml (363937 bytes, 10240 bytes compressed)
Steps To ReproduceOpen file
Additional InformationDownload file from https://dl.dropboxusercontent.com/u/106944188/FreeCAD/invalid%20character/midbashorn.FCStd

OS: Windows 7
Word size: 64-bit
Version: 0.14.3700 (Git)
Branch: releases/FreeCAD-0-14
Hash: 32f5aae0a64333ec8d5d160dbc46e690510c8fe1
Python version: 2.7.6
Qt version: 4.8.5
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.6.0
TagsNo tags attached.
FreeCAD Information

Activities

quick61

2014-10-04 20:41

reporter   ~0005181

Both lines referred to in the error message contain a non-ascii character.

more11

2014-10-04 21:39

reporter   ~0005182

Well these non ascii characters where entered through FreeCAD. I have not edited the file in any other program.

quick61

2014-10-04 22:21

reporter  

DocXML.png (Attachment missing)

quick61

2014-10-04 22:22

reporter  

GuiDocXML.png (Attachment missing)

quick61

2014-10-04 22:24

reporter   ~0005183

I am attaching screenshots of the offending lines. The line in the middle contains the error in both shots. If FreeCAD has generated these, there is most definitely is a bug.

more11

2014-10-04 23:43

reporter   ~0005184

Can you figure out what utf-8 characters these represents?

shoogen

2014-10-05 11:24

developer   ~0005185

the name is 2f 09 38 19
0x19 is a ascii character

yorik

2014-10-05 16:13

administrator   ~0005186

It is really strange that an object name contains non-ascii characters... This should normally never happen, and the name of an object is normally not editable directly by the user.

Can you describe what you did to obtain that? Do you use FreeCAD in another language?

more11

2014-10-05 18:55

reporter   ~0005187

English Windows. Swedish keyboard, åäö. Swedish locale.

more11

2014-10-05 18:56

reporter   ~0005188

I did change the name of some objects, but since the error appears when reading back the project file, I have no idea when these characters where introduced.

shoogen

2014-10-05 19:26

developer   ~0005189

The name can only be set when adding an object. AFAIK there is no way to alter it afterwards.

yorik

2014-10-05 19:48

administrator   ~0005190

My guess is that at creation time, the name of the App::MeasureDistance object is taken from the translation (which must, in swedish, contain non-ascii chars). Normally that name must go through a cleaning function that removes all non-ascii chars from the name, I suppose this object is missing the call to that function. I'll have a look at that

yorik

2014-10-05 19:51

administrator   ~0005191

Last edited: 2014-10-05 19:53

Hm no.. the creation of a new object is in Gui/ViewProviderMeasureDistance.cpp at line 275... It doesn't even translate the name. Really I don't know how this happened! more11 can you reproduce this in a new file?

more11

2014-10-05 22:50

reporter   ~0005192

Can you add an assert when the name is assigned? Then you will catch this the next time someone creates a bad name.

more11

2014-10-05 22:51

reporter   ~0005193

Could also be a memory bug.

shoogen

2014-10-06 18:03

developer   ~0005196

asserts are useless. If you don't run FreeCAD with a debuger the program will stop and the document will be lost.
we should use conditional breakpoints.

more11

2014-10-06 18:09

reporter   ~0005197

The document will be lost anyways. Catch the error and prompt the user with a stack trace or whatever.

yorik

2015-01-19 17:16

administrator   ~0005675

My opinion is that we should close this, because there is no way to reproduce the problem. \Neither via the GUI nor via python scripting, I'm able to create an object with non-ascii characters in the object name.

So I don't see what/where something should be fixed. I'm afraid I can't do anything about it...

wmayer

2015-01-24 18:45

administrator   ~0005715

Last edited: 2015-01-24 18:45

Since FreeCAD doesn't crash but raises an exception I downgrade the severity to 'major'.

When looking at the code what might be the reason then this line looks cruel:
pcObject->pcNameInDocument = &(d->objectMap.find(ObjectName)->first);

The DocumentObject doesn't have a std::string with its name but a pointer to the std::map of the document. So, the problem of the above line is that if in any case we have two objects with the same internal name two things happen:
* the std::map loses one DocumentObject and its 'pcNameInDocument' may point to an invalid memory block. This might explain the strange name of the above example.

* the std::vector doesn't lose the first object so that there is an inconsistency

Here is a Python example that shows the problem:
App.ActiveDocument.openTransaction("Box")
b1=App.ActiveDocument.addObject("Part::Box","Box")
App.ActiveDocument.commitTransaction()
b1.Name
App.ActiveDocument.undo()
b1.Name
b2=App.ActiveDocument.addObject("Part::Box","Box")
b2.Name
App.ActiveDocument.redo()
b2.Name
b1.Name

The culprit is the method Document::_addObject because it doesn't check whether in the meantime a new object has been added with the same name. However, currently I can't see how this scenario can be achieved with pure GUI user interactions.

Related Changesets

FreeCAD: master 2cff92a7

2015-01-25 12:36:24

wmayer

Details Diff
+ fixes 0001776: Illegal character when opening project Affected Issues
0001776
mod - src/App/Document.cpp Diff File

Issue History

Date Modified Username Field Change
2014-10-04 18:34 more11 New Issue
2014-10-04 20:41 quick61 Note Added: 0005181
2014-10-04 21:39 more11 Note Added: 0005182
2014-10-04 22:21 quick61 File Added: DocXML.png
2014-10-04 22:22 quick61 File Added: GuiDocXML.png
2014-10-04 22:24 quick61 Note Added: 0005183
2014-10-04 23:43 more11 Note Added: 0005184
2014-10-05 11:24 shoogen Note Added: 0005185
2014-10-05 16:13 yorik Note Added: 0005186
2014-10-05 16:14 yorik Assigned To => yorik
2014-10-05 16:14 yorik Status new => feedback
2014-10-05 18:55 more11 Note Added: 0005187
2014-10-05 18:55 more11 Status feedback => assigned
2014-10-05 18:56 more11 Note Added: 0005188
2014-10-05 19:26 shoogen Note Added: 0005189
2014-10-05 19:48 yorik Note Added: 0005190
2014-10-05 19:51 yorik Note Added: 0005191
2014-10-05 19:53 yorik Note Edited: 0005191
2014-10-05 19:53 yorik Status assigned => feedback
2014-10-05 22:50 more11 Note Added: 0005192
2014-10-05 22:50 more11 Status feedback => assigned
2014-10-05 22:51 more11 Note Added: 0005193
2014-10-06 18:03 shoogen Note Added: 0005196
2014-10-06 18:09 more11 Note Added: 0005197
2015-01-19 17:16 yorik Note Added: 0005675
2015-01-19 17:16 yorik Assigned To yorik =>
2015-01-19 17:16 yorik Status assigned => new
2015-01-24 18:45 wmayer Note Added: 0005715
2015-01-24 18:45 wmayer Severity block => major
2015-01-24 18:45 wmayer Note Edited: 0005715
2015-01-25 11:49 wmayer Changeset attached => FreeCAD Master master 2cff92a7
2015-01-25 11:49 wmayer Assigned To => wmayer
2015-01-25 11:49 wmayer Status new => closed
2015-01-25 11:49 wmayer Resolution open => fixed