Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 515970

Summary: dev-perl/rename - perl-rename misbehaves with files that have spaces in name
Product: Gentoo Linux Reporter: Alexander Sergeyev <sergeev917>
Component: [OLD] DevelopmentAssignee: Gentoo Perl team <perl>
Status: RESOLVED FIXED    
Severity: normal CC: sergeev917
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://search.cpan.org/dist/rename/
Whiteboard:
Package list:
Runtime testing required: ---

Description Alexander Sergeyev 2014-07-01 08:13:39 UTC
Issue related to dev-perl/rename:
perl-rename gets names truncated when backup option used
Easy way to reproduce:
$ touch 'a   b  d' 'a b d'
$ perl-rename -n -b -V numbered -v 's/ +/ /g' *
backup: a b d -> a
a   b  d -> a b d

As can be seen backup name wasn't generated correctly.
If spaces goes away then everything works as expected:
$ touch 'azzzbzzd' 'azbzd'
$ perl-rename -n -v -b -V numbered -v 's/z+/z/g' *
backup: azbzd -> azbzd.~1~
azzzbzzd -> azbzd

Some looking around shows that problem in next lines:
167 ($old) = sort {($b=~/~(\d+)~$/)[0] <=> ($a=~/~(\d+)~$/)[0]} <$_.~*~>;
168 $old =~ s/~(\d+)~$/'~'.($1+1).'~'/e;

Perl version is 5.16.3.
Comment 1 Alexander Sergeyev 2014-07-01 18:49:26 UTC
Actually, upstream has same problem:
$ wget http://search.cpan.org/CPAN/authors/id/P/PE/PEDERST/rename-1.8.tar.gz
$ tar xvfa rename-1.8.tar.gz
$ cd rename-1.8/
$ perl Makefile.PL
$ make
$ cd .. && mkdir test && touch 'a   b  d' 'a b d'
$ ../rename-1.8/bin/rename -n -b -V numbered -v 's/ +/ /g' a*
backup: a b d -> a
a   b  d -> a b d

Or do I just get confused by "resolved upstream" status?
Comment 2 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2014-07-01 19:29:00 UTC
It is upstreams problem and Gentoo can't fix it.

https://wiki.gentoo.org/wiki/Bugzilla_HOWTO#Working_With_Your_Bug


> UPSTREAM - The bug cannot be fixed by the Gentoo development team, and have requested you take the problem upstream (the people that actually made the program) for review. Upstream has a few ways of handling bugs. These include mailing lists, IRC channels, and even bug reporting systems. If you're not sure how to contact them, ask in the bug and someone will point you to the right direction.

This reporting location is: https://rt.cpan.org/Dist/Display.html?Name=rename

Once this issue is fixed upstream, open a request to update to that version.
Comment 3 Alexander Sergeyev 2014-07-06 19:06:36 UTC
Upstream is fixed, new version could be found here:
http://search.cpan.org/CPAN/authors/id/P/PE/PEDERST/rename-1.9.tar.gz