MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031711Community[OCCT] OCCT:Data Exchangepublic2020-08-13 06:562020-09-14 20:23
Reporterly155331445 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusreviewedResolutionopen 
PlatformWindowsOSVC++ 2013OS Version64 bit
Product Version[OCCT] 7.4.0 
Target Version[OCCT] 7.5.0Fixed in Version 
Summary0031711: Data Exchange - STEPCAFControl_Reader hangs on attached file in an infinite loop
DescriptionIn "STEPCAFControl\STEPCAFControl_Reader.cxx" file ,the function "Transfer(STEPControl_Reader ,Standard_)Integer,........)",maybe call "ReadExternFile(Standard_CString,Standard_Cstring.....)" function when "ExtRefs.NbExternRefs() is not 0 " .But the "ReadExternFile(Standard_CString,Standard_Cstring.....)" function in the same file maybe call "Transfer(STEPControl_Reader ,Standard_)Integer,........)" function.
So it will be call each other forever.
Steps To ReproduceReadStep D c:/UPPER.stp

Additional information
and documentation updates
When excute "m_fileReader.Transfer(m_doc)", it will compute true path to the extern file in "for(i = i; i<=ExtRefs.NbExternRefs();i++)" in Transfer(STEPControl_Reader ,Standard_)Integer,........) .And then ,call "ReadExternFile(filename,filename.ToCString(),doc)" .But in ReadExternFile(),When EF->GetLoadStatus() = IFSelect_RetDone, it will call Transfer(.......)again.
This is a recursion.But in Transfer(.....) it will excute same code and call ReadExternFile() again,so for attached file it will call each other forever.I wait for 30min ,never end.
TagsNo tags attached.
Test case number
Attached Fileszip file icon UPPER.zip (6,295,428 bytes) 2020-08-13 06:56

- Relationships

-  Notes
(0093795)
git (administrator)
2020-09-01 10:46

Branch CR31711 has been created by dpasukhi.

SHA-1: cf126ddbb30118a494d92fde57ee34afb141373e


Detailed log of new commits:

Author: dpasukhi
Date: Tue Sep 1 10:47:20 2020 +0300

    0031711: Data Exchange - STEPCAFControl_Reader hangs on attached file in an infinite loop
    
    Add check if .step external file is the same main file
(0093796)
kgv (developer)
2020-09-01 11:13

+#ifdef OCCT_DEBUG
+      std::cout << "Warning: STEPCAFControl_Reader::Transfer: Extern reference file is the 
same main file " << std::endl;
+#endif

I think this message shouldn't be a Debug one.
(0093807)
git (administrator)
2020-09-01 12:42

Branch CR31711 has been updated forcibly by dpasukhi.

SHA-1: 56b118552e4f098c33ffdcd6b7f8afb6404f917d
(0093813)
ly155331445 (reporter)
2020-09-01 13:30

Hello ,I update the code by "CR31711" and check the attached file in my PC.It is also "in an infinite loop".And I debug the code ,it maybe forget to deal with the "\" with "filename".So please check the "attached file".
(0093850)
git (administrator)
2020-09-02 12:16

Branch CR31711 has been updated forcibly by dpasukhi.

SHA-1: 82c40a1f9420ce7e495d584ac9bfa470b7cf661e
(0093852)
dpasukhi (developer)
2020-09-02 12:25

Dear ly155331445,
can You update the branch and test on your PC? If this fix doesn't help, can you tell me your operating system?
(0093954)
ly155331445 (reporter)
2020-09-03 06:49

Dear dpasukhi,
  I merger the code and test on my PC.My operating system is Simplified Chinese Windows 7 Ultimate.The reason is different between "\" and "/" in "filepath".
So I change the code following:
     TCollection_AsciiString fullname = OSD_Path::AbsolutePath(dpath, filename);
     if (fullname.Length() <= 0) fullname = filename;

+ // compute true path to the main file
- const Standard_CString aMainName = reader.WS()->LoadedFile();
- TCollection_AsciiString aFullMainName = OSD_Path::AbsolutePath(aMainName, aMainName);
- if (aFullMainName.Length() <= 0) aFullMainName = aMainName;


+OSD_PATH aMainName(reader.WS()->LoadedFile());
+aMainName.SetName("");
+aMainName.SetExtension("");
+TCollection_AsciiString dapath;
+aMainName.SystemName(dapath);
+ TCollection_AsciiString aFullMainName = OSD_Path::AbsolutePath(dapath, filename);

+ // check for not the same file
+ if(fullname == aFullMainName) {
.....}
   
   As this fix is usefull on my PC. Please check it.
(0093955)
kgv (developer)
2020-09-03 07:37
edited on: 2020-09-03 07:40

Dmitry,

you may check reversed slashes locally in Draw by putting them in quotes or braces like that:
-ReadStep D_First [locate_data_file bug31711.stp]
+ReadStep D_First {c:\myFolder\bug31711.stp}


I think that `locate_data_file` command normalizes file path (Tcl shell normally works with forward slashes even on Windows).
If there is a different behavior in this case for STEP reader (and we want to detect issues in both cases), it might be useful extending test case and trying to read file also with backslashes - e.g. by replacing forward slashes returned by locate_data_file via regexp.

(0093967)
git (administrator)
2020-09-03 11:11

Branch CR31711 has been updated forcibly by dpasukhi.

SHA-1: a4c8ea8d08e5d43f227ccac37a6f5b6cc75e9b1f
(0093993)
git (administrator)
2020-09-03 16:07

Branch CR31711 has been updated forcibly by dpasukhi.

SHA-1: 7f9c82acbac60c571d66e7f051901c055829bd8d
(0094191)
git (administrator)
2020-09-07 11:54

Branch CR31711 has been updated forcibly by dpasukhi.

SHA-1: 04f07ad73d45f380fc544ee8c4ac60513fc39211
(0094201)
dpasukhi (developer)
2020-09-07 16:49

All test are OK:
http://occt-tests/CR31711-master-dpasukhi-OCCT/Debian80-64/diff_summary.html [^]
http://occt-tests/CR31711-master-dpasukhi-Products/Debian80-64/diff_summary.html [^]
http://occt-tests/CR31711-master-dpasukhi-OCCT/Windows-64-VC14/diff_summary.html [^]
http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR31711-master-dpasukhi-Products-Windows-64-VC14-opt-test-compare/6/ [^]
(0094202)
dpasukhi (developer)
2020-09-07 16:49
edited on: 2020-09-07 16:51

Dear ika,
please review CR31711.
The attached file has recursion in EXTERNAL_SOURCE. I have added a check for the same of main file name and external file name.

(0094309)
ika (developer)
2020-09-09 16:20

Dear Dmitry,

I have two remarks:

1. I think full names should be low cased before comparing, if, for example, I rename the initial file to "upper.stp" the reader will make an extra loop.

2. "Extern reference file is the same main file" - is no OK please do not use such reduction in warning messages (should be External reference).
(0094364)
git (administrator)
2020-09-10 12:15

Branch CR31711 has been updated forcibly by dpasukhi.

SHA-1: ea365e60188999be09caeafbdc207dbaa2b9bed7
(0094365)
dpasukhi (developer)
2020-09-10 12:19

Dear Irina,
Thanks for the remarks.
All have been done.
Please review CR31711.
(0094370)
ly155331445 (reporter)
2020-09-10 13:07

Dear Dmitry,
  Do you test "\\" in "aMainFullName"?
  For example( Use Draw.exe tool )
     ReadStep D C:\\XXX.stp(It can work in my PC)
  When I use upper.stp .It is not work.
(0094687)
git (administrator)
2020-09-13 20:20

Branch CR31711 has been updated forcibly by dpasukhi.

SHA-1: 669b0d37354ab50d59ea80ac46d67fdc3cbac114
(0094735)
dpasukhi (developer)
2020-09-14 14:45

Dear ly155331445,
I fixed all cases, such as: {\\,\,/} ( works correctly on the Windows platform )
Thanks for the remarks.
(0094743)
dpasukhi (developer)
2020-09-14 15:52

Dear Irina,
All have been done.
All tests are OK. No regressions.
Please review CR31711.
(0094775)
ika (developer)
2020-09-14 20:23

No more remarks.

Dear bugmaster,
please integrate:

OCCT - CR31711
Products - NOT

- Issue History
Date Modified Username Field Change
2020-08-13 06:56 ly155331445 New Issue
2020-08-13 06:56 ly155331445 Assigned To => kgv
2020-08-13 06:56 ly155331445 File Added: UPPER.zip
2020-08-13 16:46 kgv Assigned To kgv => gka
2020-08-13 16:46 kgv Category OCCT:Coding => OCCT:Data Exchange
2020-08-13 16:46 kgv Product Version => 7.4.0
2020-08-13 16:46 kgv Target Version => 7.5.0
2020-08-13 16:46 kgv Summary About code in STEPCAFControl\STEPCAFControl_Reader.cxx => Data Exchange - STEPCAFControl_Reader hangs on attached file in an infinite loop
2020-08-26 12:09 gka Assigned To gka => dpasukhi
2020-09-01 10:46 git Note Added: 0093795
2020-09-01 11:13 kgv Note Added: 0093796
2020-09-01 12:42 git Note Added: 0093807
2020-09-01 13:30 ly155331445 Note Added: 0093813
2020-09-02 12:16 git Note Added: 0093850
2020-09-02 12:25 dpasukhi Note Added: 0093852
2020-09-03 06:49 ly155331445 Note Added: 0093954
2020-09-03 07:37 kgv Note Added: 0093955
2020-09-03 07:39 kgv Note Edited: 0093955 View Revisions
2020-09-03 07:39 kgv Note Edited: 0093955 View Revisions
2020-09-03 07:40 kgv Note Edited: 0093955 View Revisions
2020-09-03 11:11 git Note Added: 0093967
2020-09-03 16:07 git Note Added: 0093993
2020-09-07 11:54 git Note Added: 0094191
2020-09-07 16:49 dpasukhi Note Added: 0094201
2020-09-07 16:49 dpasukhi Note Added: 0094202
2020-09-07 16:49 dpasukhi Assigned To dpasukhi => ika
2020-09-07 16:49 dpasukhi Status new => resolved
2020-09-07 16:51 dpasukhi Note Edited: 0094202 View Revisions
2020-09-09 16:20 ika Note Added: 0094309
2020-09-09 16:20 ika Assigned To ika => dpasukhi
2020-09-09 16:20 ika Status resolved => assigned
2020-09-10 12:15 git Note Added: 0094364
2020-09-10 12:19 dpasukhi Note Added: 0094365
2020-09-10 12:19 dpasukhi Assigned To dpasukhi => ika
2020-09-10 12:19 dpasukhi Status assigned => feedback
2020-09-10 13:07 ly155331445 Note Added: 0094370
2020-09-10 14:12 dpasukhi Assigned To ika => dpasukhi
2020-09-10 14:12 dpasukhi Status feedback => assigned
2020-09-13 20:20 git Note Added: 0094687
2020-09-14 14:45 dpasukhi Note Added: 0094735
2020-09-14 15:52 dpasukhi Note Added: 0094743
2020-09-14 15:52 dpasukhi Assigned To dpasukhi => gka
2020-09-14 15:52 dpasukhi Status assigned => resolved
2020-09-14 15:52 dpasukhi Assigned To gka => dpasukhi
2020-09-14 15:53 dpasukhi Status resolved => assigned
2020-09-14 15:54 dpasukhi Assigned To dpasukhi => ika
2020-09-14 15:54 dpasukhi Status assigned => resolved
2020-09-14 15:54 dpasukhi Steps to Reproduce Updated View Revisions
2020-09-14 20:23 ika Note Added: 0094775
2020-09-14 20:23 ika Assigned To ika => bugmaster
2020-09-14 20:23 ika Status resolved => reviewed


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker