Subject: | rename misbehaves with files that have spaces in name |
Date: | Tue, 1 Jul 2014 23:40:22 +0400 |
To: | bug-rename [...] rt.cpan.org |
From: | "Alexander E. Sergeev" <sergeev917 [...] gmail.com> |
Hi,
rename gets names truncated when backup option used and names contain
spaces. Way to reproduce:
$ touch 'a b d' 'a b d'
$ 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 go
away then everything works as expected:
$ touch 'azzzbzzd' 'azbzd'
$ perl-rename -n -b -V numbered -v 's/z+/z/g' *
backup: azbzd -> azbzd.~1~
azzzbzzd -> azbzd
For now I'm reader of perl, not writer -- so no patch here.
But 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;
--
Best regards, Alexander E. Sergeev.