Package: flex
Version: 2.6.4-1
Severity: important

Hi,

I spent some time today looking at why charybdis still fails with newer
flex (since it is blocking my mbedtls transition)[1]. I also had a look
at why it inexplicably builds with amd64 and fails on all other
architectures. I have come to the conclusion that the only way this can
happen is if the amd64 binary was not built in a clean environment and
probably contains a stale "src/skel.c" file.

Running "flex ircd_lexer.l" (from charybdis) using the flex 2.6.4-4
binaries on amd64 and i386 respectively gives this diff which is the
cause if the current failures[2]:

> --- charybdis-cy4e9N/charybdis-3.5.5/src/lex.yy.c       2018-02-17 
> 19:07:14.334607450 +0000
> +++ charybdis-gRy7cn/charybdis-3.5.5/src/lex.yy.c       2018-02-17 
> 18:38:46.253775565 +0000
> @@ -16,6 +16,12 @@
>  /* First, we deal with  platform-specific or compiler-specific issues. */
>  
>  /* begin standard C headers. */
> +#ifndef _POSIX_C_SOURCE
> +#define _POSIX_C_SOURCE 200809 /* for fileno() */
> +#ifndef _POSIX_SOURCE
> +#define _POSIX_SOURCE 1
> +#endif
> +#endif
>  #include <stdio.h>
>  #include <string.h>
>  #include <errno.h>
> @@ -556,8 +562,8 @@

Simply rebuilding flex on amd64 and rerunning the above test makes the
diff go away.

This code is embedded into the flex binary, so you can tell if a binary
is bad by running:
 strings /usr/bin/flex | grep POSIX_C_SOURCE

The good binary gives:
> #define _POSIX_C_SOURCE 200809 /* for fileno() */
> [[#ifndef _POSIX_C_SOURCE

Bad binaries print nothing.

Given that this bug is present in 4 debs so far (I cannot check the
binary currently in NEW), binNMUing the package won't fix it for good
(since the next upload will probably be bad). Possible improvements:
forcing skel.c to always be rebuilt, or using source only uploads.

Thanks,
James

[1] https://buildd.debian.org/status/package.php?p=charybdis
[2] charybdis uses certain old BSD defines which are only available
    if _POSIX_SOURCE is not defined.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to