Re: [PATCH] autogen: fix definition of MAXPATHLEN

Pino Toscano <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs,gmane.comp.sysutils.autogen.user
Message-ID <35447551.qJl3RIz1rI@drak>
In data lunedì 14 ottobre 2013 10:22:36, Bruce Korb ha scritto:
> On 10/13/13 10:34, Pino Toscano wrote:
> > Hi,
> > 
> > attached there is a patch for autogen to fix the definition of
> > MAXPATHLEN when not defined already (either not directly or because
> > PATH_MAX is not defined either).
> > 
> > This caused a build failure in sharutils (which embeds the libopts
> > part of autogen) on GNU/Hurd (which provides no PATH_MAX nor
> > MAXPATHLEN) [1]. This happens because in autogen's autoopts.h there
> > is:
> > #  if defined(PATH_MAX) && (PATH_MAX > MAXPATHLEN)
> > which triggers a preprocessor parsing error when MAXPATHLEN is
> > defined as (size_t)4096.
> 
> I think the correct fix would be to ensure that "size_t" is defined.

You are misunderstanding the issue, which boild down to a bad way to 
define things used in preprocessor conditionals.

Let's pick a simplied version of how the above #if becomes:
 #if 10 > ((int)5)
No matter whether size_t is known or not by the preprocessor (and not 
even by the actual compiler), the cast in preprocessor condition is a 
syntax error, hence the issue.

This happens because, since MAXPATHLEN (and PATH_MAX) is not defined in 
Hurd's sys/param.h, in compat/compat.h the following line is used:
#  define MAXPATHLEN ((size_t)4096)
and thus a cast appears in the #if mentioned above (in autoopts.h).

-- 
Pino Toscano
signature.asc (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iD8DBQBSXDIXTNH2piB/L3oRAkA8AJoD9lUNU8gF9CBtMdXvwyHWFVcZAQCbBcRg
QfiWas8EteuSk1eW9wq1Szk=
=u11m
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.