From a73ad4f0e3981acab7234e4b17a08a52bd273ab9 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Fri, 2 Jan 2009 19:12:22 +1000 Subject: Separate local db directory creation and db write Changelogs and install files were getting extracted into the local db folder before it was manually created. This created issues for uses with 0077 umasks and was highlighted with the new sudo handling of umasks (FS#12263). This moves the local db creation to its own function which is called before the start of package archive extraction. Also, added a check that the folder is actually created. Signed-off-by: Allan McRae [Dan: rename to _alpm_db_prepare()] Signed-off-by: Dan McGee --- lib/libalpm/add.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index eef7aab1..1e8ec9f2 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -696,6 +696,16 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, } } + /* prepare directory for database entries so permission are correct after + changelog/install script installation (FS#12263) */ + if(_alpm_db_prepare(db, newpkg)) { + alpm_logaction("error: could not create database entry %s-%s\n", + alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); + pm_errno = PM_ERR_DB_WRITE; + ret = -1; + goto cleanup; + } + if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) { struct archive *archive; struct archive_entry *entry; -- cgit v1.2.3-24-g4f1b