public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ludo at gnu dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/11276] New: remove(3) fails when unlink(2) returns `EPERM'
Date: Fri, 12 Feb 2010 09:51:00 -0000	[thread overview]
Message-ID: <20100212095058.11276.ludo@gnu.org> (raw)

Currently sysdeps/posix/remove.c reads this:

#v+
int
remove (file)
     const char *file;
{
  /* First try to unlink since this is more frequently the necessary action. */
  if (__unlink (file) != 0
      /* If it is indeed a directory...  */
      && (errno != EISDIR
	  /* ...try to remove it.  */
	  || __rmdir (file) != 0))
    /* Cannot remove the object for whatever reason.  */
    return -1;

  return 0;
}
#v-

However, POSIX says unlink(2) returns `EPERM' when PATH is a directory. `EISDIR'
is Linux-specific and the "Rationale" section at
http://www.opengroup.org/onlinepubs/9699919799/functions/unlink.html says that
"[a]pplications written for portability to both POSIX.1-2008 and the LSB should
be prepared to handle either error code."

Currently remove(3) fails on GNU/Hurd [0] and GNU/kFreeBSD [1] because of this.
 Thus it should be changed to handle both `EPERM' and `EISDIR'.

[0] https://savannah.gnu.org/bugs/?28859
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557248

-- 
           Summary: remove(3) fails when unlink(2) returns `EPERM'
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: ludo at gnu dot org
                CC: bug-hurd at gnu dot org,glibc-bugs at sources dot redhat
                    dot com
  GCC host triplet: i386-unknown-gnu0.3


http://sourceware.org/bugzilla/show_bug.cgi?id=11276

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2010-02-12  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12  9:51 ludo at gnu dot org [this message]
2010-04-04  9:09 ` [Bug libc/11276] " drepper at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100212095058.11276.ludo@gnu.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).