Summary: | [patch] [libc] rmdir(2) and mkdir(2) both return EISDIR for argument "/" | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Andreas Fuchs <asf> | ||||||
Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||
Status: | Open --- | ||||||||
Severity: | Affects Only Me | CC: | bapt, ngie, phil, zkliuchaojie | ||||||
Priority: | Normal | Keywords: | patch | ||||||
Version: | Unspecified | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
Andreas Fuchs
2003-11-27 21:20:13 UTC
State Changed From-To: open->suspended Mark as 'suspended' since this does not seem as though it is being actively worked on. Hi, we at Gentoo/FreeBSD just ran into this issue with a script that had worked on Linux, since it expected EEXIST for all dirs (it did not expect EISDIR when trying to mkdir an existing dir when it hit "/"). We have fixed it, but since the mkdir/rmdir man pages do not specify EISDIR as a potential error code - and just for correctness/compatibility reasons - my feeling is that it would be good to fix this issue. I also have no experience hacking FreeBSD kernel or userland utilities, so I have not pursued providing a patch. Sorry if this follow-up is not useful without having a patch. -Thanks, Joe this problem still exists under 9-current. the following test app: #include <sys/stat.h> #include <errno.h> #include <stdio.h> #include <unistd.h> main() { rmdir("/"); printf("rmdir errno: %d\n", errno); mkdir("/", 511); printf("mkdir errno: %d\n", errno); } produces this output: rmdir errno: 21 mkdir errno: 21 which is EISDIR (as reported by Andreas Fuchs). could somebody please check if the attached patch is sufficient to solve this problem? with the patch the test app now outputs: rmdir errno: 16 mkdir errno: 17 16 being EBUSY and 17 being EEXIST. this is what Andreas Fuchs suggested. cheers. alex the patch supplied in the previous followup is currently being discussed in this thread: http://lists.freebsd.org/pipermail/freebsd-hackers/2009-November/029928.html a final patch will be supplied in the next few days as followup to this problem report. thus please ignore the previous patch. alex State Changed From-To: suspended->open There is now an open thread dicussing the patch (see Audit-Trail). after discussing this problem in the thread mentioned in the previous followup it was decide to move all changes to sys/kern/vfs_syscalls.c in order not to break any code which relies on namei() returning EISDIR. attached you'll find the final patch (which supersedes the previous one). this patch doesn't require any changes to the rename(2), mkdir(2) or rmdir(2) manuals. please set this pr into analysed state. alex State Changed From-To: open->analyzed A patch has been circulated and an approach agreed on. new discussion with new patch by jh@: http://lists.freebsd.org/pipermail/freebsd-hackers/2010-February/030904.html alex i think this issue got fixed in r205682. please mark patched and assign to jh@ as MFC reminder. -- Alexander Best State Changed From-To: analyzed->patched Apparently jh committed a patch. Assign and set to patched as MFC reminder. Responsible Changed From-To: freebsd-bugs->jh State Changed From-To: patched->analyzed false alarm, it seems. Responsible Changed From-To: jh->freebsd-bugs This seems to have been regressed again: $ mkdir / mkdir: /: Is a directory $ mkdir /var mkdir: /var: File exists -Garrett Hi, it still a valid problem, at least in 8.1 and 9.0 releases. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=675768 Petr State Changed From-To: analyzed->open this is still a bug Still the case, I think: $ uname -a FreeBSD fbsd11 11.0-CURRENT FreeBSD 11.0-CURRENT #7 r289441+9ae1597(isilon-atf): Sat Oct 17 01:21:49 PDT 2015 ngie@fbsd11:/usr/obj/usr/src/git/sys/GENERIC-NODEBUG amd64 $ sudo rmdir / rmdir: /: Is a directory $ sudo mkdir / mkdir: /: Is a directory bapt might have a patch in the wings for fixing this. I'm sorry but I have nothing in the wings :( For bugs matching the following conditions: - Status == In Progress - Assignee == "bugs@FreeBSD.org" - Last Modified Year <= 2017 Do - Set Status to "Open" 13.1-RELEASE. The bug is still there. Keyword: patch or patch-ready – in lieu of summary line prefix: [patch] * bulk change for the keyword * summary lines may be edited manually (not in bulk). Keyword descriptions and search interface: <https://bugs.freebsd.org/bugzilla/describekeywords.cgi> |