Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text::Template 1.48,1.49 breaks Dist::Milla #8

Closed
skaji opened this issue Feb 10, 2018 · 6 comments
Closed

Text::Template 1.48,1.49 breaks Dist::Milla #8

skaji opened this issue Feb 10, 2018 · 6 comments

Comments

@skaji
Copy link

skaji commented Feb 10, 2018

Text::Template 1.48,1.49 breaks Dist::Milla's milla new command:

$ milla new Foo
[DZ] making target dir /Users/skaji/src/github.com/miyagawa/Dist-Milla/Foo
[Milla::MintFiles] Filling in the template returned undef for:
[Milla::MintFiles] Revision history for {{ $dist->name }}
[Milla::MintFiles]
[Milla::MintFiles] {{ '{{$NEXT}}' }}
[Milla::MintFiles]         - Initial release
...
$ echo $?
255

The following script shows difference between 1.46 and 1.49, which actually breaks Dist::Milla.

# test.pl
use strict;
use warnings;
use Text::Template;

printf "perl %s, Text::Template %s\n", $^V, Text::Template->VERSION;

my $tmpl = Text::Template->new(
    TYPE       => 'STRING',
    SOURCE     => q| {{ '{{$NEXT}}' }} |,
    DELIMITERS => [ '{{', '}}' ],
);

my $content = $tmpl->fill_in;
print "Result: ", $content // '(undef)', "\n";
$ perl test.pl
perl v5.26.1, Text::Template 1.46
Result:  {{$NEXT}}

$ perl test.pl
perl v5.26.1, Text::Template 1.47
Result:  {{$NEXT}}

$ perl test.pl
perl v5.26.1, Text::Template 1.48
Result: (undef)

$ perl test.pl
perl v5.26.1, Text::Template 1.49
Result: (undef)
@mschout
Copy link
Owner

mschout commented Feb 10, 2018

72f457f is the first bad commit
commit 72f457f
Author: Michael Schout mschout@gkg.net
Date: Wed Jan 3 16:57:40 2018 -0600

allow start/end delimiters to be identical

This allows the start/end delimiters to be identical.
E.g.: DELIMITERS => [ '@@', '@@' ] now works.

Fixes RT #46639

:100644 100644 2e425e38fcf676dab990310ed27fd146da2b7e72 8e62fbfef8a626ddacab4abbfd0baaead088e97c M Changes
:040000 040000 9ccc2a5998632aae2e6588bf7e482e324ca8335d 1e6f9c8b7957882f587a7a00146bc8f2b6b2e6d0 M lib
:040000 040000 6368e686dcec952a20c704dd06b04a1e3a7088be d8fe7ca3568c622eb4dfc6838441a35bb511a5a5 M t

@mschout
Copy link
Owner

mschout commented Feb 10, 2018

Basically the way that change was implemented breaks cases where you have nested tags such as this example.

Given the severity of the breakage, and how recently this was added, I'm inclined to revert it and release a version without the same start/end tag feature for now and revisit that in the future.

@skaji
Copy link
Author

skaji commented Feb 11, 2018

@mschout Thanks for looking into this.

I'm inclined to revert it and release a version without the same start/end tag feature for now and revisit that in the future.

I agree.

mschout added a commit that referenced this issue Feb 11, 2018
  *** Revert support for identical start/end delimiters (e.g.: @@foo@@, XXfooXX)
      due to breakage with nested tags (see
      #8).  Will revisit
      this in a future release.
@mschout
Copy link
Owner

mschout commented Feb 11, 2018

reverted and released in v1.50, just released.

@mschout
Copy link
Owner

mschout commented Feb 11, 2018

sorry for the multi-hour delay. U-verse sh*t the bed here. :)

@mschout mschout closed this as completed Feb 11, 2018
@mschout mschout reopened this Feb 11, 2018
@skaji
Copy link
Author

skaji commented Feb 11, 2018

@mschout I confirmed that milla new works fine with Text::Template 1.50.
I'm closing this issue. Thanks!

@skaji skaji closed this as completed Feb 11, 2018
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Feb 20, 2018
Upstream changes:
1.50  2018-02-10
  *** Revert support for identical start/end delimiters (e.g.: @@foo@@, XXfooXX)
      due to breakage with nested tags (see
      mschout/perl-text-template#8).  Will revisit
      this in a future release.

1.49  2018-02-07
    - Fix failing tests in v1.48 under perl < 5.8.9

1.48  2018-02-07
    - remove COPYING and Artistic files from the dist.  These are replaced by
      the Dist::Zilla generated LICENSE file.
    - use strict/warnings (thanks Mohammad S Anwar)
    - remove $VERSION checks from tests. This makes it easier to run the test
      with Dist::Zilla and avoids maintenance issue of updating the tests for
      each release (Thanks Andrew Ruder).
    - Allow precompiled templates to work with preprocessing [#29928] (Thanks
      Nik LaBelle)
    - Add "strict" option to fill_in().  This adds "use strict" and "use vars
      (...)" to the prepend section, and only the keys of the HASH option are
      allowed in the template.  (Thanks Desmond Daignault, Kivanc Yazan, CJM)
      [55696]
    - Fix templates with inline comments without newline after comment for perl
      < 5.18 [34292]
    - Don't use bareword file handles
    - use three arg form of open()
    - Fix BROKEN behaviour so that it returns the text accumulated so far on
      undef as documented [28974]
    - Source code cleanups
    - Minimum perl version is now 5.8.0
    - Allow start/end delimiters to be identical (e.g.: @@foo@@, XXfooXX)
      (Thanks mirod) [46639]
    - Fix + document the FILENAME parameter to fill_in() (Thanks VDB) [106093]
    - Test suite cleanups:
        + turn on strict/warnings for all tests
        + run tests through perltidy and formatting cleanup
        + remove number prefixes from test names
        + use Test::More instead of generating TAP by hand
        + use three-arg form of open()
        + don't use indirect object syntax
        + don't use bareword file handles
        + use File::Temp to generate temporary files
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Feb 24, 2018
Upstream changes:
1.50  2018-02-10
  *** Revert support for identical start/end delimiters (e.g.: @@foo@@, XXfooXX)
      due to breakage with nested tags (see
      mschout/perl-text-template#8).  Will revisit
      this in a future release.

1.49  2018-02-07
    - Fix failing tests in v1.48 under perl < 5.8.9

1.48  2018-02-07
    - remove COPYING and Artistic files from the dist.  These are replaced by
      the Dist::Zilla generated LICENSE file.
    - use strict/warnings (thanks Mohammad S Anwar)
    - remove $VERSION checks from tests. This makes it easier to run the test
      with Dist::Zilla and avoids maintenance issue of updating the tests for
      each release (Thanks Andrew Ruder).
    - Allow precompiled templates to work with preprocessing [#29928] (Thanks
      Nik LaBelle)
    - Add "strict" option to fill_in().  This adds "use strict" and "use vars
      (...)" to the prepend section, and only the keys of the HASH option are
      allowed in the template.  (Thanks Desmond Daignault, Kivanc Yazan, CJM)
      [55696]
    - Fix templates with inline comments without newline after comment for perl
      < 5.18 [34292]
    - Don't use bareword file handles
    - use three arg form of open()
    - Fix BROKEN behaviour so that it returns the text accumulated so far on
      undef as documented [28974]
    - Source code cleanups
    - Minimum perl version is now 5.8.0
    - Allow start/end delimiters to be identical (e.g.: @@foo@@, XXfooXX)
      (Thanks mirod) [46639]
    - Fix + document the FILENAME parameter to fill_in() (Thanks VDB) [106093]
    - Test suite cleanups:
        + turn on strict/warnings for all tests
        + run tests through perltidy and formatting cleanup
        + remove number prefixes from test names
        + use Test::More instead of generating TAP by hand
        + use three-arg form of open()
        + don't use indirect object syntax
        + don't use bareword file handles
        + use File::Temp to generate temporary files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants