incompatibility with glibc
"Gerrit Pape" <[email protected]> Mon, 23 Dec 2002 19:40:04 +0100
| Newsgroups | gmane.org.djb.miscellaneous |
|---|---|
| Message-ID | <[email protected]> |
Hello, there is a compatibility problem with the unix.a library and the
current glibc 2.1.3-6 in Debian unstable (sid). It concerns the error.h
and error.c files. At least daemontools, djbdns, and qmail are
affected.
The problem occurs when a Debian/unstable machine is upgraded to the
recent glibc 2.1.3-6. The errno declaration/implementation in error.h
doesn't work properly anymore. This causes some binaries to fail to
start. I think this isn't Debian specific, but introduced by upstream
of the GNU C Library. The Debian glibc people usually take patches from
upstream to include into Debian.
Here's an example with daemontools' supervise on Debian/unstable:
libc6_2.1.3-5 (and libc6_dev-2.1.3-5) is installed:
# cd /package/admin/daemontools-0.76/compile
# make clean it >/dev/null
[some warnings]
# rm rts-tmp/test.sv/down
# ./supervise rts-tmp/test.sv
second
#
Ok, this works.
Upgrading to libc6_2.1.3-6:
# dpkg -i libc6_2.3.1-6_i386.deb libc6-dev_2.3.1-6_i386.deb
(Reading database ... 63341 files and directories currently installed.)
Preparing to replace libc6 2.3.1-6 (using libc6_2.3.1-6_i386.deb) ...
[...]
# ./supervise rts-tmp/test.sv
supervise: fatal: unable to stat rts-tmp/test.sv/down: no error
# echo $?
111
# make clean it >/dev/null
pathexec_run.c: In function `pathexec_run':
pathexec_run.c:18: warning: implicit declaration of function `execve'
chkshsgr.c: In function `main':
chkshsgr.c:10: warning: passing arg 2 of `getgroups' from incompatible pointer type
chkshsgr.c:10: warning: implicit declaration of function `setgroups'
prot.c: In function `prot_gid':
prot.c:13: warning: implicit declaration of function `setgroups'
prot.c:15: warning: implicit declaration of function `setgid'
prot.c: In function `prot_uid':
prot.c:20: warning: implicit declaration of function `setuid'
seek_set.c: In function `seek_set':
seek_set.c:9: warning: implicit declaration of function `lseek'
envdir.o(.text+0x23f): In function `main':
: undefined reference to `errno'
envdir.o(.text+0x260): In function `main':
: undefined reference to `errno'
unix.a(openreadclose.o)(.text+0x22): In function `openreadclose':
: undefined reference to `errno'
unix.a(pathexec_run.o)(.text+0x10d): In function `pathexec_run':
: undefined reference to `errno'
unix.a(pathexec_run.o)(.text+0x14b): In function `pathexec_run':
: undefined reference to `errno'
unix.a(readclose.o)(.text+0x58): more undefined references to `errno' follow
collect2: ld returned 1 exit status
make: *** [envdir] Error 1
#
As far as I've investigated this, the GNU C Library isn't doing anything
wrong. Their info- and man-page for errno(3) states:
SYNOPSIS
#include <errno.h>
[...]
errno is defined by the ISO C standard to be a modifiable lvalue of
type int, and must not be explicitly declared; errno may be a macro.
errno is thread-local; setting it in one thread does not affect its
value in any other thread.
But:
# head /package/admin/daemontools-0.76/compile/error.h
/* Public domain. */
#ifndef ERROR_H
#define ERROR_H
extern int errno;
extern int error_intr;
extern int error_nomem;
extern int error_noent;
#
Inserting '#include <errno.h>' after '#define ERROR_H' seems to solve
the problem: compiling and testing daemontools with libc6_2.1.2-6 works,
compiling and testing daemontools with libc6_2.1.2-5 works, and those
binaries compiled with libc6_2.1.2-5 still work after upgrading to
libc6_2.1.2-6. I'm not sure about compatibility with other libc's
though.
I appreciate any input that helps solving this problem generally. If
desired I can provide more detailed information such as a diff between
libc6_2.1.2-5 and libc6_2.1.2-6 or debian- and upstream changelog.
Thanks, Gerrit.