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

Bug#35023: libc6: C++ incompatibility bug



Package: libc6
Version: 2.1.1-0.1

I have created a test case derived from the code in APT that when runs on
glibc 2.1 without recompilation fails. The test case is very simple:

#include <iostream>
#include <fstream>

void die(const char *S)
{
   cerr << S << endl;
   exit(1);
}

int main(int argc,const char *argv[])
{
   ifstream F(argv[1],ios::in | ios::nocreate);

   if (!F != 0)
      die("!F #1");
   
   streampos Off = F.tellg();
   if (!F != 0)
      die("!F #2");
   
   return 0;
}

Results on glibc2.1 using 2.0 compiled binary..

[..]

open("/var/state/apt/lists/mirror_debian_dists_potato_main_binary-i386_Packages",O_RDONLY)=3
fstat(3, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40014000
_llseek(3, 4294967296, 0xbffffb10, 0x4016521c /* SEEK_??? */) = -1 EINVAL
(Invalid argument)
write(2, "!F #2", 5!F #2)                    = 5
write(2, "\n", 1
)                       = 1
_exit(1)                                = ?


Results on glibc2.1 using a 2.1 compiled binary..

[..]

open("/var/state/apt/lists/mirror_debian_dists_potato_main_binary-i386_Packages",O_RDONLY|0x8000)=3
fstat(3, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40014000
_llseek(3, 0, {0}, SEEK_CUR)            = 0
close(3)                                = 0
munmap(0x40014000, 4096)                = 0
_exit(0)                                = ?

The key difference appears to be in how llseek is called. I belive that if
this is fixed APT 0.1.10 will run without recompilation on glibc2.1.

This bug may be related to #34953 

Jason


Reply to: