View Issue Details

IDProjectCategoryView StatusLast Update
0001831FreeCADBugpublic2015-12-15 13:18
Reportersourcerer Assigned Towmayer  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
PlatformWin32OSWindows 7OS Version7
Product Version0.14 
Fixed in Version0.16 
Summary0001831: FreeCAD can start only once
DescriptionWhen I install FreeCAD, it starts once.
When I try to start it again, I get the error message:
"Initialization of FreeCAD failed"
"Unknown runtime error occured while initializing FreeCAD."
"Please contact the applicationĀ“s support team for more information."

I guess that the problem might be that I have a redirected home directory on a UNC path.
When I go to
\\server\user$\user.HOME\Redirected_Profile\AppData\FreeCAD\
and delete both system.cfg and user.cfg, then FreeCAD can start again once, when I close it, it saves both system.cfg and user.cfg again, and I have to delete them again.
TagsNo tags attached.
FreeCAD Information

Activities

wmayer

2014-11-16 22:10

administrator   ~0005324

You should check if user.cfg and system.cfg are valid XML files.

What may happen is that the files are either empty or not fully written to disk.

sourcerer

2014-11-17 08:19

reporter   ~0005326

Both files are valid XML.

Now I tried starting FreeCADcmd.exe, and got the following error message (I only replaced the server and username):

Fatal Error at file "", line 0, column 0
   Message: An exception occurred! Type:RuntimeException, Message:The primary do
cument entity could not be opened. Id=C:\Program Files\FreeCAD 0.14\bin///SERVER/USER$/USER.HOME/Redirected_Profile/AppData/FreeC
AD/system.cfg
An error occurred during parsing

Fatal Error at file "", line 0, column 0
   Message: An exception occurred! Type:RuntimeException, Message:The primary do
cument entity could not be opened. Id=C:\Program Files\FreeCAD 0.14\bin///SERVER/USER$/USER.HOME/Redirected_Profile/AppData/FreeC
AD/user.cfg
An error occurred during parsing

Initialization of FreeCAD failed:
Unknown runtime error occurred while initializing FreeCAD.

Please contact the application's support team for more information.

wmayer

2014-11-17 19:24

administrator   ~0005330

I assume this is already fixed with current development branch because there we also allow to continue when the XML files are empty or broken.

Until a new version is uploaded you can try to set the directory of user.cfg write protected and delete again user.cfg and system.cfg.

sourcerer

2014-11-17 19:50

reporter   ~0005331

I do not think that the XML files are broken, they look very valid to me.
To me it seems, as if FreeCAD (or one of the libraries behind it) is trying to assemble a full-qualified path from the base directory found in the XML and the UNC path. And it seems as if it does not detect that the UNC path is fully-qualified already (it likely only detects drive pathes like C:\... , and tries to concatenate them both, since it thinks that the UNC path is a relative path, not an absolute path. But the concatenated path is not a valid path, therefore loading from it fails.

edgimar

2015-03-24 20:02

reporter   ~0005942

Last edited: 2015-03-24 20:29

sourcerer's explanation seems plausible -- we have an entire school that runs Windows 7 with the application data being stored in "\\servername\username\Windows Config\Application Data", and we have the same symptoms (making it unusable for anyone at the school). I'm guessing this shouldn't be too hard to fix for someone who knows the FreeCAD source-code.

Presumably the problem is somewhere in Application::ExtractUserPath() -- currently at line 1560 of http://free-cad.sourceforge.net/SrcDocu/d7/d59/App_2Application_8cpp_source.html

wmayer

2015-04-11 16:26

administrator   ~0006001

What exactly do I have to do that the application data directory is stored to something like "\\servername\username\Windows Config\Application Data"?

wmayer

2015-04-11 22:50

administrator   ~0006003

> sourcerer's explanation seems plausible
To me this doesn't sound plausible because how is it possible that FreeCAD creates these two files on exit if the path name were wrong?

The error message "The primary document entity could not be opened. Id=" is generated by the xerces library and this creates then this funny path name "C:\Program Files\FreeCAD 0.14\bin///SERVER/USER$/USER.HOME/Redirected_Profile/AppData/FreeCAD/user.cfg".

See also: http://stackoverflow.com/questions/13036412/xerces-c-the-primary-document-entity-could-not-be-opened

I wonder which path names FreeCAD takes. You can test this by starting it and then paste this into the Python console window:
m=App.ConfigDump()
print m["UserParameter"]
print m["SystemParameter"]

I cannot imagine that an application has to know if folder redirection is activated for certain directories. As you can see from the source we use the WinAPI function SHGetFolderPath(...,CSIDL_APPDATA,...) to determine the right path and I think we can rely on this, no?

wmayer

2015-04-11 23:02

administrator   ~0006004

Again, even if xerces fails to read the file it shouldn't stop FreeCAD (any more). Can you test this again with the version 0.15?

wmayer

2015-04-12 00:07

administrator   ~0006005

OK, I found the issue. When FreeCAD starting with option e.g. "-u \\server\user$\user.cfg" then internally the leading backslashes were converted into slashes. But this causes xerces to think it's a relative path and not an UNC path and then prepends the current working directory as prefix. That's why this strange filenme is generated and xerces then fails to load it.

Related Changesets

FreeCAD: master 708f6665

2015-04-12 02:02:30

wmayer

Details Diff
+ fixes 0001831: FreeCAD can start only once Affected Issues
0001831
mod - src/Base/FileInfo.cpp Diff File

Issue History

Date Modified Username Field Change
2014-11-16 16:34 sourcerer New Issue
2014-11-16 22:10 wmayer Note Added: 0005324
2014-11-17 08:19 sourcerer Note Added: 0005326
2014-11-17 19:24 wmayer Note Added: 0005330
2014-11-17 19:50 sourcerer Note Added: 0005331
2015-03-24 20:02 edgimar Note Added: 0005942
2015-03-24 20:29 edgimar Note Edited: 0005942
2015-04-11 16:26 wmayer Note Added: 0006001
2015-04-11 22:50 wmayer Note Added: 0006003
2015-04-11 23:02 wmayer Note Added: 0006004
2015-04-12 00:07 wmayer Note Added: 0006005
2015-04-12 00:10 wmayer Changeset attached => FreeCAD Master master 708f6665
2015-04-12 00:10 wmayer Assigned To => wmayer
2015-04-12 00:10 wmayer Status new => closed
2015-04-12 00:10 wmayer Resolution open => fixed
2015-12-15 13:18 yorik Fixed in Version => 0.16