gdbm: fix freebsd native build

Pulls in a patch from freebsd-ports. This patch cannot be made unconditional
without a rework since it modifies the base behavior.

+48 -6
+37
pkgs/by-name/gd/gdbm/freebsd-patch-src-lock-c.patch
··· 1 + https://github.com/freebsd/freebsd-ports/blob/e198aef78afa4fd78ddc62fb5d0f7caa1b076bb0/databases/gdbm/files/patch-src_lock.c 2 + 3 + --- a/src/lock.c.orig 2025-03-06 16:24:09 UTC 4 + +++ b/src/lock.c 5 + @@ -73,15 +73,10 @@ try_lock_flock (GDBM_FILE dbf, int nb) 6 + { 7 + return TRY_LOCK_OK; 8 + } 9 + - else if (errno == EWOULDBLOCK) 10 + + else if (errno == EWOULDBLOCK || errno == EINTR) 11 + { 12 + return TRY_LOCK_FAIL; 13 + } 14 + - else if (errno == EINTR) 15 + - { 16 + - errno = ETIME; 17 + - return TRY_LOCK_FAIL; 18 + - } 19 + #endif 20 + return TRY_LOCK_NEXT; 21 + } 22 + @@ -116,7 +111,6 @@ try_lock_lockf (GDBM_FILE dbf, int nb) 23 + switch (errno) 24 + { 25 + case EINTR: 26 + - errno = ETIME; 27 + case EACCES: 28 + case EAGAIN: 29 + case EDEADLK: 30 + @@ -162,7 +156,6 @@ try_lock_fcntl (GDBM_FILE dbf, int nb) 31 + switch (errno) 32 + { 33 + case EINTR: 34 + - errno = ETIME; 35 + case EACCES: 36 + case EAGAIN: 37 + case EDEADLK:
+11 -6
pkgs/by-name/gd/gdbm/package.nix
··· 1 1 { 2 2 lib, 3 3 fetchurl, 4 + fetchpatch, 4 5 stdenv, 5 6 testers, 6 7 updateAutotoolsGnuConfigScriptsHook, ··· 15 16 hash = "sha256-0C2zxZJu2Hf4gXuBzR+S9T73TKjG21Q/u6AnGzTzk+w="; 16 17 }; 17 18 18 - patches = [ 19 - # Remove on next release. 20 - ./upstream-darwin-clock-nanosleep-fix.patch 21 - ./upstream-lockwait-test-fixes.patch 22 - ./upstream-musl-ssize_t-fix.patch 23 - ]; 19 + patches = 20 + [ 21 + # Remove on next release. 22 + ./upstream-darwin-clock-nanosleep-fix.patch 23 + ./upstream-lockwait-test-fixes.patch 24 + ./upstream-musl-ssize_t-fix.patch 25 + ] 26 + ++ lib.optionals stdenv.hostPlatform.isFreeBSD [ 27 + ./freebsd-patch-src-lock-c.patch 28 + ]; 24 29 25 30 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; 26 31