Alternative for getline() function in AIX 5.3

Alternative for getline() function in AIX 5.3

Etzion Bar-Noy ezaton at tournament.org.il
Wed Jul 28 00:37:31 IDT 2010


IBM supply a set of GNU utilities, including GCC-related software (and GCC,
as well, if I recall correctly, but an old one) in an additional CD supplied
with AIX. This is called something around "Utilities for Linux" or some
other lie. So you do not need to force gcc to compile under AIX, but only
use it.
Same goes, probably, for many additional libraries.

P.S - they install in RPM format :-)

Ez

On Tue, Jul 27, 2010 at 11:32 PM, Oleg Goldshmidt <pub at goldshmidt.org>wrote:

> Omer Zak <w1 at zak.co.il> writes:
>
> > What I mean is to use whatever preprocessor symbol that is defined when
> > building using gcc, but undefined on AIX; or vice versa.
>
> I see. I suspect you may need both __GNUC__ and _GNU_SOURCE to be
> defined for getline() to work in the context though: the first will
> react to compilation with gcc and the second will include the right
> bits from glibc. I have not checked, but it is not clear to me if one
> implies the other, I suspect not.
>
> In any case, the explicit requirement is that the resulting program
> should be portable (at least between Liux and AIX), and, I suppose,
> the fact that gets() is insecure should be an additional
> consideration.
>
> Yet another consideration is that newer incarnaions of POSIX removed
> gets() from requirements, AFAIK, neither Linux nor AIX actually ripped
> it out yet, but it may happen in the future (on Linux sooner than on
> AIX).
>
> So, between
>
> 1. develop a non-portable Linux/gcc branch based on getline() and
>   choose at compile time with the preprocessor (keeping AIX insecure
>   with the existing, gets()-based code),
>
> 2. develop a getline() branch for Linux and rewrite AIX with the
>   secure fgets(),
>
> 3. develop a portable and secure fgets()-based implementation for both
>   AIX and Linux,
>
> I'd vote for door #3.
>
> There is option 4 suggested by Nadav (rip getline() from glibc and use
> on AIX). Depending on circumstances, it may be fairly easy or
> completely unfeasible (it is, no doubt, feasible technically, it may
> be unfeasible operatonally) or anything in between.
>
> --
> Oleg Goldshmidt | pub at goldshmidt.org
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20100728/2b0685fd/attachment.html>


More information about the Linux-il mailing list