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

Bug#35131: libc6: glibc2.1 breaks a glibc2.0-compiled libglib1.2

Package: libc6
Version: 2.1.1-0.1

OK, this problem has been mentioned before, and it puzzles me. As I
say in the subject: line, if you are using glibc2.1 and install a
version of glib compiled against glibc2.0, (evidenced by a plain
"libc6" dependency), then certain basic functions like g_print()
immediately break. Eeek. Notably, this program will break:

#include <glib.h>

int main(int argc, char *argv[]) 
  g_print("hello world");
  return 0;

Previously, I thought this was due to copying va_list args around and
trying to use the arg list twice. Hwoever, only g_log() does that,
g_print() doesn't, and since g_print() breaks, it must be something

I linked with -lglib_g and stepped through and it fails at the line
"fputs(string, stdout)". Which looks fine. And, indeed, if I write
this line in a simple program it works. And if I copy the definition
of g_print() from the glib source, rename it to local_g_print() and
add a few static variables, then it *still* works. And, previously,
the problems have gone away on recompiling libglib1.2.

A quick peek with nm in libglib_g.a shows that gmessages.o refers to
_IO_stdout instead of stdout, so it's using the glibc2.0 "stdout"
macro, and not redefining it or somesuch...

I've now tried linking with the debugging-flavour libc, and I find:

#0  0x40066c34 in _IO_fputs (str=0x804f800 "hello world", fp=0x804f780)
    at iofputs.c:39

This was produced by putting the above source in test_glib.c and doing:

gcc -ggdb test_glib.c -o test_glib -I/usr/lib/glib/include -lglib_g
LD_LIBRARY_PATH=/usr/lib/libc_debug ./test_glib
gdb test_glib core


(gdb) p *fp
$1 = {_flags = -72540028, _IO_read_ptr = 0x0, _IO_read_end = 0x0, 
  _IO_read_base = 0x0, _IO_write_base = 0x0, _IO_write_ptr = 0x0, 
  _IO_write_end = 0x0, _IO_buf_base = 0x0, _IO_buf_end = 0x0, 
  _IO_save_base = 0x0, _IO_backup_base = 0x0, _IO_save_end = 0x0, 
  _markers = 0x0, _chain = 0x400fe460, _fileno = 1, _blksize = 0, 
  _old_offset = -1, _cur_column = 0, _vtable_offset = 0 '\000', 
  _shortbuf = "", _lock = 0x400fe4b0, _offset = 4615931921091781600, 
  _unused2 = {1074728352, 0, 0, 134542712, 0, 0, 1074793824, 0, 17, 
    1819043176, 1870078063, 6581362, 2121, 0, 0, 0}}



-- System Information
Debian Release: potato
Kernel Version: Linux arise 2.2.3 #4 Sat Mar 13 03:14:01 GMT 1999 i586 unknown

Versions of the packages libc6 depends on:
ii  ldso            1.9.10-1.1     The Linux dynamic linker, library and utilit

Reply to: