Skip to content

->move_to broken/inconsistent if destination is a directory. #50

@hillu

Description

@hillu

Situation at start, on Debian GNU/Linux:

$ ls -ld /tmp/x /tmp/y
-rw-r--r-- 1 bengen bengen    0 Feb 26 15:18 /tmp/x
drwxr-xr-x 2 bengen bengen 4096 Feb 26 15:14 /tmp/y

Using Path::Class 0.37, doing something like

$x = file("/tmp/x"); $x->move_to("/tmp/y");

moves the file into the directory /tmp/y, so we end up with a file /tmp/y/x, but updates the Path::Class::File object like this:

VAR1 = bless( {
                 'file' => 'y',
                 'file_spec_class' => undef,
                 'dir' => bless( {
                                   'volume' => '',
                                   'file_spec_class' => undef,
                                   'dirs' => [
                                               '',
                                               'tmp'
                                             ]
                                 }, 'Path::Class::Dir' )
               }, 'Path::Class::File' );

I'd expect the operation to fail (like it would when using CORE::rename or POSIX::rename) or to update the name correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions