Files
MSYS2-packages/pacman/0004-Remove-ldconfig.patch
Christoph Reiter 3b62953e26 pacman: Update
rebuild and sync in the bash 5.2 fix
2022-11-04 20:41:06 +01:00

256 lines
8.5 KiB
Diff

From c32c180cb82c9c585280c4d52c7c8ee14bb7c8f1 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Fri, 21 May 2021 22:53:34 +0200
Subject: [PATCH 04/N] Remove ldconfig
---
lib/libalpm/add.c | 9 ++++++++-
lib/libalpm/remove.c | 4 ++++
lib/libalpm/util.c | 2 ++
test/pacman/ldconfig.stub | 4 ----
test/pacman/meson.build | 4 ----
test/pacman/pactest.py | 4 ----
test/pacman/pmtest.py | 8 +-------
test/pacman/tests/TESTS | 3 ---
test/pacman/tests/ldconfig001.py | 9 ---------
test/pacman/tests/ldconfig002.py | 13 -------------
test/pacman/tests/ldconfig003.py | 9 ---------
11 files changed, 15 insertions(+), 54 deletions(-)
delete mode 100755 test/pacman/ldconfig.stub
delete mode 100644 test/pacman/tests/ldconfig001.py
delete mode 100644 test/pacman/tests/ldconfig002.py
delete mode 100644 test/pacman/tests/ldconfig003.py
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index f0af886..174e051 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -657,7 +657,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
int _alpm_upgrade_packages(alpm_handle_t *handle)
{
size_t pkg_count, pkg_current;
- int skip_ldconfig = 0, ret = 0;
+#ifndef __MSYS__
+ int skip_ldconfig = 0;
+#endif
+ int ret = 0;
alpm_list_t *targ;
alpm_trans_t *trans = handle->trans;
@@ -680,18 +683,22 @@ int _alpm_upgrade_packages(alpm_handle_t *handle)
/* something screwed up on the commit, abort the trans */
trans->state = STATE_INTERRUPTED;
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
+#ifndef __MSYS__
/* running ldconfig at this point could possibly screw system */
skip_ldconfig = 1;
+#endif
ret = -1;
}
pkg_current++;
}
+#ifndef __MSYS__
if(!skip_ldconfig) {
/* run ldconfig if it exists */
_alpm_ldconfig(handle);
}
+#endif
return ret;
}
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index de39724..e7d9cc2 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -765,18 +765,22 @@ int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig)
if(_alpm_remove_single_package(handle, pkg, NULL,
targ_count, pkg_count) == -1) {
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
+#ifndef __MSYS__
/* running ldconfig at this point could possibly screw system */
run_ldconfig = 0;
+#endif
ret = -1;
}
targ_count++;
}
+#ifndef __MSYS__
if(run_ldconfig) {
/* run ldconfig if it exists */
_alpm_ldconfig(handle);
}
+#endif
return ret;
}
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 533ed49..fecee3a 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -796,6 +796,7 @@ cleanup:
return retval;
}
+#ifndef __MSYS__
/** Run ldconfig in a chroot.
* @param handle the context handle
* @return 0 on success, 1 on error
@@ -819,6 +820,7 @@ int _alpm_ldconfig(alpm_handle_t *handle)
return 0;
}
+#endif
/** Helper function for comparing strings using the alpm "compare func"
* signature.
diff --git a/test/pacman/ldconfig.stub b/test/pacman/ldconfig.stub
deleted file mode 100755
index d261a04..0000000
--- a/test/pacman/ldconfig.stub
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# A simple stub to copy into the chroot to fake ldconfig.
-# Simply appends a line to /etc/ld.so.cache if called.
-echo "ldconfig called" >> /etc/ld.so.cache
diff --git a/test/pacman/meson.build b/test/pacman/meson.build
index ecab75b..b0fcd3b 100644
--- a/test/pacman/meson.build
+++ b/test/pacman/meson.build
@@ -79,9 +79,6 @@ pacman_tests = [
'tests/ignore006.py',
'tests/ignore007.py',
'tests/ignore008.py',
- 'tests/ldconfig001.py',
- 'tests/ldconfig002.py',
- 'tests/ldconfig003.py',
'tests/mode001.py',
'tests/mode002.py',
'tests/mode003.py',
@@ -355,7 +352,6 @@ foreach input : pacman_tests
join_paths(meson.current_source_dir(), 'pactest.py'),
'--scriptlet-shell', get_option('scriptlet-shell'),
'--bindir', meson.build_root(),
- '--ldconfig', LDCONFIG,
'--verbose',
join_paths(meson.current_source_dir(), input)
]
diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py
index 184f94d..5e042fd 100755
--- a/test/pacman/pactest.py
+++ b/test/pacman/pactest.py
@@ -104,9 +104,6 @@ def create_parser():
parser.add_option("--scriptlet-shell", type = "string",
dest = "scriptletshell", default = "/bin/sh",
help = "specify path to shell used for install scriptlets")
- parser.add_option("--ldconfig", type = "string",
- dest = "ldconfig", default = "/sbin/ldconfig",
- help = "specify path to ldconfig")
parser.add_option("--review", action = "store_true",
dest = "review", default = False,
help = "review test files, test output, and saved logs")
@@ -146,7 +143,6 @@ if __name__ == "__main__":
env.pacman["valgrind"] = opts.valgrind
env.pacman["manual-confirm"] = opts.manualconfirm
env.pacman["scriptlet-shell"] = opts.scriptletshell
- env.pacman["ldconfig"] = opts.ldconfig
env.config["gpg"] = not opts.missing_gpg
env.config["nls"] = not opts.missing_nls
env.config["curl"] = not opts.missing_curl
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py
index f008f22..e6a3fbd 100644
--- a/test/pacman/pmtest.py
+++ b/test/pacman/pmtest.py
@@ -133,12 +133,10 @@ class pmtest(object):
logdir = os.path.join(self.root, os.path.dirname(util.LOGFILE))
etcdir = os.path.join(self.root, os.path.dirname(util.PACCONF))
bindir = os.path.join(self.root, "bin")
- ldconfig = os.path.basename(pacman["ldconfig"])
- ldconfigdir = os.path.join(self.root, os.path.dirname(pacman["ldconfig"][1:]))
shell = pacman["scriptlet-shell"][1:]
shelldir = os.path.join(self.root, os.path.dirname(shell))
sys_dirs = [dbdir, cachedir, syncdir, tmpdir, logdir, etcdir, bindir,
- ldconfigdir, shelldir]
+ shelldir]
for sys_dir in sys_dirs:
if not os.path.isdir(sys_dir):
vprint("\t%s" % sys_dir[len(self.root)+1:])
@@ -147,10 +145,6 @@ class pmtest(object):
shutil.copy("/bin/sh", bindir)
if shell != "bin/sh":
shutil.copy("/bin/sh", os.path.join(self.root, shell))
- shutil.copy(os.path.join(util.SELFPATH, "ldconfig.stub"),
- os.path.join(ldconfigdir, ldconfig))
- ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w")
- ld_so_conf.close()
# Configuration file
vprint(" Creating configuration file")
diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
index 74c8f67..b29181b 100644
--- a/test/pacman/tests/TESTS
+++ b/test/pacman/tests/TESTS
@@ -78,9 +78,6 @@ TESTS += test/pacman/tests/ignore005.py
TESTS += test/pacman/tests/ignore006.py
TESTS += test/pacman/tests/ignore007.py
TESTS += test/pacman/tests/ignore008.py
-TESTS += test/pacman/tests/ldconfig001.py
-TESTS += test/pacman/tests/ldconfig002.py
-TESTS += test/pacman/tests/ldconfig003.py
TESTS += test/pacman/tests/mode001.py
TESTS += test/pacman/tests/mode002.py
TESTS += test/pacman/tests/mode003.py
diff --git a/test/pacman/tests/ldconfig001.py b/test/pacman/tests/ldconfig001.py
deleted file mode 100644
index a97f28c..0000000
--- a/test/pacman/tests/ldconfig001.py
+++ /dev/null
@@ -1,9 +0,0 @@
-self.description = "Make sure ldconfig runs on an upgrade operation"
-
-p = pmpkg("dummy")
-self.addpkg(p)
-
-self.args = "-U %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("FILE_EXIST=etc/ld.so.cache")
diff --git a/test/pacman/tests/ldconfig002.py b/test/pacman/tests/ldconfig002.py
deleted file mode 100644
index 07f2ec6..0000000
--- a/test/pacman/tests/ldconfig002.py
+++ /dev/null
@@ -1,13 +0,0 @@
-self.description = "Make sure ldconfig runs on an upgrade operation"
-
-lp = pmpkg("dummy")
-self.addpkg2db("local", lp)
-
-p = pmpkg("dummy", "1.0-2")
-self.addpkg(p)
-
-self.args = "-U %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_VERSION=dummy|1.0-2")
-self.addrule("FILE_EXIST=etc/ld.so.cache")
diff --git a/test/pacman/tests/ldconfig003.py b/test/pacman/tests/ldconfig003.py
deleted file mode 100644
index 9b2967e..0000000
--- a/test/pacman/tests/ldconfig003.py
+++ /dev/null
@@ -1,9 +0,0 @@
-self.description = "Make sure ldconfig runs on a sync operation"
-
-sp = pmpkg("dummy")
-self.addpkg2db("sync", sp)
-
-self.args = "-S %s" % sp.name
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("FILE_EXIST=etc/ld.so.cache")