Project

General

Profile

Actions

Bug #13158

open

mv treats target_dir/ as file if it doesn't exist

Added by xto uqh over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

Quoting POSIX:

SYNOPSIS

    mv [-if] source_file target_file

    mv [-if] source_file... target_dir

DESCRIPTION

    In the first synopsis form, the mv utility shall move the file named by the source_file operand to the destination specified by the target_file.
    This first synopsis form is assumed when the final operand does not name an existing directory and is not a symbolic link referring to an
    existing directory. In this case, if source_file names a non-directory file and target_file ends with a trailing <slash> character, mv shall treat
    this as an error and no source_file operands will be processed.

However:

$ /bin/touch a
$ /bin/ls -ld b/
b/: No such file or directory
$ /bin/mv a b/
$ /bin/ls -ld b/
b/: Not a directory

The /usr/xpg4/bin/mv behaves the same.

No data to display

Actions

Also available in: Atom PDF