bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Re: error.c: "Unknown system error" should report errno value


From: Martin Koeppe
Subject: Re: Fwd: Re: error.c: "Unknown system error" should report errno value
Date: Sun, 14 Oct 2007 16:55:21 +0200 (CEST)


Hi,

On Sun, 7 Oct 2007, Jim Meyering wrote:

Martin Koeppe <address@hidden> wrote:
The test tests/rm/dir-nonrecur shows IMO a real bug in coreutils,
however:
"rm d" should fail at
remove.c:1094  with   "cannot remove 'd':  Is a directory"
but fails there with  "cannot remove 'd':  No such file or diectory"

If I remove the translation call _() around the text, then it fails
correctly with "Is a directory".  I think failures during translation
shouldn't change the errno reported.

Thanks for investigating.
If it's happening the way you say, then gettext must change, and fail
to restore errno.  Are you using the latest version of gettext?
Why do you think that's a bug in coreutils?

Can you provide something like strace/truss output?

I just found the bug in gettext causing this trouble. Unfortunately I didn't find a gettext mailing list. So I hope that someone maintaining gettext is also reading this list. Or if you know the right place to report gettext bugs, please inform me.

Gettext is 0.16.1, file dcigettext.c, function libintl_dcigettext()

(gdb) display errno
1: {<data variable, no debug info>} 4321340 = 13
(gdb) s
582       gl_rwlock_rdlock (tree_lock);
1: {<data variable, no debug info>} 4321340 = 13
(gdb) s
584 foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
1: {<data variable, no debug info>} 4321340 = 13
(gdb) frame
#0 libintl_dcigettext (domainname=0x894d28 "coreutils", msgid1=0x41b78a "`",
    msgid2=0x0, plural=0, n=0, category=6) at ./dcigettext.c:584
584 foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
(gdb) print errno
$1 = 13
(gdb) s
586       gl_rwlock_unlock (tree_lock);
1: {<data variable, no debug info>} 4321340 = 2
(gdb) print errno
$1 = 2
(gdb) q

Apparently, on interix tfind() on line 584 changes errno, before it is saved in line 587. So the patch below should be applied.

Martin


--- dcigettext.c.orig   Mon Nov 27 18:02:00 2006
+++ dcigettext.c        Sun Oct 14 16:34:14 2007
@@ -524,6 +524,9 @@
            : n == 1 ? (char *) msgid1 : (char *) msgid2);
 #endif

+  /* Preserve the `errno' value.  */
+  saved_errno = errno;
+
   gl_rwlock_rdlock (_nl_state_lock);

   /* If DOMAINNAME is NULL, we are interested in the default domain.  If
@@ -599,9 +602,6 @@
       return retval;
     }
 #endif
-
-  /* Preserve the `errno' value.  */
-  saved_errno = errno;

   /* See whether this is a SUID binary or not.  */
   DETERMINE_SECURE;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]