Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 14 Feb 2012 17:25:50 +0400
From: Vasiliy Kulikov <segoon@...nwall.com>
To: owl-dev@...ts.openwall.com
Subject: Re: glibc' time.h dependency on stdlib.h (was: glibc
 update)

On Thu, Nov 24, 2011 at 00:12 +0100, Pavel Kankovsky wrote:
> On Mon, 21 Nov 2011, Vasiliy Kulikov wrote:
> 
> > build@...atros:~ $ gcc -D_GNU_SOURCE -Wall a.c -o a
> > In file included from a.c:1:0:
> > /usr/include/time.h:226:5: error: unknown type name '__locale_t'
> > 
> > A bug in glibc headers dependency?  Or time.h really must be included
> > only after explicit stdlib.h, which was not forced by our old glibc?
> 
> It is a bug.
> 
> strftime_l and strftime_l used to be GNU extensions but the latter
> function was adopted by POSIX 2008. #ifdef __USE_GNU was split into
> #ifdef __USE_XOPEN2K8 followed by #ifdef __USE_GNU but there is only one 
> #include <xlocale.h> in the first conditional section. See
> 
> <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=6cbe890a9d379d85fe849a8317010f05ace00809#patch14>
> 
> It appears __USE_GNU is defined when your test case is compiled but
> __USE_XOPEN2K8 is not defined. This should never happen.

Yes, and glibc folks say the same thing:

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

However, I have almost the same time.h header on Ubuntu 10.04 (glibc
2.11, gcc 4.4.3) and this part of time.h is the same.  However, the
one-liner is compilable on Ubuntu and is not on Owl.

I see no meaningful difference before the actual build failure place:
(diff -uN of two 'gcc -E' outputs)

--- time.h.log	2012-02-14 16:57:51.588117472 +0400
+++ time.h.log-ubuntu	2012-02-14 16:57:29.624008541 +0400
@@ -4,14 +4,17 @@
 # 1 "<stdin>"
 # 1 "/usr/include/time.h" 1 3 4
 # 28 "/usr/include/time.h" 3 4
-# 1 "/usr/lib64/gcc/x86_64-openwall-linux/4.6.1/include-fixed/features.h" 1 3 4
-# 323 "/usr/lib64/gcc/x86_64-openwall-linux/4.6.1/include-fixed/features.h" 3 4
+# 1 "/usr/include/features.h" 1 3 4
+# 313 "/usr/include/features.h" 3 4
+# 1 "/usr/include/bits/predefs.h" 1 3 4
+# 314 "/usr/include/features.h" 2 3 4
+# 346 "/usr/include/features.h" 3 4
 # 1 "/usr/include/sys/cdefs.h" 1 3 4
 # 353 "/usr/include/sys/cdefs.h" 3 4
 # 1 "/usr/include/bits/wordsize.h" 1 3 4
 # 354 "/usr/include/sys/cdefs.h" 2 3 4
-# 324 "/usr/lib64/gcc/x86_64-openwall-linux/4.6.1/include-fixed/features.h" 2 3 4
-# 346 "/usr/lib64/gcc/x86_64-openwall-linux/4.6.1/include-fixed/features.h" 3 4
+# 347 "/usr/include/features.h" 2 3 4
+# 378 "/usr/include/features.h" 3 4
 # 1 "/usr/include/gnu/stubs.h" 1 3 4
 
 
@@ -24,7 +27,7 @@
 
 # 1 "/usr/include/gnu/stubs-64.h" 1 3 4
 # 10 "/usr/include/gnu/stubs.h" 2 3 4
-# 347 "/usr/lib64/gcc/x86_64-openwall-linux/4.6.1/include-fixed/features.h" 2 3 4
+# 379 "/usr/include/features.h" 2 3 4
 # 29 "/usr/include/time.h" 2 3 4
 
 
@@ -35,15 +38,16 @@
 
 
 
-# 1 "/usr/lib64/gcc/x86_64-openwall-linux/4.6.1/include/stddef.h" 1 3 4
-# 212 "/usr/lib64/gcc/x86_64-openwall-linux/4.6.1/include/stddef.h" 3 4
+# 1 "/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h" 1 3 4
+# 211 "/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h" 3 4
 typedef long unsigned int size_t;
 # 39 "/usr/include/time.h" 2 3 4
 
 
 
 # 1 "/usr/include/bits/time.h" 1 3 4
-# 27 "/usr/include/bits/time.h" 3 4
+# 43 "/usr/include/time.h" 2 3 4
+# 56 "/usr/include/time.h" 3 4
 # 1 "/usr/include/bits/types.h" 1 3 4
 # 28 "/usr/include/bits/types.h" 3 4
 # 1 "/usr/include/bits/wordsize.h" 1 3 4
@@ -138,58 +142,8 @@
 
 
 typedef unsigned int __socklen_t;
-# 28 "/usr/include/bits/time.h" 2 3 4
-
-
-
-struct timeval
-  {
-    __time_t tv_sec;
-    __suseconds_t tv_usec;
-  };
-# 86 "/usr/include/bits/time.h" 3 4
-# 1 "/usr/include/bits/timex.h" 1 3 4
-# 24 "/usr/include/bits/timex.h" 3 4
-struct timex
-{
-  unsigned int modes;
-  long int offset;
-  long int freq;
-  long int maxerror;
-  long int esterror;
-  int status;
-  long int constant;
-  long int precision;
-  long int tolerance;
-  struct timeval time;
-  long int tick;
-
-  long int ppsfreq;
-  long int jitter;
-  int shift;
-  long int stabil;
-  long int jitcnt;
-  long int calcnt;
-  long int errcnt;
-  long int stbcnt;
-
-  int tai;
-
-
-  int :32; int :32; int :32; int :32;
-  int :32; int :32; int :32; int :32;
-  int :32; int :32; int :32;
-};
-# 87 "/usr/include/bits/time.h" 2 3 4
-
-
-
+# 57 "/usr/include/time.h" 2 3 4
 
-extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __attribute__ ((__nothrow__));
-
-
-# 43 "/usr/include/time.h" 2 3 4
-# 58 "/usr/include/time.h" 3 4
 
 
 typedef __clock_t clock_t;
@@ -298,7 +252,38 @@
 extern char *strptime (__const char *__restrict __s,
          __const char *__restrict __fmt, struct tm *__tp)
      __attribute__ ((__nothrow__));
-# 224 "/usr/include/time.h" 3 4
+
+
+
+
+
+# 1 "/usr/include/xlocale.h" 1 3 4
+# 28 "/usr/include/xlocale.h" 3 4
+typedef struct __locale_struct
+{
+
+  struct locale_data *__locales[13];
+
+
+  const unsigned short int *__ctype_b;
+  const int *__ctype_tolower;
+  const int *__ctype_toupper;
+
+
+  const char *__names[13];
+} *__locale_t;
+
+
+typedef __locale_t locale_t;
+# 216 "/usr/include/time.h" 2 3 4
+
+extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
+     __const char *__restrict __format,
+     __const struct tm *__restrict __tp,
+     __locale_t __loc) __attribute__ ((__nothrow__));
+
+
+
 extern char *strptime_l (__const char *__restrict __s,
     __const char *__restrict __fmt, struct tm *__tp,
     __locale_t __loc) __attribute__ ((__nothrow__));
--


Does anybody see anything suspicious?

Thanks,

-- 
Vasiliy

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.