[pacman-dev] [PATCH] fixup run XferCommand via exec

Andrew Gregory andrew.gregory.8 at gmail.com
Sun Jun 9 20:50:15 UTC 2019


---

A few changes I omitted from the initial patch.

Does anybody know what usepart was for?  It was unset unless %o was
used in XferCommand, but I'm not sure what the use case for an
XferCommand without %o would be.

 src/pacman/conf.c                   | 11 ++++-------
 test/pacman/tests/sync200.py        |  2 +-
 test/pacman/tests/xfercommand001.py |  2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index faf446dc..c2b7da43 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -249,7 +249,6 @@ static int download_with_xfercommand(const char *url, const char *localpath,
 		int force)
 {
 	int ret = 0, retval;
-	int usepart = 0;
 	int cwdfd = -1;
 	struct stat st;
 	char *destfile, *tempfile, *filename;
@@ -322,12 +321,10 @@ static int download_with_xfercommand(const char *url, const char *localpath,
 	} else {
 		/* download was successful */
 		ret = 0;
-		if(usepart) {
-			if(rename(tempfile, destfile)) {
-				pm_printf(ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
-						tempfile, destfile, strerror(errno));
-				ret = -1;
-			}
+		if(rename(tempfile, destfile)) {
+			pm_printf(ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
+					tempfile, destfile, strerror(errno));
+			ret = -1;
 		}
 	}
 
diff --git a/test/pacman/tests/sync200.py b/test/pacman/tests/sync200.py
index 2bcdd5d3..18f38b81 100644
--- a/test/pacman/tests/sync200.py
+++ b/test/pacman/tests/sync200.py
@@ -1,6 +1,6 @@
 self.description = "Synchronize the local database"
 
-self.option['XferCommand'] = ['/usr/bin/curl %u > %o']
+self.option['XferCommand'] = ['/usr/bin/curl %u -o %o']
 
 sp1 = pmpkg("spkg1", "1.0-1")
 sp1.depends = ["spkg2"]
diff --git a/test/pacman/tests/xfercommand001.py b/test/pacman/tests/xfercommand001.py
index 0d244dc6..0ac99080 100644
--- a/test/pacman/tests/xfercommand001.py
+++ b/test/pacman/tests/xfercommand001.py
@@ -3,7 +3,7 @@
 # this setting forces us to download packages
 self.cachepkgs = False
 #wget doesn't support file:// urls.  curl does
-self.option['XferCommand'] = ['/usr/bin/curl %u > %o']
+self.option['XferCommand'] = ['/usr/bin/curl %u -o %o']
 
 numpkgs = 10
 pkgnames = []
-- 
2.21.0


More information about the pacman-dev mailing list