View Issue Details

IDProjectCategoryView StatusLast Update
0027433CommunityOCCT:Application Frameworkpublic2016-12-09 16:37
ReporterBenjaminBihler Assigned Tobugmaster  
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2015 
Product Version7.0.0 
Target Version7.1.0Fixed in Version7.1.0 
Summary0027433: Opening/Saving OCAF Documents With Own Document Format Does Not Work
DescriptionI am using an own OCAF document format named "Compositence" and I have two files
"Compositence" and "Plugin" in my resource folder. I initialize two environment variables "CSF_PluginDefaults" and "CSF_CompositenceDefaults" both pointing to that resource folder.

When I want to open an OCAF document or create an instance of TDocStd_Application, a Standard_OutOfRange error is raised in OSD_Path::DownTrek, because the name aName passed to this function is empty.

To me it seems as if the error happened in Resource_Manager.cxx around line 489. There the commands

  OSD_Path anOSDPath(aResPath);
  anOSDPath.DownTrek(anOSDPath.Name());
  anOSDPath.SetName(aName);

are executed. According to the paragraph "Saving the document" in the section "Standard Document Services" of the OCCT OCAF documentation, it is correct to store only the resource folder name in the environment variables. Therefore anOSDPath.Name() must return an empty string, since there is no file name. Then the method DownTrek may not be called with anOSDPath.Name(). Anyway, why should the file name of anOSDPath added to the path?

My environment variables and code have worked at least until OCC 6.8.0. Later OCC versions I have not checked, but with OCC 7.0.0 they don't work anymore.
Steps To ReproduceOpen a file in your own format after setting CSF_PluginDefaults and CSF_FormatDefaults to the respective directories.
TagsNo tags attached.
Test case numberbugs caf bug27433

Activities

git

2016-04-28 14:19

administrator   ~0053668

Branch CR27433 has been created by BenjaminBihler.

SHA-1: 22191c36d3e104397dafd87bd49ff9862d5034e6


Detailed log of new commits:

Author: Benjamin Bihler
Date: Thu Apr 28 13:18:35 2016 +0200

    0027433: Opening/Saving OCAF Documents With Own Document Format Does Not Work
    
    Modified Load(...) method of Resource_Manager.cxx to print file names correctly.

git

2016-04-28 16:59

administrator   ~0053695

Branch CR27433 has been updated by BenjaminBihler.

SHA-1: 38fc09873676a733059fc63355152ed7cecb0b42


Detailed log of new commits:

Author: Benjamin Bihler
Date: Thu Apr 28 15:58:56 2016 +0200

    0027433: Opening/Saving OCAF Documents With Own Document Format Does Not Work
    
    Removed appending (empty) file name to directory name, since this is not
    necessary and leads to a Standard_OutOfRange failure in TCollection_AsciiString.

BenjaminBihler

2016-04-28 17:03

developer   ~0053696

mpv, I have removed the call to DownTrek. With that change everything works here as expected. Since you have not commented yet, I have commited that and marked the issue as resolved. Would you check it please? Thank you!

mpv

2016-04-29 19:30

developer   ~0053754

Hello Benjamin,

I see your fix and I think it's ok. To be save I would prefer something like

if (!anOSDPath.Name().IsEmpty())
  anOSDPath.DownTrek(anOSDPath.Name());

but, I'm not sure is this DownTreck needed or not.

So, as soon I will see all the possible cases (and found why this line is appeared here), I will approve this commit. I hope, it will take not a lot of time.

BenjaminBihler

2016-05-03 13:10

developer   ~0053775

Hello mpv,

did you have the possibility to check it?

Your proposal is okay for me, of course. If you cannot check soon, whether DownTrek can be omitted completely, shall I commit the if-clause?

Benjamin

mpv

2016-05-04 15:29

developer   ~0053801

Hello Benjamin,

I found both cases it is reproduced. The OSD_Path implementation is quite simple. It gets as name everything that is after last "/" symbol.
So, for path
C:/aaa
the name is "aaa" and it must be added to the folder,
but for
C:/aaa/
the name is empty. As I understand, this is your case.

Anyway, crash because of "/" symbol in the end of path is very bad and I agree that this should be fixed. But "if-clause" is needed to cover all cases.

So, could you integrate the fix with "if-clause" and check that in your case it works?

git

2016-05-04 15:48

administrator   ~0053810

Branch CR27433 has been updated by BenjaminBihler.

SHA-1: 7e2e03608e209fb7ff877653f69e26eb1aa564c6


Detailed log of new commits:

Author: Benjamin Bihler
Date: Wed May 4 14:48:02 2016 +0200

    0027433: Opening/Saving OCAF Documents With Own Document Format Does not Work
    
    Appending file name is done, but only if the name is not empty.

BenjaminBihler

2016-05-04 15:49

developer   ~0053811

I have checked it already. Like that it works for me.

BenjaminBihler

2016-05-04 16:44

developer   ~0053815

... and yes, you are right - my paths have ended with "/". :-)

git

2016-05-05 13:30

administrator   ~0053835

Branch CR27433 has been updated by mpv.

SHA-1: e7bde2ce7248b8834c636e80bc24cb24c92cb9ad


Detailed log of new commits:

Author: mpv
Date: Thu May 5 13:30:03 2016 +0300

    0027433: Opening/Saving OCAF Documents With Own Document Format Does Not Work
    
    Added unit tests

mpv

2016-05-05 13:33

developer   ~0053836

Test case bugs/caf/bug27433 has been pushed to branch CR27433.

mpv

2016-05-05 13:34

developer   ~0053837

Reviewed.
To be tested.

git

2016-05-05 14:03

administrator   ~0053838

Branch CR27433 has been updated forcibly by mkv.

SHA-1: f36aff5e5f907a8abcd08c35db9ef2acd9d38f10

mkv

2016-05-05 14:14

tester   ~0053843

Dear BugMaster,
Branch CR27433 was rebased on current master of occt git-repository.
SHA-1: f36aff5e5f907a8abcd08c35db9ef2acd9d38f10

mkv

2016-05-06 09:33

tester   ~0053877

Dear BugMaster,
Branch CR27433 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: f36aff5e5f907a8abcd08c35db9ef2acd9d38f10

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 72 (72 on master)
Windows: 4 (4 on master)
MacOS : 1132

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR27433-master-OCCT/Debian70-64/bugs/caf/bug27433.html
http://occt-tests/CR27433-master-OCCT/Windows-64-VC10/bugs/caf/bug27433.html
bugs caf bug27433: OK

Testing on Linux:
occt component :
Total MEMORY difference: 87713780 / 87496177 [+0.25%]
Total CPU difference: 19321.39000000006 / 19371.120000000185 [-0.26%]
products component :
Total MEMORY difference: 27869122 / 27830579 [+0.14%]
Total CPU difference: 5361.219999999987 / 5343.229999999986 [+0.34%]

Testing on Windows:
occt component :
Total MEMORY difference: 55515772 / 55543634 [-0.05%]
Total CPU difference: 18215.129162898742 / 18267.951101498817 [-0.29%]
products component :
Total MEMORY difference: 18922510 / 18891436 [+0.16%]
Total CPU difference: 5079.7045619999535 / 5013.591338199941 [+1.32%]

There are no differences in images found by testdiff.

mkv

2016-05-06 09:33

tester   ~0053878

Dear BugMaster,
Branch CR27433 is TESTED.

git

2016-05-20 12:21

administrator   ~0054190

Branch CR27433 has been deleted by inv.

SHA-1: f36aff5e5f907a8abcd08c35db9ef2acd9d38f10

Related Changesets

occt: master a1530ab1

2016-04-28 11:18:35

BenjaminBihler


Committer: bugmaster Details Diff
0027433: Opening/Saving OCAF Documents With Own Document Format Does Not Work

Modified Load(...) method of Resource_Manager.cxx to print file names correctly.

Removed appending (empty) file name to directory name, since this is not
necessary and leads to a Standard_OutOfRange failure in TCollection_AsciiString.

Appending file name is done, but only if the name is not empty.

Added test case
Affected Issues
0027433
mod - src/Resource/Resource_Manager.cxx Diff File
add - tests/bugs/caf/bug27433 Diff File

Issue History

Date Modified Username Field Change
2016-04-26 14:18 BenjaminBihler New Issue
2016-04-26 14:18 BenjaminBihler Assigned To => mpv
2016-04-28 14:16 BenjaminBihler Summary Saving OCAF Documents With Own Document Format Does Not Work => Opening/Saving OCAF Documents With Own Document Format Does Not Work
2016-04-28 14:19 git Note Added: 0053668
2016-04-28 16:59 git Note Added: 0053695
2016-04-28 17:03 BenjaminBihler Note Added: 0053696
2016-04-28 17:03 BenjaminBihler Status new => resolved
2016-04-28 17:03 BenjaminBihler Steps to Reproduce Updated
2016-04-29 19:30 mpv Note Added: 0053754
2016-05-03 13:10 BenjaminBihler Note Added: 0053775
2016-05-04 15:29 mpv Note Added: 0053801
2016-05-04 15:30 mpv Assigned To mpv => BenjaminBihler
2016-05-04 15:30 mpv Status resolved => assigned
2016-05-04 15:48 git Note Added: 0053810
2016-05-04 15:49 BenjaminBihler Note Added: 0053811
2016-05-04 15:49 BenjaminBihler Assigned To BenjaminBihler => mpv
2016-05-04 16:44 BenjaminBihler Note Added: 0053815
2016-05-05 13:30 git Note Added: 0053835
2016-05-05 13:33 mpv Note Added: 0053836
2016-05-05 13:33 mpv Status assigned => resolved
2016-05-05 13:34 mpv Note Added: 0053837
2016-05-05 13:34 mpv Assigned To mpv => bugmaster
2016-05-05 13:34 mpv Status resolved => reviewed
2016-05-05 13:35 mkv Assigned To bugmaster => mkv
2016-05-05 14:03 git Note Added: 0053838
2016-05-05 14:14 mkv Note Added: 0053843
2016-05-06 09:33 mkv Note Added: 0053877
2016-05-06 09:33 mkv Note Added: 0053878
2016-05-06 09:33 mkv Assigned To mkv => bugmaster
2016-05-06 09:33 mkv Status reviewed => tested
2016-05-06 09:34 mkv Test case number => bugs caf bug27433
2016-05-13 12:41 bugmaster Changeset attached => occt master a1530ab1
2016-05-13 12:41 bugmaster Status tested => verified
2016-05-13 12:41 bugmaster Resolution open => fixed
2016-05-20 12:21 git Note Added: 0054190
2016-12-09 16:31 aiv Status verified => closed
2016-12-09 16:37 aiv Fixed in Version => 7.1.0