xbps{,-static}: merge patch from master to fix https://github.com/voidlinux/xbps/issues/74

This commit is contained in:
Juan RP 2015-01-18 10:28:34 +01:00
parent 41a1035931
commit 42e6bde3c7
3 changed files with 68 additions and 2 deletions

View file

@ -3,7 +3,7 @@
# NOTE: keep this package synchronized with "srcpkgs/xbps".
pkgname=xbps-static
version=0.43.1
revision=3
revision=4
build_style=configure
short_desc="The XBPS package system utilities - static binaries"
maintainer="Juan RP <xtraeme@gmail.com>"

View file

@ -0,0 +1,66 @@
From d11230a29de77ff5ab121134b5b7f083b10dca52 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sun, 18 Jan 2015 10:22:05 +0100
Subject: [PATCH 1/2] libxbps: abort pkg unpacking as soon as a file cannot be
written.
Close #74
---
NEWS | 4 ++++
lib/package_unpack.c | 17 +++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
--- lib/package_unpack.c
+++ lib/package_unpack.c
@@ -86,7 +86,7 @@ unpack_archive(struct xbps_handle *xhp,
ssize_t entry_size;
const char *file, *entry_pname, *transact;
char *pkgname, *buf;
- int ar_rv, rv, entry_type, flags;
+ int ar_rv, rv, error, entry_type, flags;
bool preserve, update, file_exists, skip_obsoletes;
bool skip_extract, force, xucd_stats;
uid_t euid;
@@ -94,7 +94,7 @@ unpack_archive(struct xbps_handle *xhp,
binpkg_filesd = pkg_filesd = NULL;
force = preserve = update = file_exists = false;
skip_obsoletes = xucd_stats = false;
- ar_rv = rv = entry_type = flags = 0;
+ ar_rv = rv = error = entry_type = flags = 0;
xbps_dictionary_get_bool(pkg_repod, "preserve", &preserve);
xbps_dictionary_get_bool(pkg_repod, "skip-obsoletes", &skip_obsoletes);
@@ -403,10 +403,12 @@ unpack_archive(struct xbps_handle *xhp,
* Extract entry from archive.
*/
if (archive_read_extract(ar, entry, flags) != 0) {
+ error = archive_errno(ar);
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL,
- archive_errno(ar), pkgver,
+ error, pkgver,
"%s: [unpack] failed to extract file `%s': %s",
- pkgver, entry_pname, archive_error_string(ar));
+ pkgver, entry_pname, strerror(error));
+ break;
} else {
if (xhp->unpack_cb != NULL) {
xucd.entry_extract_count++;
@@ -417,10 +419,13 @@ unpack_archive(struct xbps_handle *xhp,
/*
* If there was any error extracting files from archive, error out.
*/
- if (ar_rv == ARCHIVE_FATAL) {
+ if (error || ar_rv == ARCHIVE_FATAL) {
+ rv = error;
+ if (!rv)
+ rv = ar_rv;
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL, rv, pkgver,
"%s: [unpack] failed to extract files: %s",
- pkgver, archive_error_string(ar));
+ pkgver, strerror(rv));
goto out;
}
/*
--
2.2.2

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.43.1
revision=3
revision=4
bootstrap=yes
build_style=configure
short_desc="The XBPS package system utilities"