lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <47ED8858.9000401@froyn.name>
Date:	Sat, 29 Mar 2008 01:07:52 +0100
From:	Ketil Froyn <ketil@...yn.name>
To:	linux-kernel@...r.kernel.org
Subject: unexpected rename() behaviour

Hi,

The following behaviour was unexpected (tested on Debian/ext3):

$ echo 1 > 1
$ ln 1 2
$ cat 2
1
$ ./rename 2 1
$ echo $?
0
$ cat 2
1

The code for ./rename is simple:

---
/* compile: gcc -o rename rename.c */
#include <stdio.h>
int main(int argc, char *argv[]) { return rename(argv[1], argv[2]); }
---

I thought this must be wrong behaviour, but I have been unable to 
confirm what the correct result should be in this special case. rename() 
returns success, but the source file is intact, which seems odd. The 
"mv" command specifically checks for cases like this and calls 
unlink("2") instead of rename("2", "1"). Are all applications meant to 
do this? What standards describe what rename() should do in cases like this?

Regards,
Ketil Froyn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ