Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/uclibc: fix copy_file_range() declaration without off_t
@ 2026-11-04  4:58 Yegor Yefremov
  2026-11-04  5:28 ` Baruch Siach via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Yegor Yefremov @ 2026-11-04  4:58 UTC (permalink / raw)
  To: buildroot

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>
+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
+
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH] package/uclibc: fix copy_file_range() declaration without off_t
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Baruch Siach via buildroot @ 2026-11-04  5:28 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: buildroot

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-04  5:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox