aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/xar/patches/f_getpath_replacement.diff30
-rw-r--r--system/xar/patches/series1
-rw-r--r--system/xar/xar.SlackBuild19
-rw-r--r--system/xar/xar.info6
4 files changed, 50 insertions, 6 deletions
diff --git a/system/xar/patches/f_getpath_replacement.diff b/system/xar/patches/f_getpath_replacement.diff
new file mode 100644
index 0000000000..45eca09092
--- /dev/null
+++ b/system/xar/patches/f_getpath_replacement.diff
@@ -0,0 +1,30 @@
+--- a/lib/archive.c 2024-09-24 16:39:21.000000000 -0400
++++ b/lib/archive.c 2024-11-23 21:12:31.213747869 -0500
+@@ -493,6 +493,18 @@
+ return ret;
+ }
+
++/* 20241123 bkw: work around lack of fcntl() F_GETPATH on Linux */
++static int fd2path(int fd, char *buf) {
++ char procpath[PATH_MAX];
++
++ sprintf(procpath, "/proc/self/fd/%d", fd);
++
++ if(realpath(procpath, buf))
++ return 0;
++
++ return -1;
++}
++
+ xar_t xar_fdopen_digest_verify(int fd, int32_t flags, void *expected_toc_digest, size_t expected_toc_digest_len)
+ {
+ // Dup the descriptor vended to us so that we don't take ownership
+@@ -507,7 +519,7 @@
+ // If there are hardlinks, the path we pick is the most recently opened by
+ // the filesystem; which is effectively random.
+ char path_buff[PATH_MAX];
+- if (fcntl(fd, F_GETPATH, path_buff) < 0) {
++ if (fd2path(fd, path_buff) < 0) {
+ close(fd);
+ return NULL;
+ }
diff --git a/system/xar/patches/series b/system/xar/patches/series
index 49d45200fe..99912be3d1 100644
--- a/system/xar/patches/series
+++ b/system/xar/patches/series
@@ -5,3 +5,4 @@ xar-1.8-openssl-1.1.patch
xar-1.8.0.0.452-linux.patch
xar-1.8.0.0.487-non-darwin.patch
xar-1.8.0.0.487-variable-sized-object.patch
+f_getpath_replacement.diff
diff --git a/system/xar/xar.SlackBuild b/system/xar/xar.SlackBuild
index 242854f5c9..1283e260da 100644
--- a/system/xar/xar.SlackBuild
+++ b/system/xar/xar.SlackBuild
@@ -14,13 +14,14 @@
# The original google code project is dead, and so is mackyle's github
# project. The Apple github project might be deprecated, but it's
-# still being updated (as of August 2023).
+# still being updated (as of September 2024).
# For some reason, gentoo and other distros want to give this version
# numbers like "1.8.0.0.452". Dunno where the extra zeroes come from.
# "xar --version" reports "1.8dev", the tarball's version number
# is the SVN revision (452, 498, etc).
+# 20241123 bkw: update for v501 (needed a new patch).
# 20231118 bkw: update for v498.
# 20230711 bkw: no script changes, just a note to myself: there's now
@@ -39,7 +40,7 @@
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=xar
-VERSION=${VERSION:-1.8dev+498}
+VERSION=${VERSION:-1.8dev+501}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -91,8 +92,20 @@ find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
cd $PRGNAM
-# Patches came from liguros:
+# Most of these patches came from liguros:
# https://gitlab.com/liguros/liguros-repo/-/tree/stable/app-arch/xar
+
+# 20241123 bkw: their xar_lib_archive_c.patch is *wrong*! It will
+# indeed let xar compile, but it won't let xar_fdopen_digest_verify()
+# work correctly (it would always return NULL, because fcntl() would
+# fail since there's no such thing as cmd #50 on Linux).
+
+# I added my own (hopefully) correct f_getpath_replacement.diff instead.
+# Note that nothing in the xar application itself ever calls
+# xar_fdopen_digest_verify(); it's part of the API for libxar, for
+# other software to use. So I haven't really tested the patch, though
+# did thoroughly test its fd2path() function.
+
for i in $( cat $CWD/patches/series ); do
patch -p1 < $CWD/patches/$i
done
diff --git a/system/xar/xar.info b/system/xar/xar.info
index 86abd2cf83..f414544235 100644
--- a/system/xar/xar.info
+++ b/system/xar/xar.info
@@ -1,8 +1,8 @@
PRGNAM="xar"
-VERSION="1.8dev+498"
+VERSION="1.8dev+501"
HOMEPAGE="https://opensource.apple.com/source/xar/"
-DOWNLOAD="https://github.com/apple-oss-distributions/xar/archive/xar-498/xar-xar-498.tar.gz"
-MD5SUM="4a4bcc060d8e9a1678c39ee3b701c44b"
+DOWNLOAD="https://github.com/apple-oss-distributions/xar/archive/xar-501/xar-xar-501.tar.gz"
+MD5SUM="050ec6c7a4d0c6dbe04a16470b6fdbaf"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""