From 53a3c5db6c0cbc4b8df5e4b93e5f84e8641b1780 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Tue, 13 Aug 2019 12:54:18 +0200 Subject: [PATCH] xbps: add patch to not remove non-symlinks when purging alternatives --- srcpkgs/xbps/patches/56ae190.patch | 30 ++++++++++++++++++++++++++++++ srcpkgs/xbps/template | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/xbps/patches/56ae190.patch diff --git a/srcpkgs/xbps/patches/56ae190.patch b/srcpkgs/xbps/patches/56ae190.patch new file mode 100644 index 0000000000..022c7166b0 --- /dev/null +++ b/srcpkgs/xbps/patches/56ae190.patch @@ -0,0 +1,30 @@ +commit 56ae1907b9d588910a5e4712fdaa5784c1641f14 +Author: Duncan Overbruck +Date: Tue Aug 13 12:53:01 2019 +0200 + + lib/package_alternatives.c: check if alternative is a symlink before removing it + +diff --git lib/package_alternatives.c lib/package_alternatives.c +index 9b4d0027..5e4f2b36 100644 +--- lib/package_alternatives.c ++++ lib/package_alternatives.c +@@ -111,6 +111,7 @@ static int + remove_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname) + { + unsigned int i, cnt; ++ struct stat st; + + cnt = xbps_array_count(a); + for (i = 0; i < cnt; i++) { +@@ -132,6 +133,11 @@ remove_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname) + } else { + lnk = xbps_xasprintf("%s%s", xhp->rootdir, l); + } ++ if (lstat(lnk, &st) == -1 || !S_ISLNK(st.st_mode)) { ++ free(lnk); ++ free(l); ++ continue; ++ } + xbps_set_cb_state(xhp, XBPS_STATE_ALTGROUP_LINK_REMOVED, 0, NULL, + "Removing '%s' alternatives group symlink: %s", grname, l); + unlink(lnk); diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template index b1fd0121cb..8f217f60af 100644 --- a/srcpkgs/xbps/template +++ b/srcpkgs/xbps/template @@ -1,7 +1,7 @@ # Template file for 'xbps' pkgname=xbps version=0.56 -revision=6 +revision=7 bootstrap=yes build_style=configure short_desc="XBPS package system utilities"