"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Don't rely on <zlib.h> to pull in <unistd.h>
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 9 Sep 2020 18:08:44 +0200

Download raw body.

Thread
On Wed, Sep 09, 2020 at 04:15:13PM +0200, Christian Weisgerber wrote:
> Do not rely on <zlib.h> to pull in <unistd.h>.
> 
> There are numerous places in the got code that rely on the fact
> that on OpenBSD zlib.h -> zconf.h pulls in unistd.h.  This is not
> the case elsewhere (e.g. on FreeBSD) and even if we don't care about
> portability at this point, it seems wrong.
> 
> OK?

Yes, OK. Thank you for looking at this!

I'm aware that some FreeBSD folks are taking looking at Got in order
to see whether they could use Got in some capacity after switching
from SVN to Git.
I am fine with patches like this one going in to serve that goal.

I would suggest that changes which are 100% FreeBSD-specific should
be maintained seperately in a -portable repository, at least for now.
This approach seems to work well for other projects like OpenSSH and
OpenBGPD, so I'd like to try it here, too. I believe it would save me
some time if others took care of -freebsd or other -portable versions
in whichever way they want to, without direct involvement of Got upstream
devs. Except of course for changes which can be trivially applied to all
versions.

> diff 4dbec0a83c320fcd126d9d2014fae24906ce415d /home/naddy/got
> blob - 8ef36ea24722ce33ed0f15376b6bb415e2712e37
> file + lib/fetch.c
> --- lib/fetch.c
> +++ lib/fetch.c
> @@ -32,6 +32,7 @@
>  #include <string.h>
>  #include <stdint.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <ctype.h>
>  #include <limits.h>
> blob - fbef58ae984ad17c5cf64c92059811d717395226
> file + lib/inflate.c
> --- lib/inflate.c
> +++ lib/inflate.c
> @@ -21,6 +21,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <time.h>
>  
> blob - a43dbc1f6911b315509559a874c7b729ba68d96f
> file + lib/object.c
> --- lib/object.c
> +++ lib/object.c
> @@ -30,6 +30,7 @@
>  #include <string.h>
>  #include <stdint.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <ctype.h>
>  #include <libgen.h>
> blob - db3c786ab7869776389551c7137e9216e02f0861
> file + lib/pack.c
> --- lib/pack.c
> +++ lib/pack.c
> @@ -29,6 +29,7 @@
>  #include <limits.h>
>  #include <sha1.h>
>  #include <endian.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <imsg.h>
>  
> blob - 44f5cc811353036797f501a79e4fb1ee0f11dcf1
> file + lib/privsep.c
> --- lib/privsep.c
> +++ lib/privsep.c
> @@ -30,6 +30,7 @@
>  #include <poll.h>
>  #include <imsg.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <time.h>
>  
> blob - 3c2632d04567f59182586129b87e15927dbe4b0d
> file + lib/reference.c
> --- lib/reference.c
> +++ lib/reference.c
> @@ -26,6 +26,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> +#include <unistd.h>
>  #include <util.h>
>  #include <zlib.h>
>  #include <time.h>
> blob - b8408a749c9e5ff2c1983eb5d006ed171fdfb6e8
> file + lib/repository.c
> --- lib/repository.c
> +++ lib/repository.c
> @@ -32,6 +32,7 @@
>  #include <sha1.h>
>  #include <string.h>
>  #include <time.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <errno.h>
>  #include <libgen.h>
> blob - 2f846cab12b0b0230692cf8242bd2502017a6e1e
> file + libexec/got-fetch-pack/got-fetch-pack.c
> --- libexec/got-fetch-pack/got-fetch-pack.c
> +++ libexec/got-fetch-pack/got-fetch-pack.c
> @@ -32,6 +32,7 @@
>  #include <ctype.h>
>  #include <sha1.h>
>  #include <fcntl.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <err.h>
>  
> blob - 749ad2dc3d6f06e43e610c01a973c757dad065f3
> file + libexec/got-index-pack/got-index-pack.c
> --- libexec/got-index-pack/got-index-pack.c
> +++ libexec/got-index-pack/got-index-pack.c
> @@ -34,6 +34,7 @@
>  #include <ctype.h>
>  #include <sha1.h>
>  #include <fcntl.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  #include <err.h>
>  #include <assert.h>
> blob - 259da2e7e9b6fd36089b5396d4ef34f94744a694
> file + libexec/got-read-blob/got-read-blob.c
> --- libexec/got-read-blob/got-read-blob.c
> +++ libexec/got-read-blob/got-read-blob.c
> @@ -28,6 +28,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  
>  #include "got_error.h"
> blob - 24e3dce4fa25b6cdd345bf34190e5a0c4c476dba
> file + libexec/got-read-commit/got-read-commit.c
> --- libexec/got-read-commit/got-read-commit.c
> +++ libexec/got-read-commit/got-read-commit.c
> @@ -28,6 +28,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  
>  #include "got_error.h"
> blob - 4685960f41cf29909f661344f0aa7dd6f83457c8
> file + libexec/got-read-gitconfig/got-read-gitconfig.c
> --- libexec/got-read-gitconfig/got-read-gitconfig.c
> +++ libexec/got-read-gitconfig/got-read-gitconfig.c
> @@ -28,6 +28,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  
>  #include "got_error.h"
> blob - cf31541a181db9f3a92ea0820134c23639a7026b
> file + libexec/got-read-object/got-read-object.c
> --- libexec/got-read-object/got-read-object.c
> +++ libexec/got-read-object/got-read-object.c
> @@ -28,6 +28,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  
>  #include "got_error.h"
> blob - 8491283af1685286ea2072fcd623d544df16facd
> file + libexec/got-read-pack/got-read-pack.c
> --- libexec/got-read-pack/got-read-pack.c
> +++ libexec/got-read-pack/got-read-pack.c
> @@ -29,6 +29,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  
>  #include "got_error.h"
> blob - c9959de2131e52c0fd9d5bdd3d72e5504cdfaeb8
> file + libexec/got-read-tag/got-read-tag.c
> --- libexec/got-read-tag/got-read-tag.c
> +++ libexec/got-read-tag/got-read-tag.c
> @@ -28,6 +28,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  
>  #include "got_error.h"
> blob - 577f7c91bd72d65e5741061fa641b0b5b20237f6
> file + libexec/got-read-tree/got-read-tree.c
> --- libexec/got-read-tree/got-read-tree.c
> +++ libexec/got-read-tree/got-read-tree.c
> @@ -28,6 +28,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <sha1.h>
> +#include <unistd.h>
>  #include <zlib.h>
>  
>  #include "got_error.h"
> -- 
> Christian "naddy" Weisgerber                          naddy@mips.inka.de
> 
>