unexpected behaviour

Friday, 7 November 2014 · 8 messages · last reply 8 Nov 2014
RS
Rob Stapper7 Nov 2014 18:00 #

Hi,

Running the attached program produces the next evaluation.

Evaluating:

- elementSeq: <A ref="var1"><B><X1/></B></A>

- content0: <X1/>

- content2: <X1/>

- elementSeq: <A ref="var1"><B><X2/></B></A>

- content0: <X2/>

- content2: <X1/>

I can't explain the value of the last "- content2: "-trace.

I expect it to be the same value as the last "- content0: "-trace.

What's happening here?

- Rob Stapper

--- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com

CG
Christian Grün7 Nov 2014 18:04 #

Hi Rob,

thanks for the example code. Could you possibly reduce it to a shorter snippet that still demonstrates the surprising behavior?

Best, Christian

Quoted text · Rob Stapper · 47 lines
On Fri, Nov 7, 2014 at 6:00 PM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: > Hi, > > > > Running the attached program produces the next evaluation. > > > > Evaluating: > > - elementSeq: <A ref="var1"><B><X1/></B></A> > > - content0: <X1/> > > - content2: <X1/> > > - elementSeq: <A ref="var1"><B><X2/></B></A> > > - content0: <X2/> > > - content2: <X1/> > > > > I can’t explain the value of the last “- content2: ”-trace. > > I expect it to be the same value as the last “- content0: ”-trace. > > > > What’s happening here? > > > > - Rob Stapper > > > > > ------------------------------ > <http://www.avast.com/> > > Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus > <http://www.avast.com/> actief is. > >
RS
Rob Stapper8 Nov 2014 09:20 #

Hi Christan,

I already have reduced the code significantly. I can give it another go.

In the meanwhile please not parameter: “$element.content” in the function: “$go”.

Nowhere in the function is the parameter reassigned another value, yet the value is changed at the “content2”-trace.

- Rob

Quoted text · Christian Grün · 29 lines
Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: vrijdag 7 november 2014 18:04 Aan: Rob Stapper CC: BaseX Onderwerp: Re: [basex-talk] unexpected behaviour Hi Rob, thanks for the example code. Could you possibly reduce it to a shorter snippet that still demonstrates the surprising behavior? Best, Christian On Fri, Nov 7, 2014 at 6:00 PM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: Hi, Running the attached program produces the next evaluation. Evaluating: - elementSeq: <A ref="var1"><B><X1/></B></A> - content0: <X1/> - content2: <X1/> - elementSeq: <A ref="var1"><B><X2/></B></A> - content0: <X2/> - content2: <X1/> I can’t explain the value of the last “- content2: ”-trace. I expect it to be the same value as the last “- content0: ”-trace. What’s happening here? - Rob Stapper _____ <http://www.avast.com/> Afbeelding verwijderd door afzender. Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus <http://www.avast.com/> actief is. --- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
RS
Rob Stapperin reply to Christian Grün, 7 Nov 2014, 18:048 Nov 2014 09:38 #

Ok,

I’ve reduced code until I got the correct result.

I send you a version with: “test_with_correct_result.xq”, and a version without: “test_with_wrong_result.xq”, this last reduction.

Hopefully this is clear enough to demonstrate and pinpoint the problem.

Eager to hear from you,

Rob

Quoted text · Christian Grün · 29 lines
Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: vrijdag 7 november 2014 18:04 Aan: Rob Stapper CC: BaseX Onderwerp: Re: [basex-talk] unexpected behaviour Hi Rob, thanks for the example code. Could you possibly reduce it to a shorter snippet that still demonstrates the surprising behavior? Best, Christian On Fri, Nov 7, 2014 at 6:00 PM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: Hi, Running the attached program produces the next evaluation. Evaluating: - elementSeq: <A ref="var1"><B><X1/></B></A> - content0: <X1/> - content2: <X1/> - elementSeq: <A ref="var1"><B><X2/></B></A> - content0: <X2/> - content2: <X1/> I can’t explain the value of the last “- content2: ”-trace. I expect it to be the same value as the last “- content0: ”-trace. What’s happening here? - Rob Stapper _____ <http://www.avast.com/> Afbeelding verwijderd door afzender. Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus <http://www.avast.com/> actief is. --- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
RS
Rob Stapperin reply to Christian Grün, 7 Nov 2014, 18:048 Nov 2014 09:54 #

Or another reduction that results in the expected result.

- Rob

Quoted text · Christian Grün · 29 lines
Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: vrijdag 7 november 2014 18:04 Aan: Rob Stapper CC: BaseX Onderwerp: Re: [basex-talk] unexpected behaviour Hi Rob, thanks for the example code. Could you possibly reduce it to a shorter snippet that still demonstrates the surprising behavior? Best, Christian On Fri, Nov 7, 2014 at 6:00 PM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: Hi, Running the attached program produces the next evaluation. Evaluating: - elementSeq: <A ref="var1"><B><X1/></B></A> - content0: <X1/> - content2: <X1/> - elementSeq: <A ref="var1"><B><X2/></B></A> - content0: <X2/> - content2: <X1/> I can’t explain the value of the last “- content2: ”-trace. I expect it to be the same value as the last “- content0: ”-trace. What’s happening here? - Rob Stapper _____ <http://www.avast.com/> Afbeelding verwijderd door afzender. Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus <http://www.avast.com/> actief is. --- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
RS
Rob Stapperin reply to Christian Grün, 7 Nov 2014, 18:048 Nov 2014 10:00 #

Sorry about the previous mail. That reduced version also produces the wrong outcome. A renamed version is attached.

- Rob

Quoted text · Rob Stapper · 36 lines
Van: Rob Stapper [mailto:r.stapper at lijbrandt.nl] Verzonden: zaterdag 8 november 2014 9:54 Aan: 'Christian Grün' CC: 'BaseX' Onderwerp: RE: [basex-talk] unexpected behaviour Or another reduction that results in the expected result. - Rob Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: vrijdag 7 november 2014 18:04 Aan: Rob Stapper CC: BaseX Onderwerp: Re: [basex-talk] unexpected behaviour Hi Rob, thanks for the example code. Could you possibly reduce it to a shorter snippet that still demonstrates the surprising behavior? Best, Christian On Fri, Nov 7, 2014 at 6:00 PM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: Hi, Running the attached program produces the next evaluation. Evaluating: - elementSeq: <A ref="var1"><B><X1/></B></A> - content0: <X1/> - content2: <X1/> - elementSeq: <A ref="var1"><B><X2/></B></A> - content0: <X2/> - content2: <X1/> I can’t explain the value of the last “- content2: ”-trace. I expect it to be the same value as the last “- content0: ”-trace. What’s happening here? - Rob Stapper _____ <http://www.avast.com/> Afbeelding verwijderd door afzender. Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus <http://www.avast.com/> actief is. --- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
RS
Rob Stapperin reply to Christian Grün, 7 Nov 2014, 18:048 Nov 2014 10:49 #

Hi Christian,

Attached the most reduced version with wrong result.

Success ;-)

Rob

Quoted text · Christian Grün · 29 lines
Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: vrijdag 7 november 2014 18:04 Aan: Rob Stapper CC: BaseX Onderwerp: Re: [basex-talk] unexpected behaviour Hi Rob, thanks for the example code. Could you possibly reduce it to a shorter snippet that still demonstrates the surprising behavior? Best, Christian On Fri, Nov 7, 2014 at 6:00 PM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: Hi, Running the attached program produces the next evaluation. Evaluating: - elementSeq: <A ref="var1"><B><X1/></B></A> - content0: <X1/> - content2: <X1/> - elementSeq: <A ref="var1"><B><X2/></B></A> - content0: <X2/> - content2: <X1/> I can’t explain the value of the last “- content2: ”-trace. I expect it to be the same value as the last “- content0: ”-trace. What’s happening here? - Rob Stapper _____ <http://www.avast.com/> Afbeelding verwijderd door afzender. Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus <http://www.avast.com/> actief is. --- Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is. http://www.avast.com
CG
Christian Grün8 Nov 2014 10:56 #

Here's another one:

  for $n in (<a/>, <b/>)
  let $f := function() as element()* { trace($n) }
  return $f()

It seems as if the combination of trace() and the wildcard in the function return type causes this bug. I have just another GitHub issue [1].

Thanks, Christian

[1] https://github.com/BaseXdb/basex/issues/1023

Quoted text · Rob Stapper · 101 lines
On Sat, Nov 8, 2014 at 10:49 AM, Rob Stapper <r.stapper at lijbrandt.nl> wrote: > Hi Christian, > > > > Attached the most reduced version with wrong result. > > > > Success ;-) > > Rob > > > > *Van:* Christian Grün [mailto:christian.gruen at gmail.com] > *Verzonden:* vrijdag 7 november 2014 18:04 > *Aan:* Rob Stapper > *CC:* BaseX > *Onderwerp:* Re: [basex-talk] unexpected behaviour > > > > Hi Rob, > > > > thanks for the example code. Could you possibly reduce it to a shorter > snippet that still demonstrates the surprising behavior? > > > > Best, > > Christian > > > > > > On Fri, Nov 7, 2014 at 6:00 PM, Rob Stapper <r.stapper at lijbrandt.nl> > wrote: > > Hi, > > > > Running the attached program produces the next evaluation. > > > > Evaluating: > > - elementSeq: <A ref="var1"><B><X1/></B></A> > > - content0: <X1/> > > - content2: <X1/> > > - elementSeq: <A ref="var1"><B><X2/></B></A> > > - content0: <X2/> > > - content2: <X1/> > > > > I can’t explain the value of the last “- content2: ”-trace. > > I expect it to be the same value as the last “- content0: ”-trace. > > > > What’s happening here? > > > > - Rob Stapper > > > > > ------------------------------ > > [image: Afbeelding verwijderd door afzender.] <http://www.avast.com/> > > Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus > <http://www.avast.com/> actief is. > > > > > > > ------------------------------ > <http://www.avast.com/> > > Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus > <http://www.avast.com/> actief is. > >

⚡Generated with XQuery