c program does not compile because of bug in /usr/include/bits/resource.h:161

Bug #302087 reported by Martin Grewe
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GLibC
Fix Released
Medium
glibc (Ubuntu)
Fix Released
Low
Kees Cook
Nominated for Intrepid by Erik Hetzner
Jaunty
Fix Released
Low
Kees Cook

Bug Description

first: sorry about this message but its my first bugreport and maybe you find it awful but i done it in a good faith!

os: ubuntu ibex. package: glibc

tried to compile a program. compilerflags are:
gcc -Wall -Werror -pedantic-errors -g -c test.c

the source in test.c:
<qoute>
#include <stdlib.h>
#include <sys/wait.h>

int main(){
return EXIT_SUCCESS;
}
</qoute>

error was:
<quote>
In file included from /usr/include/sys/resource.h:25,
                 from /usr/include/sys/wait.h:32,
                 from test.c:2:
/usr/include/bits/resource.h:161: Fehler: Komma am Ende der Aufzählungsliste
</quote>

the error is in german and deals with the comma. i think its about the #ifdef in resource.h:161. i repleaced with:

<qoute>
/* Whose usage statistics do you want? */
enum __rusage_who
{
  /* The calling process. */
  RUSAGE_SELF = 0,
#define RUSAGE_SELF RUSAGE_SELF

#ifndef __USE_GNU
  /* All of its terminated child processes. */
  RUSAGE_CHILDREN = -1
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
#endif

#ifdef __USE_GNU
  /* All of its terminated child processes. */
  RUSAGE_CHILDREN = -1,
#define RUSAGE_CHILDREN RUSAGE_CHILDREN

  /* The calling thread. */
  RUSAGE_THREAD = 1
# define RUSAGE_THREAD RUSAGE_THREAD
  /* Name for the same functionality on Solaris. */
# define RUSAGE_LWP RUSAGE_THREAD
#endif
};
</qoute>

maybe this can help.

thanks for all your work!!!!

best regards,
martin grewe

Related branches

Revision history for this message
Erik Hetzner (egh) wrote :

Here is the same bug in English. Please fix or report upstream to glibc people. Thanks a million.

gcc -I. -Ilib/private -Ilib/public -Ilib/private/plugin/gzip -Ilib/private/plugin/cunit -Ilib/private/plugin/tiger -Ilib/private/plugin/event -Ilib/private/plugin/event/compat -Ilib/private/plugin/regex -Ilib/private/plugin/python -Ilib/private/plugin/ruby -Ilib/private/os -Ilib/private/plugin/event/os/linux -Ilib/private/plugin/cunit/os/linux -Wall -W -Wunused -ansi -pedantic -Werror -Wno-long-long -Wunused-function -std=gnu89 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -g -pedantic-errors -Wextra -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_ALLOCA_H=1 -DEBUG=1 -o lib/private/plugin/event/http.o -c lib/private/plugin/event/http.c
In file included from /usr/include/sys/resource.h:25,
                 from lib/private/plugin/event/http.c:49:
/usr/include/bits/resource.h:161: error: comma at end of enumerator list

Revision history for this message
Erik Hetzner (egh) wrote :

update - this has to do with c89 + -pedantic-errors. I do not know what ubuntu's policy on the c standard followed by include files is.

Kees Cook (kees)
Changed in glibc:
status: New → Confirmed
Revision history for this message
Kees Cook (kees) wrote :

I can confirm this is a regression between hardy and intrepid. In general, Ubuntu tries to stay as close as possible to upstream for headers and such things. Looks like upstream added this on 2008-05-01, we can open an upstream bug report.

Revision history for this message
In , Kees Cook (kees) wrote :

#include <stdlib.h>
#include <sys/wait.h>

int main(){
return EXIT_SUCCESS;
}

cc test.c -o test -pedantic-errors
In file included from /usr/include/sys/resource.h:25,
                 from /usr/include/sys/wait.h:32,
                 from test.c:2:
/usr/include/bits/resource.h:161: error: comma at end of enumerator list

...
  RUSAGE_CHILDREN = -1,
#define RUSAGE_CHILDREN RUSAGE_CHILDREN

#ifdef __USE_GNU
  /* The calling thread. */
  RUSAGE_THREAD = 1
...

The change to sysdeps/unix/sysv/linux/bits/resource.h was:

revision 1.20
date: 2008/05/01 05:37:45; author: drepper; state: Exp; lines: +9 -1
Define RUSAGE_THREAD and RUSAGE_LWP.

Revision history for this message
Erik Hetzner (egh) wrote :

Thank you for confirming. I assumed the bug was upstream but wanted confirmation from ubuntu.

Changed in glibc:
status: Unknown → Confirmed
Revision history for this message
In , Cvs-commit (cvs-commit) wrote :

Subject: Bug 9720

CVSROOT: /cvs/glibc
Module name: libc
Changes by: <email address hidden> 2009-01-08 10:16:12

Modified files:
 . : ChangeLog
 sysdeps/unix/sysv/linux/bits: resource.h
 sysdeps/unix/sysv/linux/sparc/bits: resource.h

Log message:
 [BZ #9720]
 * sysdeps/unix/sysv/linux/bits/resource.h (enum __rusage_who): Avoid
 comma after RUSAGE_CHILDREN if not -D_GNU_SOURCE.
 * sysdeps/unix/sysv/linux/sparc/bits/resource.h (enum __rusage_who):
 Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&r1=1.11439&r2=1.11440
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/bits/resource.h.diff?cvsroot=glibc&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h.diff?cvsroot=glibc&r1=1.10&r2=1.11

Kees Cook (kees)
Changed in glibc:
assignee: nobody → kees
importance: Undecided → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glibc - 2.9-0ubuntu7

---------------
glibc (2.9-0ubuntu7) jaunty; urgency=low

  [ Matthias Klose ]
  * Merge with Debian, glibc-2.9 branch, r3226.

  [ Kees Cook ]
  * Added debian/patches/any/cvs-bz-9720-resource.diff: upstream
    fixes for resource.h mis-compile (LP: #302087).

 -- Kees Cook <email address hidden> Thu, 08 Jan 2009 13:27:48 -0800

Changed in glibc:
status: Confirmed → Fix Released
Revision history for this message
In , Drepper-fsp (drepper-fsp) wrote :

Jakub checked in a patch.

Changed in glibc:
status: Confirmed → Fix Released
Changed in glibc:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.