From: Baruch Siach via buildroot <buildroot@buildroot.org>
To: Yegor Yefremov <yegorslists@googlemail.com>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/uclibc: fix copy_file_range() declaration without off_t
Date: Wed, 04 Nov 2026 07:28:55 +0200 [thread overview]
Message-ID: <87a4npupuw.fsf@tarshish> (raw)
In-Reply-To: <20261104045834.3308280-1-yegorslists@googlemail.com> (Yegor Yefremov's message of "Wed, 4 Nov 2026 05:58:34 +0100")
Hi Yegor,
On Wed, Nov 04 2026, Yegor Yefremov wrote:
> uClibc-ng 1.0.59 declares copy_file_range() in unistd.h under
> "#ifdef _GNU_SOURCE", while off_t is only defined there for
> __USE_XOPEN or __USE_XOPEN2K, which <features.h> sets when it is first
> included. Sources that include a libc header before defining
> _GNU_SOURCE, typically through an autoconf config.h, therefore hit an
> undefined type. tpm2-tss does this in its FTDI SPI TCTI, which includes
> <stdlib.h>, then config.h and, through ftdi.h and usb.h, unistd.h:
>
> .../sysroot/usr/include/unistd.h:1166:30: error: unknown type name 'off_t'
> 1166 | ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
>
> Add a patch, submitted upstream, that declares copy_file_range() under
> __USE_GNU instead, as glibc does.
>
> This issue has been present since commit b94d3eb72854 ("package/uclibc:
> bump to 1.0.59"), as copy_file_range() was added in uClibc-ng 1.0.59.
> It therefore affects 2026.08 and later, 2026.05.x since 2026.05.2 and
> 2025.02.x since 2025.02.17, where the bump was backported.
>
> Fixes:
> https://autobuild.buildroot.org/results/1408ad5881aeff754b0493f1a0d0970d1afdaaf6
>
> Fixes: b94d3eb728546aeb196941472b98922843e36279 ("package/uclibc: bump to 1.0.59")
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
> ...lare-copy_file_range-under-__USE_GNU.patch | 45 +++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 package/uclibc/0008-unistd.h-declare-copy_file_range-under-__USE_GNU.patch
>
> diff --git a/package/uclibc/0008-unistd.h-declare-copy_file_range-under-__USE_GNU.patch b/package/uclibc/0008-unistd.h-declare-copy_file_range-under-__USE_GNU.patch
> new file mode 100644
> index 0000000000..6cf0a13eb6
> --- /dev/null
> +++ b/package/uclibc/0008-unistd.h-declare-copy_file_range-under-__USE_GNU.patch
> @@ -0,0 +1,45 @@
> +From 9cf18aedf41589b11ce5328a85726441d3b86282 Mon Sep 17 00:00:00 2001
> +From: Yegor Yefremov <yegorslists@googlemail.com>
> +Date: Tue, 3 Nov 2026 23:54:41 +0100
> +Subject: [PATCH] unistd.h: declare copy_file_range() under __USE_GNU
> +
> +copy_file_range() is declared under "#ifdef _GNU_SOURCE", but off_t is
> +only defined in unistd.h for __USE_XOPEN or __USE_XOPEN2K, which are
> +set by <features.h> when it is first included.
> +
> +When a source file includes another libc header before defining
> +_GNU_SOURCE, for example through an autoconf config.h, _GNU_SOURCE is
> +defined by the time unistd.h is read, but __USE_XOPEN* are not, so the
> +declaration uses an undefined type. This breaks tpm2-tss, which
> +includes <stdlib.h>, then config.h and, through ftdi.h and usb.h,
> +unistd.h:
> +
> + unistd.h:1166:30: error: unknown type name 'off_t'
> + 1166 | ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
> +
> +Test __USE_GNU instead, as is done for the other GNU extensions and as
> +glibc does.
> +
> +Assisted-by: Claude:claude-opus-5-5
> +Upstream: sent to devel@uclibc-ng.org on 2026-11-04, Message-Id <20261103230715.3240121-1-yegorslists@googlemail.com>
Better link to your message in upstream mailing list archive:
https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thread/UXSNFB2SYQEX2ITN3Y7AEQH5PXVPRN5S/
baruch
> +Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> +---
> + include/unistd.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/include/unistd.h b/include/unistd.h
> +index 1956eee18..fb0ea0ff7 100644
> +--- a/include/unistd.h
> ++++ b/include/unistd.h
> +@@ -1263,7 +1263,7 @@ extern int getentropy(void *__buf, size_t __len) __nonnull ((1)) __wur;
> + extern __pid_t gettid(void);
> + #endif
> +
> +-#ifdef _GNU_SOURCE
> ++#ifdef __USE_GNU
> + ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
> + #endif
> +
> +--
> +2.34.1
> +
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2026-11-04 5:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 4:58 [Buildroot] [PATCH] package/uclibc: fix copy_file_range() declaration without off_t Yegor Yefremov
2026-11-04 5:28 ` Baruch Siach via buildroot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a4npupuw.fsf@tarshish \
--to=buildroot@buildroot.org \
--cc=baruch@tkos.co.il \
--cc=yegorslists@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox