Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uWKPQ-00CHA7-4B for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Jun 2025 19:43:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uWKPO-001xgh-40 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Jun 2025 19:43:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uWKPN-001xgX-Pq for pgsql-hackers@lists.postgresql.org; Mon, 30 Jun 2025 19:43:18 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uWKPM-004ooO-0h for pgsql-hackers@lists.postgresql.org; Mon, 30 Jun 2025 19:43:17 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-453643020bdso43162505e9.1 for ; Mon, 30 Jun 2025 12:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751312595; x=1751917395; darn=lists.postgresql.org; h=user-agent:content-disposition:mime-version:subject:to:from:date :sender:message-id:from:to:cc:subject:date:message-id:reply-to; bh=3tLOFIdUcTTY9eLGfdL5yESiupaJsueZNDyGsFuwCRw=; b=HcH/OeO4vRXI+lB63eYBDgh9Xyac4B53NEa4tpluMJITWUgpZjum/kIklUreMgvc/K XThcHRU1oVd787oFT0v2dZLNbsmgylz5PHUBdclilj8jWKeEOP29PXR9WjmpMdO9yeKk EV9G8asXijmjbIQ7Dv7W3Q6VXbgSX7C4oGyT9mvfGcd0JJd02qbHsbZSievhLMBkkV4e MU2d4JOcFPDQolUnYkcXa9mw/I0B3ICIH00ulP2akLyypuVWDT4r2N8lenwi4UbKqCLK mUcphjmkiIPntTwiijQndRiBlBYgTxDGDhNv1YIicPCdrTPnsdD3eV01xs70RefLiegh Hqgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751312595; x=1751917395; h=user-agent:content-disposition:mime-version:subject:to:from:date :sender:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3tLOFIdUcTTY9eLGfdL5yESiupaJsueZNDyGsFuwCRw=; b=iC04MkklNRXESlE3W59pTdI4Hk4W72umrTBoJ5xYMj0MeIrUbYiMWstEjmp51lct3a ZqZZnhjP4By3gjqRJpYosAFm14DCezoCKe/Yx8PIzKAerHEbeqrUdUses9+hjaBRTijZ aGGKfyNUItuzHgsLj/faelp+kWpoDy/bbLBnxQVHH1N5Fjwjoy6opSx1XRPwTAolVDig DX5MZiOo0O/eGwCxOU2GlJtiyLok9q1+o8XHPV259OrCFitv1Txnb9aabzAOpfKCnNDS cmnBSs4G9p2G3Klk7lYP0zkcTcV+/97GGC05b3ub0Jmpn6f9b4AkFPgz1hLikpGI4N98 ENrQ== X-Gm-Message-State: AOJu0YwzTMFztPHDiBa9Yv1IijrCos4BU/mw39hgAzsKOCG52xr/aJaw eBwiVHoUIE4MnPtWmUM6R97aSyQ0qwxE+UyA5LZiDcXMjYgGgstEAZEI6bpFsw== X-Gm-Gg: ASbGncvl30jept22NcIzgh8sHkDRmbwKTkgA0Fy8z3nmn6XiQTPrQCdvpkV4f8CqCfL keNxigRBMYnDtts5CEDRzdTmTGIlKQmNtBuCNspeqNFCBmBKS6CJtgEFEi/vJ90M2bxMpPjLfU7 PV4nbPJ5miJao6iiWQzO8DE9xBX8OQtzxbiK8lthqF8HJutEBEdDq1FjVfJwHBhiULBwbQnpaqW 4nHV2M19Y5xUh4Ok6ju0lIez6EmXlbWSr8IaMYSAtfjYy4aVBqm+PgfG6J7czSl/p04NQ1kga+3 +9D5dyzvIc9z0lmBkZmIeEq+ZFSJRiR9v/XZPMkXFI1kTm6SaJGzAENDFEdUHR6ERvPVk8H8a1T aXvVyf39nlKdD90vfrzM= X-Google-Smtp-Source: AGHT+IGPNyWwFqweuNXoWHhuFzFdoyFlAVHnVcazBpM5C9it/0UPY1Lz8hh/NTiyHo0mPCmfzO8/nw== X-Received: by 2002:a05:600c:474a:b0:442:d9f2:ded8 with SMTP id 5b1f17b1804b1-4538ee5ea3amr168050125e9.15.1751312594331; Mon, 30 Jun 2025 12:43:14 -0700 (PDT) Received: from lightning.caipicrew.dd-dns.de ([2001:a61:1057:ab01:707a:510:756:de77]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-453941c67c2sm99928625e9.5.2025.06.30.12.43.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 12:43:13 -0700 (PDT) Message-ID: <6862e8d1.050a0220.194b8d.76fa@mx.google.com> X-Google-Original-Message-ID: <20250630194312.GA20978@caipicrew.dd-dns.de;lightning.caipicrew.dd-dns.de> Sender: Michael Banck Received: from mbanck by lightning.caipicrew.dd-dns.de with local (Exim 4.92) (envelope-from ) id 1uWKPJ-0008Er-2L for pgsql-hackers@lists.postgresql.org; Mon, 30 Jun 2025 21:43:13 +0200 Date: Mon, 30 Jun 2025 21:43:13 +0200 From: Michael Banck To: pgsql-hackers@lists.postgresql.org Subject: GNU/Hurd portability patches MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, please find attached the current patches required to get master built and the testsuites run on Debian's hurd-i386 port. I have not had the time to test the hurd-amd64 port in the same fashion, but will do so next. As mentioned in this thread[1], one needs a fairly recent kernel for the high-resolution timers in order to avoid regression test failures, and the buildfarm client run does not like debug_parallel_query. Michael [1] https://www.postgresql.org/message-id/685a3ccd.170a0220.2d27e6.2232%40mx.google.com --x+6KMIRAuhnl3hBn Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Make-safeguard-against-incorrect-fd-flags-for-fsync-.patch" From 2cf70fa676bacf97c24fd0b80bab6fec06b9f2db Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Tue, 10 Jun 2025 12:23:17 +0200 Subject: [PATCH 1/2] Make safeguard against incorrect fd flags for fsync more portable. The current code assumed that O_RDONLY is defined as 0, but this is not universally the case. To fix this, mask the flags with O_ACCMODE and assert that they are O_RDONLY for directories or not O_RDONLY for files. Co-authored-by: Samuel Thibault --- src/backend/storage/file/fd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 0e8299dd556..cd1e661974a 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -411,14 +411,12 @@ pg_fsync(int fd) { int desc_flags = fcntl(fd, F_GETFL); - /* - * O_RDONLY is historically 0, so just make sure that for directories - * no write flags are used. - */ + desc_flags &= O_ACCMODE; + if (S_ISDIR(st.st_mode)) - Assert((desc_flags & (O_RDWR | O_WRONLY)) == 0); + Assert(desc_flags == O_RDONLY); else - Assert((desc_flags & (O_RDWR | O_WRONLY)) != 0); + Assert(desc_flags != O_RDONLY); } errno = 0; #endif -- 2.39.5 --x+6KMIRAuhnl3hBn Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-Make-sure-IOV_MAX-is-defined.patch" From 1dec060f19bc3bea23ec3b2b97f93b0b60fdd63e Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Tue, 10 Jun 2025 23:34:14 +0200 Subject: [PATCH 2/2] Make sure IOV_MAX is defined. We stopped defining IOV_MAX on non-Windows systems since 75357ab9 under the assumption that every non-Windows system defines it in limits.h already. However, the GNU (Hurd) system does not define this limit. As POSIX does not mandate IOV_MAX be defined, define it to 16 if it is undefined. Co-authored-by: Christoph Berg --- src/include/port/pg_iovec.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/include/port/pg_iovec.h b/src/include/port/pg_iovec.h index df40c7208be..d29721bc7e4 100644 --- a/src/include/port/pg_iovec.h +++ b/src/include/port/pg_iovec.h @@ -21,9 +21,6 @@ #else -/* POSIX requires at least 16 as a maximum iovcnt. */ -#define IOV_MAX 16 - /* Define our own POSIX-compatible iovec struct. */ struct iovec { @@ -33,6 +30,11 @@ struct iovec #endif +/* POSIX requires at least 16 as a maximum iovcnt. */ +#ifndef IOV_MAX +#define IOV_MAX 16 +#endif + /* * Define a reasonable maximum that is safe to use on the stack in arrays of * struct iovec and other small types. The operating system could limit us to -- 2.39.5 --x+6KMIRAuhnl3hBn--