xbps: update to 0.40.

This commit is contained in:
Juan RP 2014-09-18 17:26:57 +02:00
parent 5454662a7a
commit b7d9101cc6
5 changed files with 4 additions and 157 deletions

View File

@ -2,8 +2,8 @@
#
# NOTE: keep this package synchronized with "srcpkgs/xbps".
pkgname=xbps-static
version=0.39
revision=4
version=0.40
revision=1
bootstrap=yes
short_desc="The XBPS package system utilities - static binaries"
maintainer="Juan RP <xtraeme@gmail.com>"

View File

@ -1,25 +0,0 @@
From 68949809836220d76ecd00bf5ee7f3e57d4032bf Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 16 Sep 2014 09:13:32 +0200
Subject: [PATCH] lib/package_msg.c: fix a heap overflow (noticed by @Gottox).
---
lib/package_msg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/package_msg.c b/lib/package_msg.c
index f71dba0..f7d7ee2 100644
--- lib/package_msg.c
+++ lib/package_msg.c
@@ -59,7 +59,7 @@ xbps_cb_message(struct xbps_handle *xhp, xbps_dictionary_t pkgd, const char *key
xbps_dbg_printf(xhp, "[%s] %s: fmemopen %s\n", __func__, pkgver, strerror(rv));
goto out;
};
- buf = malloc(len);
+ buf = malloc(len+1);
assert(buf);
if (fread(buf, len, 1, f) != len) {
if (ferror(f)) {
--
2.1.0

View File

@ -1,51 +0,0 @@
From f80df0fa22ca7d2e0879a943b307770d532db8e8 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 16 Sep 2014 09:56:00 +0200
Subject: [PATCH 1/3] xbps-{install,remove}: print guards in
post-install/pre-remove messages.
This avoids the need to manually add them to the {INSTALL,REMOVE}.msg
files in binary packages, and saves some bytes in the repository archive
and binary packages.
Idea by @dominikh.
---
bin/xbps-install/state_cb.c | 5 ++++-
bin/xbps-remove/main.c | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/bin/xbps-install/state_cb.c b/bin/xbps-install/state_cb.c
index 88f2925..0b5ee4a 100644
--- bin/xbps-install/state_cb.c
+++ bin/xbps-install/state_cb.c
@@ -141,7 +141,10 @@ state_cb(const struct xbps_state_cb_data *xscd, void *cbdata _unused)
rv = yesno("Do you want to import this public key?");
break;
case XBPS_STATE_SHOW_INSTALL_MSG:
- printf("%s: post-install message:\n%s", xscd->arg, xscd->desc);
+ printf("%s: post-install message:\n", xscd->arg);
+ printf("========================================================================\n");
+ printf("%s", xscd->desc);
+ printf("========================================================================\n");
break;
case XBPS_STATE_UNPACK_FILE_PRESERVED:
printf("%s\n", xscd->desc);
diff --git a/bin/xbps-remove/main.c b/bin/xbps-remove/main.c
index 5c2f23a..7b56328 100644
--- bin/xbps-remove/main.c
+++ bin/xbps-remove/main.c
@@ -92,7 +92,10 @@ state_cb_rm(const struct xbps_state_cb_data *xscd, void *cbdata _unused)
}
break;
case XBPS_STATE_SHOW_REMOVE_MSG:
- printf("%s: pre-remove message:\n%s", xscd->arg, xscd->desc);
+ printf("%s: pre-remove message:\n", xscd->arg);
+ printf("========================================================================\n");
+ printf("%s", xscd->desc);
+ printf("========================================================================\n");
break;
/* errors */
case XBPS_STATE_REMOVE_FAIL:
--
2.1.0

View File

@ -1,77 +0,0 @@
From 72c64c76262fef08cc09b25b3ec3ed80ad6136e7 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 17 Sep 2014 06:50:46 +0200
Subject: [PATCH] xbps_file_hash: reduce memory footprint and process file in
small chunks.
With xbps-rindex(8) -c/-r being multithreaded, the memory usage was
insanely high in the build server, with peaks of almost 4GB (this depends
on the file size being processed and number of threads).
Process the file in small chunks instead to compute the SHA256 hash.
---
NEWS | 4 ++++
lib/util_hash.c | 33 +++++++++++++++------------------
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/lib/util_hash.c b/lib/util_hash.c
index 4663ea1..990e31a 100644
--- lib/util_hash.c
+++ lib/util_hash.c
@@ -61,17 +61,16 @@ char *
xbps_file_hash(const char *file)
{
struct stat st;
+ SHA256_CTX ctx;
char hash[SHA256_DIGEST_LENGTH * 2 + 1];
- unsigned char *buf = NULL, digest[SHA256_DIGEST_LENGTH];
+ unsigned char digest[SHA256_DIGEST_LENGTH];
+ ssize_t ret;
+ unsigned char buf[256];
int fd;
- assert(file != NULL);
-
- if ((fd = open(file, O_RDONLY|O_CLOEXEC)) == -1) {
- free(buf);
+ if ((fd = open(file, O_RDONLY)) == -1)
return NULL;
- }
- memset(&st, 0, sizeof(st));
+
if (fstat(fd, &st) == -1) {
(void)close(fd);
return NULL;
@@ -81,20 +80,18 @@ xbps_file_hash(const char *file)
return NULL;
}
- buf = malloc(st.st_size);
- assert(buf);
+ SHA256_Init(&ctx);
+ while ((ret = read(fd, buf, sizeof(buf))) > 0)
+ SHA256_Update(&ctx, buf, ret);
- if (read(fd, buf, st.st_size) != st.st_size) {
- free(buf);
- (void)close(fd);
- return NULL;
- }
- (void)close(fd);
- if (SHA256(buf, st.st_size, digest) == NULL) {
- free(buf);
+ if (ret == -1) {
+ /* read error */
+ (void)close(fd);
return NULL;
}
- free(buf);
+
+ SHA256_Final(digest, &ctx);
+ (void)close(fd);
digest2string(digest, hash, SHA256_DIGEST_LENGTH);
return strdup(hash);
--
2.1.0

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.39
revision=4
version=0.40
revision=1
bootstrap=yes
short_desc="The XBPS package system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"