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

Bug#660526: [PATCH glibc-2.11.y] Re: <stdio.h> is incomplete for POSIX 2008



tags 660526 + upstream patch moreinfo
quit

Hi Petr and Jérémy,

Jérémy Compostella wrote:

> I apology if this bug has already been reported but I am unable to find
> it through the web bug report interface.
>
> POSIX 2008 requires that <stdio.h> expose ssize_t, va_list, and getline
> (among others) if _POSIX_C_SOURCE is 200809L or greater.  However, the
> 2.11 glibc does not conform to this (see
> http://sourceware.org/bugzilla/show_bug.cgi?id=11125).
>
> I'm currently working on some GNU coreutils and since I'm working with
> the Debian squeeze I got this issue. See thread
> http://lists.gnu.org/archive/html/coreutils/2012-02/msg00128.html
>
> As I said in the above thread, this issue has been fixed in GNU libc
> cd2f000c074b07931bd78ab5ff5fa3c0f7db628a commit. I wonder if you could
> backport this bug fix ?

There are lots of XPG7 conformance fixes that glibc 2.11.y is missing,
but I see no harm in taking this one since it seems to be affecting
people.  Petr, how about this patch, and what is the appropriate mailing
list for proposing cherry-picks like this?

-- >8 --
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 10 Jan 2010 00:39:22 -0800
Subject: Fix standalone stdio.h inclusion.

(cherry picked from commit cd2f000c074b07931bd78ab5ff5fa3c0f7db628a)

Skipping conformance testing bits since XPG7 testing did not land
until glibc-2.12~297.
---
 ChangeLog     |    9 +++++++++
 libio/stdio.h |   24 ++++++++++++++++++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2e9a5163..3ab295f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-01-10  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11125]
+	* libio/stdio.h: Define va_list, off_t, and ssize_t.
+
+2010-01-09  Ulrich Drepper  <drepper@redhat.com>
+
+	* libio/stdio.h: Define va_list also for XPG7.
+
 2011-05-29  Ulrich Drepper  <drepper@gmail.com>
 
 	[BZ #12350]
diff --git a/libio/stdio.h b/libio/stdio.h
index a6d24e54..bf16b3ff 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -1,5 +1,5 @@
 /* Define ISO C stdio on top of C++ iostreams.
-   Copyright (C) 1991, 1994-2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1994-2008, 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -74,7 +74,7 @@ typedef struct _IO_FILE __FILE;
 
 #include <libio.h>
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # ifdef __GNUC__
 #  ifndef _VA_LIST_DEFINED
 typedef _G_va_list va_list;
@@ -85,6 +85,26 @@ typedef _G_va_list va_list;
 # endif
 #endif
 
+#ifdef __USE_XOPEN2K8
+# ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define __off_t_defined
+# endif
+# if defined __USE_LARGEFILE64 && !defined __off64_t_defined
+typedef __off64_t off64_t;
+# define __off64_t_defined
+# endif
+
+# ifndef __ssize_t_defined
+typedef __ssize_t ssize_t;
+# define __ssize_t_defined
+# endif
+#endif
+
 /* The type of the second argument to `fgetpos' and `fsetpos'.  */
 __BEGIN_NAMESPACE_STD
 #ifndef __USE_FILE_OFFSET64
-- 
1.7.9




Reply to: