MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0027433Community[OCCT] OCCT:Application Frameworkpublic2016-04-26 14:182016-12-09 16:37
ReporterBenjaminBihler 
Assigned Tobugmaster 
PrioritynormalSeveritymajor 
StatusclosedResolutionfixed 
PlatformWindowsOSVC++ 2015OS Version64 bit
Product Version[OCCT] 7.0.0 
Target Version[OCCT] 7.1.0Fixed in Version[OCCT] 7.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
Attached Files

- Relationships

-  Notes
(0053668)
git (administrator)
2016-04-28 14:19

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.
(0053695)
git (administrator)
2016-04-28 16:59

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.

(0053696)
BenjaminBihler (developer)
2016-04-28 17:03

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!
(0053754)
mpv (developer)
2016-04-29 19:30

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.
(0053775)
BenjaminBihler (developer)
2016-05-03 13:10

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
(0053801)
mpv (developer)
2016-05-04 15:29

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?
(0053810)
git (administrator)
2016-05-04 15:48

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.

(0053811)
BenjaminBihler (developer)
2016-05-04 15:49

I have checked it already. Like that it works for me.
(0053815)
BenjaminBihler (developer)
2016-05-04 16:44

... and yes, you are right - my paths have ended with "/". :-)
(0053835)
git (administrator)
2016-05-05 13:30

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

(0053836)
mpv (developer)
2016-05-05 13:33

Test case bugs/caf/bug27433 has been pushed to branch CR27433.
(0053837)
mpv (developer)
2016-05-05 13:34

Reviewed.
To be tested.
(0053838)
git (administrator)
2016-05-05 14:03

Branch CR27433 has been updated forcibly by mkv.

SHA-1: f36aff5e5f907a8abcd08c35db9ef2acd9d38f10
(0053843)
mkv (tester)
2016-05-05 14:14

Dear BugMaster,
Branch CR27433 was rebased on current master of occt git-repository.
SHA-1: f36aff5e5f907a8abcd08c35db9ef2acd9d38f10
(0053877)
mkv (tester)
2016-05-06 09:33

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.
(0053878)
mkv (tester)
2016-05-06 09:33

Dear BugMaster,
Branch CR27433 is TESTED.
(0054190)
git (administrator)
2016-05-20 12:21

Branch CR27433 has been deleted by inv.

SHA-1: f36aff5e5f907a8abcd08c35db9ef2acd9d38f10

- Related Changesets
occt: master a1530ab1
Timestamp: 2016-04-28 11:18:35
Author: 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
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 View Revisions
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 user533 Status verified => closed
2016-12-09 16:37 user533 Fixed in Version => 7.1.0


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker