Skip to content

bug in Stangle(split=TRUE)

2 messages · Roger D. Peng, Friedrich Leisch

#
[I originally emailed this to Friedrich Leisch but got no response and I 
just wanted to make sure it made it in before release.]

While working with Stangle(), I noticed a problem when using 'split = 
TRUE'.  Particularly, when there are two chunks where one chunk's name 
is a prefix of another chunk's name, then the two chunks will be written 
to a single file rather than two separate files (if the chunk who's name 
is a prefix comes after the other chunk).  Running 'Stangle(split=TRUE)' 
with the attached 'test1.Rnw' file should reproduce the problem.

I think it boils down to a partial matching problem in 'RtangleRuncode'. 
  I've attached a patch against R-alpha (r41020) which I think fixes 
this problem but I'm not sure it's necessarily the best approach (there 
are other instances of this construction in the code).

-roger
4 days later
#
> [I originally emailed this to Friedrich Leisch but got no response

Sorry, was on easter vacation and have not fully suceeded to go through
all mails in my inbox yet.

  > and I 
  > just wanted to make sure it made it in before release.]

  > While working with Stangle(), I noticed a problem when using 'split = 
  > TRUE'.  Particularly, when there are two chunks where one chunk's name 
  > is a prefix of another chunk's name, then the two chunks will be written 
  > to a single file rather than two separate files (if the chunk who's name 
  > is a prefix comes after the other chunk).  Running 'Stangle(split=TRUE)' 
  > with the attached 'test1.Rnw' file should reproduce the problem.

  > I think it boils down to a partial matching problem in 'RtangleRuncode'. 
  >   I've attached a patch against R-alpha (r41020) which I think fixes 
  > this problem but I'm not sure it's necessarily the best approach (there 
  > are other instances of this construction in the code).

Same bug was also affecting Sweave. Fixed in the 2.5 and 2.6 branches,
thanks a lot for the report.

Best,
Fritz