This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12469] New: Race condition in configure.in check for necessary ranlib


http://sourceware.org/bugzilla/show_bug.cgi?id=12469

           Summary: Race condition in configure.in check for necessary
                    ranlib
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: minor
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: bruce.dubbs@gmail.com


In configure.in, starting at line 1098, the code to check if ranlib is
necessary is:

# check if ranlib is necessary
AC_CACHE_CHECK(whether ranlib is necessary, libc_cv_ranlib_necessary, [dnl
cat > conftest.c <<EOF
int a;
char b;
void c(void) {}
EOF
$CC $CFLAGS $CPPFLAGS -c conftest.c
$AR cr conftest.a conftest.o
cp conftest.a conftest2.a
$RANLIB conftest.a
if cmp -s conftest.a conftest2.a; then
  libc_cv_ranlib_necessary=no
else
  libc_cv_ranlib_necessary=yes
fi

Under some infrequent timing conditions, the test can sometimes return yes when
it shouldn't.  This is because ranlib adds a timestamp from byte position 24 to
33 that can differ between the creation of conftest.a and it's modification two
lines later.

I suggest changing the comparison test to:

  if cmp -s -i34 conftest.a conftest2.a; then

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]