diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-09-04 09:31:50 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-09-04 09:31:50 +0000 |
commit | 5014d53570be8a01ce17e9e2586765903b39a862 (patch) | |
tree | add6abd8c9892dc1fa058e8361a020d5e7664215 /main/apk-tools | |
parent | ff9a1b17d16e93dadd00c9d5648aa649e076234e (diff) | |
download | aports-5014d53570be8a01ce17e9e2586765903b39a862.tar.bz2 aports-5014d53570be8a01ce17e9e2586765903b39a862.tar.xz |
main/apk-tools: fix directory re-creation
ref #1348
Diffstat (limited to 'main/apk-tools')
-rw-r--r-- | main/apk-tools/0001-db-remove-AT_SYMLINK_NOFOLLOW-for-directory-permissi.patch | 38 | ||||
-rw-r--r-- | main/apk-tools/APKBUILD | 6 |
2 files changed, 42 insertions, 2 deletions
diff --git a/main/apk-tools/0001-db-remove-AT_SYMLINK_NOFOLLOW-for-directory-permissi.patch b/main/apk-tools/0001-db-remove-AT_SYMLINK_NOFOLLOW-for-directory-permissi.patch new file mode 100644 index 0000000000..f3554419b5 --- /dev/null +++ b/main/apk-tools/0001-db-remove-AT_SYMLINK_NOFOLLOW-for-directory-permissi.patch @@ -0,0 +1,38 @@ +From 8a4371ccd73e8f8672466881bd3b782de919cd93 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> +Date: Tue, 4 Sep 2012 10:38:13 +0300 +Subject: [PATCH] db: remove AT_SYMLINK_NOFOLLOW for directory permissions + +fchmodat does not support this flag - symlinks do not have permissions. + +Sysadmin probably does not expect us to not follow symlinks either: +if /var -> /mnt/foo/var, we should be making sure the permissions +and ownership is correct on the target directory, not on the symlink. + +Since fchmodat never returned ENOENT with AT_SYMLINK_NOFOLLOW, this +also fixes directory re-creation if it does not exist. fixes #1348. +--- + src/database.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/database.c b/src/database.c +index efff29f..d1a8f1a 100644 +--- a/src/database.c ++++ b/src/database.c +@@ -229,11 +229,11 @@ static void apk_db_dir_mkdir(struct apk_database *db, struct apk_db_dir *dir) + return; + + if ((dir->refs == 1) || +- (fchmodat(db->root_fd, dir->name, dir->mode, AT_SYMLINK_NOFOLLOW) != 0 && ++ (fchmodat(db->root_fd, dir->name, dir->mode, 0) != 0 && + errno == ENOENT)) + if ((mkdirat(db->root_fd, dir->name, dir->mode) != 0 && + errno == EEXIST)) +- if (fchmodat(db->root_fd, dir->name, dir->mode, AT_SYMLINK_NOFOLLOW) != 0) ++ if (fchmodat(db->root_fd, dir->name, dir->mode, 0) != 0) + ; + + if (fchownat(db->root_fd, dir->name, dir->uid, dir->gid, 0) != 0) +-- +1.7.12 + diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD index ab1ff34ad0..0bd514fe6d 100644 --- a/main/apk-tools/APKBUILD +++ b/main/apk-tools/APKBUILD @@ -1,12 +1,13 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=apk-tools pkgver=2.3.2 -pkgrel=0 +pkgrel=1 pkgdesc="Alpine Package Keeper - package manager for alpine" subpackages="$pkgname-static lua-apk:luaapk" depends= makedepends="zlib-dev openssl-dev lua-dev" source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 + 0001-db-remove-AT_SYMLINK_NOFOLLOW-for-directory-permissi.patch " url="http://git.alpinelinux.org/cgit/apk-tools/" @@ -58,4 +59,5 @@ luaapk() { mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/ } -md5sums="813b7c9fd7f6159972dc4fa5dfcc97c5 apk-tools-2.3.2.tar.bz2" +md5sums="813b7c9fd7f6159972dc4fa5dfcc97c5 apk-tools-2.3.2.tar.bz2 +a5a635f510e6f69b1e2f6cadb45efe04 0001-db-remove-AT_SYMLINK_NOFOLLOW-for-directory-permissi.patch" |