You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by Roger L Costello <co...@mitre.org> on 2021/04/20 13:13:08 UTC

Bug in Daffodil?

Hi Folks,

Consider a data format which specifies that instance documents must contain a sequence of 1 to 3 string data items and the data items are to be separated by forward slashes. If there is no data for the third data item and the data format specifies separatorSuppressionPolicy=trailingEmptyStrict, then this instance is invalid because it has a trailing separator:

	a/b/

Daffodil should throw an error with that instance, but doesn't.

On the other hand, if the data format specifies a sequence of 1 to 4 string data items, then Daffodil throws an error on the above instance.

That is, Daffodil does not throw an error on the above instance with this schema:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
        dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
        <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="3" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

But Daffodil does throw an error on the above instance with this schema:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
        dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
        <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="4" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Is that a bug in Daffodil?

/roger

Re: Bug in Daffodil?

Posted by "Beckerle, Mike" <mb...@owlcyberdefense.com>.
I was able to recreate this bug.

I think​ it's the same as https://issues.apache.org/jira/browse/DAFFODIL-2217, if not well both are in the same part of the code base, so I've added test cases to daffodil which illustrate this additional symptom and updated the JIRA ticket to point them out as well.


________________________________
From: Beckerle, Mike <mb...@owlcyberdefense.com>
Sent: Tuesday, April 20, 2021 10:37 AM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: Re: Bug in Daffodil?

Yes, I think there is a bug.

I will try to recreate on 3.1.0 development branch.
________________________________
From: Roger L Costello <co...@mitre.org>
Sent: Tuesday, April 20, 2021 9:13 AM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: Bug in Daffodil?

Hi Folks,

Consider a data format which specifies that instance documents must contain a sequence of 1 to 3 string data items and the data items are to be separated by forward slashes. If there is no data for the third data item and the data format specifies separatorSuppressionPolicy=trailingEmptyStrict, then this instance is invalid because it has a trailing separator:

        a/b/

Daffodil should throw an error with that instance, but doesn't.

On the other hand, if the data format specifies a sequence of 1 to 4 string data items, then Daffodil throws an error on the above instance.

That is, Daffodil does not throw an error on the above instance with this schema:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
        dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
        <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="3" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

But Daffodil does throw an error on the above instance with this schema:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
        dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
        <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="4" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Is that a bug in Daffodil?

/roger

Re: Bug in Daffodil?

Posted by "Beckerle, Mike" <mb...@owlcyberdefense.com>.
Yes, I think there is a bug.

I will try to recreate on 3.1.0 development branch.
________________________________
From: Roger L Costello <co...@mitre.org>
Sent: Tuesday, April 20, 2021 9:13 AM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: Bug in Daffodil?

Hi Folks,

Consider a data format which specifies that instance documents must contain a sequence of 1 to 3 string data items and the data items are to be separated by forward slashes. If there is no data for the third data item and the data format specifies separatorSuppressionPolicy=trailingEmptyStrict, then this instance is invalid because it has a trailing separator:

        a/b/

Daffodil should throw an error with that instance, but doesn't.

On the other hand, if the data format specifies a sequence of 1 to 4 string data items, then Daffodil throws an error on the above instance.

That is, Daffodil does not throw an error on the above instance with this schema:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
        dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
        <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="3" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

But Daffodil does throw an error on the above instance with this schema:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
        dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
        <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="4" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Is that a bug in Daffodil?

/roger