Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: John Ferlan <ferlan@zk3.dec.com>
Subject: Re: Compilation with gcc 2.95.3: cuserid redefined
Date: Wed, 28 Nov 2001 07:49:15 -0500	[thread overview]
Message-ID: <3C04DD4B.59C9A5E7@zk3.dec.com> (raw)
In-Reply-To: c0960e91.0111271831.37021819@posting.google.com



Stano wrote:

> Hi there,
>
> I have been trying to recompile the source code on
> Tru64 UNIX V5.1 (Rev. 732) with the gcc 2.95.3.
> Though it compiles, I am getting the following warnings:
>
> /usr/local/gcc-2.95.3/lib/gcc-lib/alphaev56-dec-osf5.1/2.95.3/include/unistd.h:608:
> warning: `cuserid' redefined
> /usr/local/gcc-2.95.3/lib/gcc-lib/alphaev56-dec-osf5.1/2.95.3/include/stdio.h:457:
> warning: this is the location of the previous definition
>
> I have searched all the newsgroups about this problem and it seems it
> was already mentioned few times, but without any response. The only
> clue is to define the symbol _LIBC_POLLUTION_H_ which in fact helps,
> but I could not find any explanation of its purpose.
>
> Can anybody shed a bit of light on this issue?
>
> Thanks you very much,
>
> Stano.

The following may or may not answer your question, but hopefully will give you insight
as to what/how things are done. Read the include files and check out the
__V40_OBJ_COMPAT definition as well as the 'pragma extern_prefix "_E"' statements.

Generically speaking - one of the features of the Tru64 UNIX platform is that
applications compiled on a V4* release will continue to work on V5* releases without
forcing a recompilation of the application. When "something" changes to the arguments,
data format, size of return value, etc. of a public interface that make it "impossible"
to continue working in an environment where an already compiled application must work,
the "standard procedure" has been to create a new interface with the _E prefix - e.g.
there's a cuserid() and an _Ecuserid().  Thus apps compiled on v4* will use the
cuserid() entry, while those compiled on v5* will use the _Ecuserid().

Starting with some v5* release (I forget exactly which one), the _Ecuserid() interface
was created to handle long usernames.  At the same time the constant value L_cuserid
that is the maximum length of a username was changed from 8 to 64. Because the standard
says cuserid() returns a string that is no more than L_cuserid characters in size,
there has to be 2 interfaces to support the different sizes.  If there wasn't 2
interfaces, then v4 applications would not get a "nul" terminated string that has no
more than 8 characters in the username - it may receive a 10 character (or more).
Those apps 'may' begin to fail especially if they made assumptions...  For example, a
strcpy from the returned cuserid() string into a buffer that was defined "char
newusername[L_cuserid+1]" could then overflow...  Remember, the v4 app wasn't
recompiled thus newusername is only 9 characters long - if run a v5 platform where
cuserid() may return a 14 character name, there's going to be overflow.

Applications compiled in a v5* environment wishing to "keep" the v4 definition, can
define "__V40_OBJ_COMPAT" and will use the cuserid() interface that only allows a
maximum of 8 characters.  Otherwise, the cuserid() will return a character string that
is at most 64 characters.  And before it's asked - yes, v5* releases can support longer
usernames, unfortunately getting the other applications to support the longer names has
taken longer than originally planned, so still officially the answer is 8 characters
for a maximum username.

Perhaps the "answer" to your problem lies in whether or not the compiler can handle the
"extern_prefix" pragma - I'm not a compiler guru, so I cannot help you solve that
mystery.

--

John Ferlan
Tru64 UNIX Security
Compaq Computer Corporation




  reply	other threads:[~2001-11-28 12:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-28  2:31 Compilation with gcc 2.95.3: cuserid redefined Stano
2001-11-28 12:49 ` John Ferlan [this message]
2001-11-30  2:35   ` Stano
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox