aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch33
-rw-r--r--main/apk-tools/0002-db-catch-asprintf-failure.patch26
-rw-r--r--main/apk-tools/APKBUILD8
3 files changed, 65 insertions, 2 deletions
diff --git a/main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch b/main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch
new file mode 100644
index 0000000000..cbb220e979
--- /dev/null
+++ b/main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch
@@ -0,0 +1,33 @@
+From 4b9f6d430f04e4470cf5d49ee72a43ebaed0fb62 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 13 Mar 2017 12:54:39 +0000
+Subject: [PATCH 1/2] db: prevent umount /proc when it was mounted by someone
+ else
+
+This fixes regression introduced by commit 72b878e655
+---
+ src/database.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/database.c b/src/database.c
+index e3ced7d..356907e 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1581,8 +1581,13 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+ if (errno == ENOENT) mkdir(db->root_proc_dir, 0555);
+ stfs.f_type = 0;
+ }
+- if (stfs.f_type != PROC_SUPER_MAGIC)
++ if (stfs.f_type != PROC_SUPER_MAGIC) {
+ mount("proc", db->root_proc_dir, "proc", 0, 0);
++ } else {
++ /* was already mounted. prevent umount on close */
++ free(db->root_proc_dir);
++ db->root_proc_dir = NULL;
++ }
+ }
+
+ blob = APK_BLOB_STR("+etc\n" "@etc/init.d\n" "!etc/apk\n");
+--
+2.11.1
+
diff --git a/main/apk-tools/0002-db-catch-asprintf-failure.patch b/main/apk-tools/0002-db-catch-asprintf-failure.patch
new file mode 100644
index 0000000000..ede2765a20
--- /dev/null
+++ b/main/apk-tools/0002-db-catch-asprintf-failure.patch
@@ -0,0 +1,26 @@
+From 5f6e963680b8f4ef9a036ea44483b8dcca3c6ce2 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 13 Mar 2017 12:57:43 +0000
+Subject: [PATCH 2/2] db: catch asprintf failure
+
+---
+ src/database.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/database.c b/src/database.c
+index 356907e..80b80e9 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1576,7 +1576,8 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+ apk_blob_to_file(db->root_fd, apk_arch_file, *db->arch, APK_BTF_ADD_EOL);
+
+ /* mount /proc */
+- asprintf(&db->root_proc_dir, "%s/proc", dbopts->root);
++ if (asprintf(&db->root_proc_dir, "%s/proc", dbopts->root) == -1)
++ goto ret_errno;
+ if (statfs(db->root_proc_dir, &stfs) != 0) {
+ if (errno == ENOENT) mkdir(db->root_proc_dir, 0555);
+ stfs.f_type = 0;
+--
+2.11.1
+
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index d1f270cbcf..b4bc0d7c5b 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.7.0
-pkgrel=1
+pkgrel=2
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
@@ -14,6 +14,8 @@ if [ "$CBUILD" = "$CHOST" ]; then
fi
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
0001-commit-include-limits.h-for-PATH_MAX.patch
+ 0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch
+ 0002-db-catch-asprintf-failure.patch
"
url="http://git.alpinelinux.org/cgit/apk-tools/"
@@ -83,4 +85,6 @@ luaapk() {
}
sha512sums="e6bb4bdada76f5d18b9a6ec8981b4619dd2e2a517ff3248693a5b2743286e2ee605dabf775bcdbbab5dff479334662b11c3c9c296cd17e3db4fbdcdc2efe9ea7 apk-tools-2.7.0.tar.xz
-a05a462982518093f2cb8d82fee3970cc8e0d46736a46679a9369e95497cca26fd2c3493bc86ebc0513757529fa9aa6b954bbf5b24992f92839573758b977cf7 0001-commit-include-limits.h-for-PATH_MAX.patch"
+a05a462982518093f2cb8d82fee3970cc8e0d46736a46679a9369e95497cca26fd2c3493bc86ebc0513757529fa9aa6b954bbf5b24992f92839573758b977cf7 0001-commit-include-limits.h-for-PATH_MAX.patch
+2c2dceb8101bd9c42800a2fcdc7f22d546c548adcf860887992ad87b0246444729c56c29b2daafcd3af6ec0f92da4cba8e10506ac8c8b9024f31482033d0026d 0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch
+21764f250f682698f21b5453f5e66c4b2722585d28196ebee61360e69b07967408fff40a27fd7215d123869694f54f5cece4b23c944f4d950eca1f47cfa97501 0002-db-catch-asprintf-failure.patch"