MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0027187Community[OCCT] OCCT:Application Frameworkpublic2016-02-19 08:592017-09-29 16:29
ReporterVico Liang 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusclosedResolutionfixed 
PlatformWindowsOSVC++ 2013OS Version64 bit
Product Version[OCCT] 6.9.1 
Target Version[OCCT] 7.2.0Fixed in Version[OCCT] 7.2.0 
Summary0027187: XmlMFunction_ScopeDriver fail to read and write function label including 0 tag in label path.
DescriptionXmlMFunction_ScopeDriver will explicitely escape the 0 tag in the label entry path e.g. "0:1:4:9999:0:1:4:2001:4:2001:4:1:4:1001:4:1001". It thought that 0 tag should just occur in the root Label. But in practice, it should not have such restriction. User might want to set any integer tag in application. As a data driver, it should not alter the users attampt.

It's lucky that BinMFunction_ScopeDriver works well.
Steps To Reproducebugs/caf/bug27187
TagsNo tags attached.
Test case numberbugs caf bug27187
Attached Files? file icon XML_DRIVER_ERROR.rbsx (5,797 bytes) 2016-02-19 08:59

- Relationships

-  Notes
(0051183)
mpv (developer)
2016-02-26 18:08

Yes, I agree that this condition is missed in the source code and documentation, but supposed and used by developers. We have plans to add information that not-root label tag must be greater than zero in the documentation and produce and exception in code for such invalid cases.
(0053976)
Vico Liang (developer)
2016-05-11 03:39

Dear mpv,

I can't agree that not-root label tag must be greater than zero in the documentation. I think zero tag should be reasonable in application, e.g. if user want to copy other document label tree completely to a child label of my document, this case would not be supported.

I see binary format will support any tag value, it's correct i think. This logic should not be done in document save and restore driver, if you think zero tag is not supported, it's better do it in label tag assign operator.
(0066599)
szy (administrator)
2017-05-25 17:09

Vlad,
Check, please if the mentioned limitation exists in XmlMFunction_ScopeDriver (?).
I think that Binary and Xml drivers should be synchronized.
Document itself has no such limitation's.
(0066619)
vro (developer)
2017-05-26 07:00

TFunction_Scope writes labels as a long string (the labels are separated by spaces). So, no special TAG is used for XML and it shouldn't cause any known problems.
(0066626)
mpv (developer)
2017-05-26 11:10

The store/restore documnent with zero-tagged labels are supported correctly by XML drivers. No XmlMFunction_ScopeDriver were detected in the following test-case:

NewDocument D XmlOcaf
Label D 0:1:4:9999:0:1:4:2001:4:2001:4:1:4:1001:4:1001
SetInteger D 0:1:4:9999:0:1:4:2001:4:2001:4:1:4:1001:4:1001 7
SaveAs D file.xml
Close D
Open file.xml D
GetInteger D 0:1:4:9999:0:1:4:2001:4:2001:4:1:4:1001:4:1001
-> 7

So, it work fine.

The attached file is already broken, but stored in custom format "RBKernelRBSXml", so, we don't know how to reproduce this test case.

Vico, could you provide a test case that allows to reproduce the problem in OCCT, not in your specific application? This will approve that the problem is in OCCT, not in specific development.
(0066632)
szy (administrator)
2017-05-26 11:25

Dear Vico,
We didn't findd the specified limitation neither in Document driver neither in ScopeDriver.
Also we can't reproduce the issue using the provided by you description.
I just can guess that the real problem may be located inside your specific code.
In any case when you report the issue you should take care to make it reproducible in Open CasCade environment, for example in DrawHarness.
In case if you are not friendly with Draw environment you can use alternative way providing a standalone sample (including project files to build it) allowing to reproduce your case. If it is difficult for you we can offer you our professional support services, for example HelpDesk Query (https://www.opencascade.com/content/helpdesk-query [^]).
Please follow this way in case if you are interested in resolution of the reported problem.
(0066676)
Vico Liang (developer)
2017-05-27 01:48

Standard_Boolean XmlObjMgt::GetTagEntryString
                                        (const XmlObjMgt_DOMString& theSource,
                                         TCollection_AsciiString& theTagEntry)
{
  // Check the prefix
  const size_t aPrefixSize = sizeof(aRefPrefix) - 1;
  const char * aSource = theSource.GetString();
  if (strncmp (aSource, aRefPrefix, aPrefixSize))
    return Standard_False;

  // Beging aTagEntry string
  char * aTagEntry =
    (char *) Standard::Allocate (strlen(aSource)/2); // quite enough to hold it
  char * aTagEntryPtr = aTagEntry + 1;
  * aTagEntry = '0';
  aSource += aPrefixSize;

  // Find all individual tags in a loop
  const size_t anElem1Size = sizeof(aRefElem1) - 1;
  const size_t anElem2Size = sizeof(aRefElem2) - 1;
  while (aSource[0] != '\0') {
    // Check the first part of individual tag: "/label[@tag="
    if (strncmp (aSource, aRefElem1, anElem1Size))
      return Standard_False;
    aSource += anElem1Size;
    const char aQuote = aSource[0];
    if (aQuote != '\'' && aQuote != '\"')
      return Standard_False;

    // Check the integer value of the tag
    errno = 0;
    char * aPtr;
    long aTagValue = strtol (&aSource[1], &aPtr, 10);
    if (aTagValue <= 0 || aPtr[0] != aQuote ||
        errno == ERANGE || errno == EINVAL)
      return Standard_False;
(0066677)
Vico Liang (developer)
2017-05-27 01:50

Dear szy,

Sorry that it difficult for me to provide test case to reproduce this issue. It's fortunately that i find the issue from the source code, please see the previous code snippet. the last line

if (aTagValue <= 0 || aPtr[0] != aQuote ||
         errno == ERANGE || errno == EINVAL)
       return Standard_False;
(0066681)
Vico Liang (developer)
2017-05-28 06:06

This can be fixed by remove conditional filter "aTagValue <= 0" from if statement
(0066712)
git (administrator)
2017-05-29 12:18

Branch CR27187 has been created by mpv.

SHA-1: e66dacf1c84206cd95722057aeedb36e973c2fea


Detailed log of new commits:

Author: mpv
Date: Mon May 29 12:16:56 2017 +0300

    0028714: XmlMFunction_ScopeDriver fail to read and write function label including 0 tag in label path.
    
    Reproduced on TDF_Reference attribute that refers to label with zero-tags entry. Make checking of saved/retrieved tags in XML format pass zero-tags as correct.
(0066713)
mpv (developer)
2017-05-29 12:21

The problem is reproduced on TDF_Reference attribute referenced on zer-tagged label.

Fixed. Please, review.
(0066853)
apv (tester)
2017-05-30 11:09

Dear BugMaster,

Branch CR27187 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: e66dacf1c84206cd95722057aeedb36e973c2fea

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MasOS: 0 (0 on master)
products component:
   Linux: 64
   Windows: 0
   MacOS: 1201

Regressions/Differences:
Not detected

Testing cases:
bugs caf bug27187 - OK
http://occt-tests/CR27187-master-OCCT/Debian70-64/bugs/caf/bug27187.html [^]
http://occt-tests/CR27187-master-OCCT/Windows-64-VC10/bugs/caf/bug27187.html [^]

Testing on Linux:
Total MEMORY difference: 91578829 / 91842464 [-0.29%]
Total CPU difference: 18590.12000000032 / 19347.320000000098 [-3.91%]

Testing on Windows:
Total MEMORY difference: 58498744 / 58497831 [+0.00%]
Total CPU difference: 17325.50226019865 / 17520.28510879866 [-1.11%]
(0066854)
apv (tester)
2017-05-30 11:10

Dear BugMaster,

Please integrate branch CR27187 into the occt git-repository master.
(0066975)
bugmaster (administrator)
2017-06-02 10:31

Fix has been integrated into master of occt-products repository
(0066996)
git (administrator)
2017-06-02 10:45

Branch CR27187 has been deleted by inv.

SHA-1: e66dacf1c84206cd95722057aeedb36e973c2fea

- Related Changesets
occt: master ec2039e9
Timestamp: 2017-05-29 09:16:56
Author: mpv
Committer: bugmaster
Details ] Diff ]
0028714: XmlMFunction_ScopeDriver fail to read and write function label including 0 tag in label path.

Reproduced on TDF_Reference attribute that refers to label with zero-tags entry. Make checking of saved/retrieved tags in XML format pass zero-tags as correct.
mod - src/XmlObjMgt/XmlObjMgt.cxx Diff ] File ]
add - tests/bugs/caf/bug27187 Diff ] File ]

- Issue History
Date Modified Username Field Change
2016-02-19 08:59 Vico Liang New Issue
2016-02-19 08:59 Vico Liang Assigned To => mpv
2016-02-19 08:59 Vico Liang File Added: XML_DRIVER_ERROR.rbsx
2016-02-26 18:08 mpv Note Added: 0051183
2016-05-11 03:39 Vico Liang Note Added: 0053976
2016-10-25 16:06 mpv Target Version 7.1.0 => 7.2.0
2017-05-22 14:42 mpv Assigned To mpv => szy
2017-05-25 17:01 szy Assigned To szy => vro
2017-05-25 17:09 szy Note Added: 0066599
2017-05-26 07:00 vro Note Added: 0066619
2017-05-26 07:00 vro Assigned To vro => mpv
2017-05-26 09:42 szy Target Version 7.2.0 => Unscheduled
2017-05-26 11:10 mpv Note Added: 0066626
2017-05-26 11:10 mpv Status new => feedback
2017-05-26 11:11 mpv Assigned To mpv => Vico Liang
2017-05-26 11:25 szy Note Added: 0066632
2017-05-27 01:48 Vico Liang Note Added: 0066676
2017-05-27 01:50 Vico Liang Note Added: 0066677
2017-05-27 01:52 Vico Liang Status feedback => assigned
2017-05-27 01:52 Vico Liang Assigned To Vico Liang => mpv
2017-05-27 01:52 Vico Liang Status assigned => feedback
2017-05-27 11:18 Vico Liang Status feedback => assigned
2017-05-28 06:06 Vico Liang Note Added: 0066681
2017-05-29 12:18 git Note Added: 0066712
2017-05-29 12:21 mpv Note Added: 0066713
2017-05-29 12:21 mpv Assigned To mpv => vro
2017-05-29 12:21 mpv Status assigned => resolved
2017-05-29 12:21 mpv Steps to Reproduce Updated View Revisions
2017-05-29 12:47 vro Assigned To vro => mpv
2017-05-29 12:47 vro Status resolved => reviewed
2017-05-29 12:52 mpv Assigned To mpv => bugmaster
2017-05-29 13:37 apv Assigned To bugmaster => apv
2017-05-30 11:04 apv Test case number => bugs caf bug27187
2017-05-30 11:09 apv Note Added: 0066853
2017-05-30 11:09 apv Assigned To apv => bugmaster
2017-05-30 11:09 apv Status reviewed => tested
2017-05-30 11:10 apv Note Added: 0066854
2017-06-01 09:58 bugmaster Target Version Unscheduled => 7.2.0
2017-06-02 10:31 bugmaster Note Added: 0066975
2017-06-02 10:31 bugmaster Status tested => verified
2017-06-02 10:31 bugmaster Resolution open => fixed
2017-06-02 10:45 git Note Added: 0066996
2017-08-14 16:05 abv Changeset attached => occt master ec2039e9
2017-09-29 16:17 user533 Fixed in Version => 7.2.0
2017-09-29 16:29 user533 Status verified => closed


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker