1 2

Build failure on OpenBSD due to differing types for glob(3)

Details
Message ID
<20190130050738.llqrjwzh3ioro2sd@BlackBox>
DKIM signature
pass
Download raw message
I tried building mrsh on OpenBSD, but it fails due to a type mismatch 
for the glob(3) interface: POSIX/Linux/FreeBSD uses size_t but OpenBSD 
uses int. Quoting from the manual[1]:

  The include file <glob.h> defines the structure type glob_t,
  which contains at least the following fields:

  typedef struct {
    int gl_pathc;    /* count of total paths so far */
    int gl_matchc;   /* count of paths matching pattern */
    int gl_offs;     /* reserved at beginning of gl_pathv */
    int gl_flags;    /* returned flags */
    char **gl_pathv; /* list of paths matching pattern */
  } glob_t;

I've attached a buildlog to show the error. Not sure how you'd fix this, 
but I just casted glob_buf.gl_pathc to size_t.

[1] https://man.openbsd.org/glob.3
-- 
Stephen Gregoratto
PGP Fingerprint: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
Need my key? Get it with:
	gpg --keyserver pgp.mit.edu --recv-keys 8BABEC8B
or off my server at https://www.sgregoratto.me/pubkey.txt
Details
Message ID
<PA3pFiN7uqYPO_OdQ1hA_ABiPgmW0-BFgykjQCRon2ZsLu1-Nr_0Hdk3bhr29y7TcabAoQ1dsxPzkyv4uJUW6V1WIdlwetdnxjpuOik0GyU=@emersion.fr>
In-Reply-To
<20190130050738.llqrjwzh3ioro2sd@BlackBox> (view parent)
DKIM signature
pass
Download raw message
On Wednesday, January 30, 2019 6:07 AM, Stephen Gregoratto <dev@sgregoratto.me> wrote:
> I tried building mrsh on OpenBSD, but it fails due to a type mismatch
> for the glob(3) interface: POSIX/Linux/FreeBSD uses size_t but OpenBSD
> uses int. Quoting from the manual[1]:
>
>   The include file <glob.h> defines the structure type glob_t,
>   which contains at least the following fields:
>
>   typedef struct {
>     int gl_pathc;    /* count of total paths so far */
>     int gl_matchc;   /* count of paths matching pattern */
>     int gl_offs;     /* reserved at beginning of gl_pathv */
>     int gl_flags;    /* returned flags */
>     char **gl_pathv; /* list of paths matching pattern */
>   } glob_t;
>
> I've attached a buildlog to show the error. Not sure how you'd fix this,
> but I just casted glob_buf.gl_pathc to size_t.

Hi,

Thanks for trying to build mrsh on more platforms!

The POSIX spec explicitly states that gl_pathc should be size_t. Could
you fill an OpenBSD bug to ask what's up?

If they can't fix it, I'd be okay to add a cast with a little comment
explaining why the cast should be preserved.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/glob.html

--
Simon Ser
https://emersion.fr