Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 49567
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: dgp [...] corefiling.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: ttree 2.22 --copy option behaviour change, with --accept
Date: Wed, 09 Sep 2009 17:24:18 +0100
To: bug-Template-Toolkit [...] rt.cpan.org
From: Daniel Piddock <dgp [...] corefiling.com>
ttree 2.22 has a logic change in process_tree causing files to be skipped if they are not in the --accept list, even if they are in --copy. In 2.19 I could use "ttree -s src -d out -r --accept=\.html$ --copy='\.(jpg|gif|css)$'" and it works as documented: ############# ttree 2.9 (Template Toolkit version 2.19) Source: src Destination: out Include Path: [ ] Ignore: [ ] Copy: [ \.(jpg|gif|css)$ ] Accept: [ .html$ ] Suffix: [ ] + index.html Show quoted text
> logo.jpg (copied, matches /\.(jpg|gif|css)$/) > img.gif (copied, matches /\.(jpg|gif|css)$/)
############# But 2.22 skips files in copy: ############# ttree 2.9 (Template Toolkit version 2.22) Source: src Destination: out Include Path: [ ] Ignore: [ ] Copy: [ \.(jpg|gif|css)$ ] Accept: [ .html$ ] Suffix: [ ] + index.html - logo.jpg (not accepted) - img.gif (not accepted) Summary: 1 file processed 0 files copied 0 directories created 0 files skipped (not modified) 2 files skipped (ignored) ############# Also attaching a simple patch that returns to the 1.19 (and documented) behaviour. -- Daniel Piddock, System Administrator, CoreFiling Limited http://www.corefiling.com
diff -ruN 2.22/ttree mine/ttree --- 2.22/ttree 2009-09-09 17:20:20.539677587 +0100 +++ mine/ttree 2009-09-09 17:17:57.451717844 +0100 @@ -296,16 +296,6 @@ } } - # check against acceptance list - if (@$accept) { - unless ((-d $abspath && $recurse) || grep { $path =~ /$_/ } @$accept) { - printf yellow(" - %-32s (not accepted)\n"), $path - if $verbose > 1; - $n_skip++; - next FILE; - } - } - if (-d $abspath) { if ($recurse) { my ($uid, $gid, $mode); @@ -383,6 +373,16 @@ } } + # check against acceptance list + if (not $copy_file and @$accept) { + unless (grep { $filename =~ /$_/ } @$accept) { + printf yellow(" - %-32s (not accepted)\n"), $file + if $verbose > 1; + $n_skip++; + return; + } + } + # stat the source file unconditionally, so we can preserve # mode and ownership ( undef, undef, $mode, undef, $uid, $gid, undef,
On Wed Sep 09 12:24:48 2009, dgp@corefiling.com wrote: Show quoted text
> ttree 2.22 has a logic change in process_tree causing files to be > skipped if they are not in the --accept list, even if they are in --
copy. Hey hey. Any hope of getting a fix for this bug into a release of TT? This has been breaking our website build for a *really* long time now every time we accidentally upgrade our TT.
An easy workaround is to just add "." to the accept list. Recursion works properly along with filters like "copy \.html$" On Thu Jul 22 04:34:23 2010, MKANAT wrote: Show quoted text
> On Wed Sep 09 12:24:48 2009, dgp@corefiling.com wrote:
> > ttree 2.22 has a logic change in process_tree causing files to be > > skipped if they are not in the --accept list, even if they are in --
> copy. > > Hey hey. Any hope of getting a fix for this bug into a release of TT? > This has been breaking our website build for a *really* long time now > every time we accidentally upgrade our TT.
Ticket migrated to github as https://github.com/abw/Template2/issues/148