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 As noted, the "rm" will generate "rm: remove write-protected file `foo1'?" which is as expected. The "cp" generates a "cp: cannot create regular file `foo2': Permission denied" message, which is also as expected. With fu4.0p, the "mv" generates "mv: overwrite `foo2', overriding mode 0400?' which is correct. fu4.1 generates no error and renames the file. If I do strace's of the two mv commands, the old one checked for permissions prior to moving, the new does not (which I feel is wrong). Is this a bug, or am I mistaken? Note that in looking at the code, it looks like it calls some internal glibc functions, which may be (and probably are) at fault, but I thought that I would check here first. Thanks, Dave ################################## ################################## ################################## ################################## Fileutils 4.0p strace: execve("/bin/mv", ["mv", "foo1", "foo2"], [/* 26 vars */]) = 0 brk(0) = 0x80531f0 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000 open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=34685, ...}) = 0 old_mmap(NULL, 34685, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40015000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0755, st_size=4101324, ...}) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\210\212"..., 4096) = 4096 old_mmap(NULL, 1001564, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001e000 mprotect(0x4010b000, 30812, PROT_NONE) = 0 old_mmap(0x4010b000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xec000) = 0x4010b000 old_mmap(0x4010f000, 14428, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4010f000 close(3) = 0 mprotect(0x4001e000, 970752, PROT_READ|PROT_WRITE) = 0 mprotect(0x4001e000, 970752, PROT_READ|PROT_EXEC) = 0 munmap(0x40015000, 34685) = 0 personality(PER_LINUX) = 0 getpid() = 17107 brk(0) = 0x80531f0 brk(0x8053228) = 0x8053228 brk(0x8054000) = 0x8054000 open("/usr/share/locale/locale.alias", O_RDONLY) = 3 fstat64(0x3, 0xbfffb6ac) = -1 ENOSYS (Function not implemented) fstat(3, {st_mode=S_IFREG|0644, st_size=2265, ...}) = 0 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40015000 read(3, "# Locale name alias data base.\n#"..., 4096) = 2265 read(3, "", 4096) = 0 close(3) = 0 munmap(0x40015000, 4096) = 0 open("/usr/share/i18n/locale.alias", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_US/LC_MESSAGES", O_RDONLY) = 3 fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 close(3) = 0 open("/usr/share/locale/en_US/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=44, ...}) = 0 old_mmap(NULL, 44, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40015000 close(3) = 0 open("/usr/share/locale/en_US/LC_MONETARY", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=93, ...}) = 0 old_mmap(NULL, 93, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40016000 close(3) = 0 open("/usr/share/locale/en_US/LC_COLLATE", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=29970, ...}) = 0 old_mmap(NULL, 29970, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40113000 close(3) = 0 brk(0x8055000) = 0x8055000 open("/usr/share/locale/en_US/LC_TIME", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=508, ...}) = 0 old_mmap(NULL, 508, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000 close(3) = 0 open("/usr/share/locale/en_US/LC_NUMERIC", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=27, ...}) = 0 old_mmap(NULL, 27, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000 close(3) = 0 open("/usr/share/locale/en_US/LC_CTYPE", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=87756, ...}) = 0 old_mmap(NULL, 87756, PROT_READ, MAP_PRIVATE, 3, 0) = 0x4011b000 close(3) = 0 geteuid() = 500 umask(0) = 02 stat("foo2", {st_mode=S_IFREG|0400, st_size=0, ...}) = 0 lstat("foo1", {st_mode=S_IFREG|0400, st_size=0, ...}) = 0 lstat("foo2", {st_mode=S_IFREG|0400, st_size=0, ...}) = 0 access("foo2", W_OK) = -1 EACCES (Permission denied) open("/usr/share/locale/en_US/LC_MESSAGES/fileutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/fileutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "mv: overwrite `foo2\', overriding"..., 44mv: overwrite `foo2', overriding mode 0400? ) = 44 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40019000 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0 read(0, "\n", 1024) = 1 brk(0x8056000) = 0x8056000 _exit(1) = ? ################################## ################################## ################################## ################################## The strace for the 4.1 fileutils is the following: execve("/bin/mv", ["mv", "foo1", "foo2"], [/* 30 vars */]) = 0 uname({sys="Linux", node="dellunix.gotwisner.net", ...}) = 0 brk(0) = 0x8053a04 open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=118112, ...}) = 0 old_mmap(NULL, 118112, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40014000 close(3) = 0 open("/lib/i686/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`u\1B4\0"..., 1024) = 1024 fstat64(3, {st_mode=S_IFREG|0755, st_size=1401027, ...}) = 0 old_mmap(0x42000000, 1264928, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x42000000 mprotect(0x4212c000, 36128, PROT_NONE) = 0 old_mmap(0x4212c000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12c000) = 0x4212c000 old_mmap(0x42131000, 15648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x42131000 close(3) = 0 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40031000 munmap(0x40014000, 118112) = 0 brk(0) = 0x8053a04 brk(0x8053a34) = 0x8053a34 brk(0x8054000) = 0x8054000 geteuid32() = 500 umask(0) = 02 stat64("foo2", {st_mode=S_IFREG|0400, st_size=0, ...}) = 0 brk(0x8055000) = 0x8055000 lstat64("foo1", {st_mode=S_IFREG|0400, st_size=0, ...}) = 0 lstat64("foo2", {st_mode=S_IFREG|0400, st_size=0, ...}) = 0 rename("foo1", "foo2") = 0 _exit(0) = ? _______________________________________________ Bug-fileutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-fileutils