[pacman-dev] fixup run XferCommand via exec

Message ID 20190609205015.16094-1-andrew.gregory.8@gmail.com
State Superseded, archived
Headers show
Series
  • [pacman-dev] fixup run XferCommand via exec
Related show

Commit Message

Andrew Gregory June 9, 2019, 8:50 p.m. UTC
---

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(-)

Comments

Allan McRae June 11, 2019, 1:06 a.m. UTC | #1
On 10/6/19 6:50 am, Andrew Gregory wrote:
> 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.

When %o was added, there were cases in the wild where users had a
downloader that did not support resuming the download.  No sure this
would be the case now...

Allan
Andrew Gregory June 11, 2019, 7:44 a.m. UTC | #2
On 06/11/19 at 11:06am, Allan McRae wrote:
> On 10/6/19 6:50 am, Andrew Gregory wrote:
> > 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.
> 
> When %o was added, there were cases in the wild where users had a
> downloader that did not support resuming the download.  No sure this
> would be the case now...

I assume nobody minds if that possibility is removed.
Allan McRae Aug. 5, 2019, 11:53 a.m. UTC | #3
On 10/6/19 6:50 am, Andrew Gregory wrote:
> ---
> 
> 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.
> 

According to the man page, %o is optional.   I'm OK for that to change...

Allan

Patch

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 = []