Re: Repost: Possible problem with mv in fileutils 4.1

Jim Meyering <[email protected]>
Newsgroups gmane.comp.gnu.fileutils.bugs
Message-ID <[email protected]>
Dave Gotwisner <[email protected]> wrote:
> I reported this to the list on July 8th, but, having seen no followup,
> and still having the problem, I am reasking/re-reporting.
>
> There may be a problem with the 4.1 version of mv, when moving a file
> onto another read-only file.  In fileutils 4.0p (redhat 6.2) this
> failed, as expected.  In fileutils 4.1 (redhat 7.3) it succeeded, as it
> shouldn't have (my opinion).  Filesystem is an ext2 (for fu4.0p) and
> ext3 (for fu4.1), but I doubt that makes a difference.  Here is a simple
>
> test procedure:
>
> #!/bin/sh
> uname -a
> touch foo1 foo2
> chmod 400 foo1 foo2
>
> # This will generate an error, as expected:
> rm foo1
>
> # This will generate an error, as expected:
> cp foo1 foo2
>
> # The following command will perform incorrectly (imho), actually
> # removing foo2, and replacing it with the contents of foo1.  Foo1
> # (the name, not the inode) will no longer exist.
> mv foo1 foo2

Thanks for the (repeat) report.
This is fixed in the latest test release.

  ftp://alpha.gnu.org/gnu/fetish/fileutils-4.1.11.tar.gz

    $ touch foo1 foo2
    $ chmod 400 foo1 foo2
    $ rm foo1
    rm: remove write-protected regular empty file `foo1'? n
    $ cp foo1 foo2
    cp: cannot create regular file `foo2': Permission denied
    [Exit 1]
    $ mv foo1 foo2
    mv: overwrite `foo2', overriding mode 0400?
    [Exit 130 (SIGINT)]
    $ mv --version
    mv (fileutils) 4.1.11
    Written by Mike Parker, David MacKenzie, and Jim Meyering.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.