coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] id,groups: use gidtostr/uidtostr to avoid casts


From: Jim Meyering
Subject: Re: [PATCH] id,groups: use gidtostr/uidtostr to avoid casts
Date: Wed, 16 May 2012 19:35:08 +0200

Jim Meyering wrote:
> I wrote this months ago, and like the minimalist (avoiding unnecessary
> printf) and more type-safe aspects.  The code-duplication is not ideal,
> but the duplicated code is small and fragile, and not generally useful
> enough to put in system.h -- too easy to use it from a context where
> it would fail.  We could always give it a few more buffer entries, like
> human.c does, so two invocations in the same statement won't misbehave.
>
> Opinions?

No response, so I guess it's not horribly to
anyone else, either...

> Subject: [PATCH] id,groups: use gidtostr/uidtostr to avoid casts
>
> * src/id.c (gidtostr, uidtostr): Define macros.
> (gidtostr_ptr, uidtostr_ptr): Define safer functions.
> Use gidtostr and uidtostr to print GID and UID without
> need/risk of casts.
> * src/group-list.c: Likewise.
> ---
>  src/group-list.c |   16 ++++++++++++----
>  src/id.c         |   38 +++++++++++++++++++++++++++++---------
>  2 files changed, 41 insertions(+), 13 deletions(-)
...

I rebased and was about to push it, but discovered that tests were failing:
when compiled with -O2 and with today's (from-svn-this-morning) gcc,

    gcc version 4.8.0 20120516 (experimental) (GCC)

it segfaults.  It works fine when compiled with -O1, or with F17's

    gcc (GCC) 4.7.0 20120504 (Red Hat 4.7.0-4)

Whee...  While trying to debug that, I managed to trigger
a failed assertion in gdb.  First priority is to report that.

I'll hold off until I know more...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]