[packages/libcap] - updated o 2.72 + patch

qboosh qboosh at pld-linux.org
Fri Nov 15 18:35:01 CET 2024


commit 9d26d578e0c5f386d8cf2c59c1e85e5e55bf589b
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Nov 15 18:10:27 2024 +0100

    - updated o 2.72 + patch

 libcap-getdents64.patch | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
 libcap.spec             |  6 +++--
 2 files changed, 71 insertions(+), 2 deletions(-)
---
diff --git a/libcap.spec b/libcap.spec
index 7c716b6..03bfa48 100644
--- a/libcap.spec
+++ b/libcap.spec
@@ -9,13 +9,14 @@ Summary:	POSIX.1e capability suite
 Summary(pl.UTF-8):	Wsparcie dla standardu "capability" POSIX.1e
 Summary(pt_BR.UTF-8):	Biblioteca para leitura e configuração de capabilities.
 Name:		libcap
-Version:	2.71
+Version:	2.72
 Release:	1
 Epoch:		1
 License:	GPL v2 or BSD
 Group:		Applications/System
 Source0:	https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/%{name}-%{version}.tar.xz
-# Source0-md5:	4264623bbc34c176079056932314fe29
+# Source0-md5:	0d9dd20dbdc7a94942f0c43ae706e5ac
+Patch0:		%{name}-getdents64.patch
 URL:		https://sites.google.com/site/fullycapable/
 BuildRequires:	attr-devel
 %{?with_golang:BuildRequires:	golang}
@@ -93,6 +94,7 @@ Moduł PAM capability wymuszający dziedziczone zbiory uprawnień.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 LDFLAGS="%{rpmldflags}" \
diff --git a/libcap-getdents64.patch b/libcap-getdents64.patch
new file mode 100644
index 0000000..395ec03
--- /dev/null
+++ b/libcap-getdents64.patch
@@ -0,0 +1,67 @@
+From 304089b078f2f339cd7ccb030a0ad0194aea0a0f Mon Sep 17 00:00:00 2001
+From: Xi Ruoyao <xry111 at xry111.site>
+Date: Tue, 12 Nov 2024 11:44:56 +0800
+Subject: psx: use getdents64 instead of getdents
+
+On relatively new architectures (for example ARM64, RISC-V, and
+LoongArch), the kernel does not have a getdents syscall.  Use getdents64
+instead to fix the build on them.
+
+The getdents64 syscall was added in Linux 2.4 and I don't think we
+should still support older kernels today.
+
+Signed-off-by: Xi Ruoyao <xry111 at xry111.site>
+Signed-off-by: Andrew G. Morgan <morgan at kernel.org>
+---
+ psx/psx.c | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/psx/psx.c b/psx/psx.c
+index d66a7bf..bf7d69f 100644
+--- a/psx/psx.c
++++ b/psx/psx.c
+@@ -410,10 +410,11 @@ static long int __psx_immediate_syscall(long int syscall_nr,
+ 
+ #define BUF_SIZE 4096
+ 
+-struct psx_linux_dirent {
+-    unsigned long d_ino;
+-    off_t d_off;
++struct psx_linux_dirent64 {
++    long long d_ino;
++    long long d_off;
+     unsigned short d_reclen;
++    unsigned char d_type;
+     char d_name[];
+ };
+ 
+@@ -486,11 +487,11 @@ long int __psx_syscall(long int syscall_nr, ...) {
+ 
+ 	for (;;) {
+ 	    char buf[BUF_SIZE];
+-	    size_t nread = syscall(SYS_getdents, fd, buf, BUF_SIZE);
++	    size_t nread = syscall(SYS_getdents64, fd, buf, BUF_SIZE);
+ 	    if (nread == 0) {
+ 		break;
+ 	    } else if (nread < 0) {
+-		perror("getdents failed");
++		perror("getdents64 failed");
+ 		kill(psx_tracker.pid, SIGKILL);
+ 	    }
+ 
+@@ -499,10 +500,10 @@ long int __psx_syscall(long int syscall_nr, ...) {
+ 	    for (offset = 0; offset < nread; offset += reclen) {
+ 		/* deal with potential unaligned reads */
+ 		memcpy(&reclen, buf + offset +
+-		       offsetof(struct psx_linux_dirent, d_reclen),
++		       offsetof(struct psx_linux_dirent64, d_reclen),
+ 		       sizeof(reclen));
+ 		char *dir = (buf + offset +
+-			     offsetof(struct psx_linux_dirent, d_name));
++			     offsetof(struct psx_linux_dirent64, d_name));
+ 		long tid = atoi(dir);
+ 		if (tid == 0 || tid == self) {
+ 		    continue;
+-- 
+cgit 1.2.3-korg
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libcap.git/commitdiff/9d26d578e0c5f386d8cf2c59c1e85e5e55bf589b



More information about the pld-cvs-commit mailing list