Subject: | rename cannot backup files |
Date: | Sun, 11 Apr 2010 00:59:35 +0400 |
To: | bug-rename [...] rt.cpan.org |
From: | Evgeniy Zhemchugov <jini.zh [...] gmail.com> |
rename version: 1.6
Perl version: v5.10.1 (*) built for x86_64-linux
Consider the following shell session:
[test]> ls
[test]> touch a b
[test]> rename -b 's/b/a/' b
rename: cannot create `a':
[test]> ls
a~ b
The problem is in the following snippet of code in bin/rename.PL:
unless ($nothing) {
if (rename($_,$old)) {
warn "$ME: cannot create `$_': $!\n";
next;
}
}
Perl rename function returns true for success, false otherwise,
however this code assumes the opposite behaviour. The fix is in the
attachement.
Message body is not shown because sender requested not to inline it.