Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 16267
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Martin Schlemmer (RETIRED) <azarah@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Jedi/Sector One <gentoo@pureftpd.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
error.h.patch Fix errno (djbdns) patch Andy Dustman 2003-02-25 14:22 0000 243 bytes Details | Diff
djbdns.ebuild.patch Fix ebuild (djbdns) patch Andy Dustman 2003-02-25 14:24 0000 393 bytes Details | Diff
errno.diff Patch to make glimpse compile with new glibc patch Sami Nieminen 2003-02-25 15:46 0000 4.51 KB Details | Diff
glimpse-4.15-r1.ebuild New ebuild for glimpse that uses errno patch text/plain Sami Nieminen 2003-02-25 15:48 0000 694 bytes Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 16267 depends on: Show dependency tree
Bug 16267 blocks: 16344 16355 16363 16370 16396 16420 16436 16444 16450 16480 16715 16798 16801 16804 17012 17013 17187 17744
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2003-02-24 05:06 0000
Qmail, Daemontools and djbDNS assumes that "errno" can be defined as "extern
int
errno;".

This is a broken assertion.

When Glibc 2.3.2pre1 is emerged, all DJB software immediately stop working.

And compilation doesn't work any more, because "errno" is no more defined as a
global symbol.

Fix : add patches for all DJB software to  #include <errno.h> and remove
"extern
int errno"

Reproducible: Always
Steps to Reproduce:
1.
2.
3.

------- Comment #1 From SpanKY 2003-02-25 12:12:29 0000 -------
dosfstools breaks too ... 
az: shall we just handle this on a case by case basis ? 

------- Comment #2 From SpanKY 2003-02-25 12:12:50 0000 -------
*** Bug 16344 has been marked as a duplicate of this bug. ***

------- Comment #3 From SpanKY 2003-02-25 12:20:41 0000 -------
*** Bug 16355 has been marked as a duplicate of this bug. ***

------- Comment #4 From Sami Nieminen 2003-02-25 12:30:20 0000 -------
glimpse (4.15) ebuild also fails with 'undefined reference to errno'. 

------- Comment #5 From SpanKY 2003-02-25 13:04:38 0000 -------
daemontools is also broken ... 

------- Comment #6 From SpanKY 2003-02-25 13:10:58 0000 -------
in light of these issues, imo this version of glibc should be masked asap ... 
 
any thought on how it'll affect binary packages ?  we can patch source code of 
programs but we cant really patch binary packages (vmware) ... 

------- Comment #7 From Andy Dustman 2003-02-25 14:22:32 0000 -------
Created an attachment (id=8716) [details]
Fix errno

Fix use of errno by including errno.h

------- Comment #8 From Andy Dustman 2003-02-25 14:24:56 0000 -------
Created an attachment (id=8717) [details]
Fix ebuild 

Apply errno patch, minor spacing cleanup

------- Comment #9 From Andy Dustman 2003-02-25 14:27:29 0000 -------
Note that the above patches will NOT break building under older glibc versions.

------- Comment #10 From Sami Nieminen 2003-02-25 15:46:14 0000 -------
Created an attachment (id=8719) [details]
Patch to make glimpse compile with new glibc

Attached patch makes glimpse compile with new glibc 2.3.2pre1

------- Comment #11 From Sami Nieminen 2003-02-25 15:48:07 0000 -------
Created an attachment (id=8720) [details]
New ebuild for glimpse that uses errno patch

Attached ebuild uses errno.diff to patch glimpse to compile with new glibc
2.3.2pre1

------- Comment #12 From SpanKY 2003-02-25 16:37:29 0000 -------
*** Bug 16370 has been marked as a duplicate of this bug. ***

------- Comment #13 From Martin Schlemmer (RETIRED) 2003-02-25 17:51:40 0000 -------
Yep, havent looked at this yet, but we will have to handle it case by case.

Basically a problem that you need to include errno.h, and not declare errno
external.  I already added patches to net-nds/portmap and x11-misc/xloadimage
at the beginning of the year when I did some testing on glibc-2.3.2 cvs.

------- Comment #14 From SpanKY 2003-02-25 19:45:39 0000 -------
that is fine but what about binary only packages ?
vmware breaks with the new glibc

------- Comment #15 From SpanKY 2003-02-25 19:47:54 0000 -------
also, i still maintain that the new glibc should be masked due to the sheer
volume of broken ebuilds ...

yes we patch them, but we do it on developer boxes and not let the users
experience this too

------- Comment #16 From Martin Schlemmer (RETIRED) 2003-02-25 23:27:52 0000 -------
Ok, I thought ~ was for developers, and users that *wanted to help test* 
developmental stuff ?

------- Comment #17 From SpanKY 2003-02-25 23:48:39 0000 -------
yes, ~ is for testing/development, but package.mask is for broken (which is
what this is) 

------- Comment #18 From Martin Schlemmer (RETIRED) 2003-02-26 02:51:33 0000 -------
I am sorry, but the glibc developers do not consider this as broken.  It will
be the same in 2.3.2 official, and following versions.  And this is what '~'
if for .. we fix things now for when 2.3.2 is officially out.  Do you want this
chaos when 2.3.2 is actually out ?

------- Comment #19 From SpanKY 2003-02-26 03:05:37 0000 -------
i wasnt suggesting we mask it now and forever ...
i was suggesting we package.mask it and then on our own dev boxes we try to emerge
and patch as many packages as possible ... you can tell there are, and will be,
plenty of packages that break ...

then, we patched a large number of ebuild's, we release it to ~ and let all the
other random users report the packages we missed ...

however, we still need some kind of solution for older binary only packages ...
even if it's like hacking something into lib-compat ...

------- Comment #20 From SpanKY 2003-02-26 04:01:17 0000 -------
*** Bug 16396 has been marked as a duplicate of this bug. ***

------- Comment #21 From narendra sankar 2003-02-26 16:21:21 0000 -------
There is a hack available for vmware. It is described in in
vmware.for-linux.experimental which I am copying below. It works for me with
the
caveat that for non root users, LD_PRELOAD clears suid. vmware needs suid
access
to /dev/misc/vmmon and /dev/tty0 and /dev/tty7(tty on which current X is
running). 
I had to change the permissions on these to a+rw for vmware to run as non-root.
It will complain about /dev/tty8 and not having permission to run full-screen.
However changing permissions on tty8 does not seem to work. I don't rung
full-screen, so not an issue for me, but may be problems for others. 
From researching on the web, I believe it is correct for LD_PRELOAD to clear
suid. vmware-ui and vmware-mks have suid propagated to them from vmware.
However the LD_PRELOAD, breaks the chain.
I don't know what problems can be created by changing the permissions on the 
tty0 and tty7. So far I haven't seen any. But I am on a non-secure workstation.
If security is important, this might be an issue. Hopefully vmware will
release a patch sometime soon, as redhat 8.1 I believe will require that.
Otherwise they might just move people to version 4.0 which is in beta now.
Naren
------------------------------------------------

In the interest of posterity (and helping anyone else using vmware with
rawhide glibc), here's what ended up working.

Compile the attached file q.c into q.so.  Put q.so into /usr/lib/, and
chmod it 555.  Then rename the files /usr/lib/vmware/bin/vmware-{ui,mks},
giving them a ".bin" extension.  Then create two new files named
/usr/lib/vmware/bin/vmware-{ui,mks} instead that contain:
-------------------
#!/bin/bash
LD_PRELOAD=q.so exec "$0.bin" "$@"
-------------------

chmod a+rx these new files, and all should be well.

The basic problem is that vmware binaries have their own copy of errno and
related functions, and there is a clash with the new glibc ones.  q.so will
resolve this problem.  The need for the scripts above arises from the fact
that each of the binaries launched by the initial /usr/bin/vmware call
needs to have the q.so preloaded.  

q.c was written by Petr Vendrovec, and many thanks go to him for the work
he put into the debugging of the problem and the attached code!

In summary, q.c qorreqts the formerly inqurable qrashes.

Cheers,
-- 
  Ami Fischman
  usenet@fischman.org

-------------------------------------------------------
/*
 * Build with: gcc -W -Wall -shared -o q.so q.c
 */

#include <dlfcn.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>

void go(void) __attribute__((constructor));

void go(void) {
 void* qh;
 unsigned char *__real_errno_location, *__vm_errno_location;

 qh = dlopen("libc.so.6", RTLD_GLOBAL);
 __real_errno_location = dlsym(qh, "__errno_location");
 __vm_errno_location = dlsym(NULL, "__errno_location");
 printf("Got eroloc %p & %p\n", __vm_errno_location, __real_errno_location);
 if (__real_errno_location && __vm_errno_location && __real_errno_location !=
__vm_errno_location) {
  unsigned int errnobase = (int)__vm_errno_location;
  unsigned int mpbase = errnobase & ~0xFFF;
  unsigned int mplen = 4096;

  if (errnobase + 5 > mpbase + mplen) {
   mplen = mplen + 4096;
  }
  mprotect((void*)mpbase, mplen, PROT_READ|PROT_WRITE|PROT_EXEC);
  *__vm_errno_location = 0xE9;
  *(int*)(__vm_errno_location + 1) = __real_errno_location -
__vm_errno_location - 5;
  mprotect((void*)mpbase, mplen, PROT_READ|PROT_EXEC);
 }
} 

----------------------------------

------- Comment #22 From narendra sankar 2003-02-26 16:25:07 0000 -------
Another comment. There is an ongoing discussion on the wine lists as to how to
solve this. This is a problem for wine. So wine will not work at this time, and
the last I know there is no real solution for this yet. The same is true for
the mono compiler and tools. There are issues there, and the wine and mono
teams are trying to figure out a solutions.
look at the following for more information.
http://www.winehq.com/news/?view=155#Threading%20Problems%20with%20glibc%202.3

------- Comment #23 From SpanKY 2003-02-26 17:48:03 0000 -------
*** Bug 16420 has been marked as a duplicate of this bug. ***

------- Comment #24 From Andy Dustman 2003-02-26 18:54:26 0000 -------
Idea: Is it feasible to create an eclass that would facilitate fixing source
files, changing "extern int errno;" to "#include <errno.h>" during the
src_unpack stage? i.e.

# grep pattern intentionally loose
find ${S} -type f -name '*.[ch]' | xargs grep -l errno | while read f; do
    einfo "Fixing errno usage in ${f}"
    mv ${f} ${f}.orig
    # why are sed regexes so lame?
    perl -p -e 's|(extern\W+int\W+errno\W*;)|/* \1 */\n#include <errno.h>\n|;'
\
        <${f}.orig >${f}
done

Then the ebuilds of packages with problems just need to inherit fix_errno (or
whatever) and we don't need a bazillion patches everywhere.

I've tested the above script on qmail and it works correctly. I think it will
work on the majority of cases.

BTW, looks like mysql is another app that breaks with glibc-2.3.2. (I only
tried 4.0.11a, but certainly older versions are affected as well.)

------- Comment #25 From SpanKY 2003-02-26 20:56:04 0000 -------
well, in addition to fixing it, we should be talking to upstream maintainers
about this bug 

------- Comment #26 From SpanKY 2003-02-27 01:35:42 0000 -------
glimpse fixed in cvs

http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-misc/glimpse/glimpse-4.15-r1.ebuild?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-misc/glimpse/files/4.15-errno.patch?rev=1.1&content-type=text/vnd.viewcvs-markup

------- Comment #27 From Clemens Schwaighofer 2003-03-01 23:39:01 0000 -------
kerberos5 1.2.7 is also affected by the glibc bug. I tried to ship around with
-DHAVE_ERRNO_AS_DEFINE=1 but it didn't work.
I submited a seperate bug for kerberos5 1.2.7 itself

------- Comment #28 From phoen][x 2003-03-05 07:59:19 0000 -------
*** Bug 16355 has been marked as a duplicate of this bug. ***

------- Comment #29 From Derek Dolney 2003-03-06 18:16:26 0000 -------
The Intel Fortran Compiler, ifc, is also broken by this. Presumably also their
C Compiler, icc.

------- Comment #30 From narendra sankar 2003-03-06 18:20:53 0000 -------
The intel c/c++ compiler icc & icpc Version 7.0   Build 20030212Z
works without any problems on glibc 2.3.2. I have built an internal project on this and it is running with no bugs so far.

------- Comment #31 From James Cloos 2003-03-06 21:15:22 0000 -------
Another package affected by this is ezm3, needed to compile cvsup.

------- Comment #32 From dan 2003-03-07 16:32:03 0000 -------
any updates on the wine situation? 

------- Comment #33 From narendra sankar 2003-03-07 16:35:12 0000 -------
The last I read, for wine they are still working on a solution. The reason for
the delay is the intent to also fix the threading model which is definitely
more work.
So for now, people needing wine should not upgrade glibc.

------- Comment #34 From Matt Bailey 2003-03-10 19:35:55 0000 -------
fix:
while OOo is extracting add this line:

#include <errno.h>


to this file:

/var/tmp/portage/openoffice-1.0.2/work/oo_1.0.2_src/dmake/extern.h

------- Comment #35 From Matt Bailey 2003-03-10 19:41:22 0000 -------
^ for openoffice that is. fixes the dmake error

------- Comment #36 From Martin Schlemmer (RETIRED) 2003-03-11 13:15:24 0000 -------
Right, we should just replace all declarations of errno with '#include
<errno.h>'.

What binary packages except for WineX (the one you pay for), and VMWare are 
affected ?

------- Comment #37 From Joakim 2003-03-16 08:07:31 0000 -------
Sorry but please explain this to me... How come glibc developers don't consider
this 
broken? There is appearently a change in 2.3.2 that breaks a majority of apps
even if 
they are compiled with the latest gnu compiler... but seam to work some
none-gnu 
ones... Then this must be a gcc bug then really or? 

To me keep on adding patches to apps making them work seam to be a temporary 
solution not THE solution? 

------- Comment #38 From Martin Schlemmer (RETIRED) 2003-03-16 10:26:54 0000 -------
Its rather simple:  all programs that was coded like so:

------------ broken code ----------------
extern int errno;
-----------------------------------------

breaks.  The right way (and why the glibc devs do not really bother), is to
include errno.h like so:

------------- the right way --------------
#include <errno.h>
------------------------------------------

System header files is there for a reason, and doing things like
declaring 'errno' as an 'extern int' when the proper system header
do exist, is just wrong (or in the glibc devs's books).

------- Comment #39 From Philip Walls (RETIRED) 2003-03-16 13:45:15 0000 -------
Crossover 1.2 is affected, I believe 1.3 suffers from the problem as well.

------- Comment #40 From Wout Mertens (RETIRED) 2003-03-17 08:03:54 0000 -------
Fixed krb5-1.2.7 ebuild with a construct like in comment 24. 

------- Comment #41 From Bjarke Istrup Pedersen 2003-03-21 17:50:04 0000 -------
libmpeg3-1.5-r1 also has this problem. 

------- Comment #42 From christian gut 2003-03-26 15:50:46 0000 -------
what about the wine thing? could wie just replace the wrong errno things in
code? or any other fix?

------- Comment #43 From phoen][x 2003-03-30 11:18:40 0000 -------
Got a quick fix for wine* from irc:
'export LD_ASSUME_KERNEL=2.2.5' before you run wine.

Thanks to taviso in #gentoo.

The related url is: http://www.winehq.com/index.php?issue=163#Making%20Wine%20Run%20With%20glibc%202.3

-phoen][x-

------- Comment #44 From Martin Schlemmer (RETIRED) 2003-05-18 09:26:06 0000 -------
Ok, I was a bit busy, but I'll try now to get to everything.  Could you
guys add a bug for all packages that is affected by this?  I can then
start sorting them out.

NOTE: please add a *new* bug, with me as owner.

------- Comment #45 From Martin Holzer (RETIRED) 2003-05-22 18:43:13 0000 -------
*** Bug 16406 has been marked as a duplicate of this bug. ***

------- Comment #46 From nate grady 2003-07-06 16:40:48 0000 -------
In xloadimage, I had to add:
#include <errno.h>
to the top of img.c in order for it to compile as well.

------- Comment #47 From Rigo 2003-07-07 01:33:06 0000 -------
app-games/mindless-1.2 as well (needed to include errno.h in http_fetcher.c)

------- Comment #48 From SpanKY 2003-07-27 22:58:12 0000 -------
glibc-2.3.2 is marked stable, all packages are out w/errno fixes, and we should
be 
good to go :) 

nice work all 

------- Comment #49 From Michael Imhof 2003-07-30 15:40:20 0000 -------
*** Bug 22248 has been marked as a duplicate of this bug. ***

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug