From 8186dc11a90dbc310acaad7ee867ee995adbd6ed Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Sun, 13 Jan 2008 11:08:59 +0100 Subject: Ensure correct dir permissions in the database. Fix for FS#9176. A previous commit (6e8daa553bbd5) already forced all database files to 644. Now the directories are also forced to 755. Additionally, repo-add now sets the umask to 022, just like makepkg does, to fix the problem at its root. Signed-off-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/util.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/libalpm') diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index d09b9b14..5959482d 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -399,6 +399,8 @@ int _alpm_unpack(const char *archive, const char *prefix, const char *fn) if(S_ISREG(st->st_mode)) { archive_entry_set_mode(entry, 0644); + } else if(S_ISDIR(st->st_mode)) { + archive_entry_set_mode(entry, 0755); } if (fn && strcmp(fn, entryname)) { -- cgit v1.2.3-24-g4f1b From 801a26805663b0a79bf619a0fec853293806969b Mon Sep 17 00:00:00 2001 From: Jaroslaw Swierczynski Date: Sun, 13 Jan 2008 15:06:25 +0100 Subject: FS#9183 : force correct permissions on tmp/. [Xav: removed unneeded makepath_internal function, and fixed the permission value : 1777 -> 01777] Signed-off-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/trans.c | 2 +- lib/libalpm/util.c | 9 +++++++-- lib/libalpm/util.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 292c7160..ecc40a0f 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -487,7 +487,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn, /* creates a directory in $root/tmp/ for copying/extracting the scriptlet */ snprintf(tmpdir, PATH_MAX, "%stmp/", root); if(stat(tmpdir, &buf)) { - _alpm_makepath(tmpdir); + _alpm_makepath_mode(tmpdir, 01777); } snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root); if(mkdtemp(tmpdir) == NULL) { diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 5959482d..e1413a25 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -178,8 +178,13 @@ char* strsep(char** str, const char* delims) } #endif -/* does the same thing as 'mkdir -p' */ int _alpm_makepath(const char *path) +{ + return(_alpm_makepath_mode(path, 0755)); +} + +/* does the same thing as 'mkdir -p' */ +int _alpm_makepath_mode(const char *path, mode_t mode) { char *orig, *str, *ptr; char full[PATH_MAX] = ""; @@ -196,7 +201,7 @@ int _alpm_makepath(const char *path) strcat(full, "/"); strcat(full, ptr); if(stat(full, &buf)) { - if(mkdir(full, 0755)) { + if(mkdir(full, mode)) { FREE(orig); umask(oldmask); _alpm_log(PM_LOG_ERROR, _("failed to make path '%s' : %s\n"), diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 3ffe6328..e9e0af1f 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -50,6 +50,7 @@ #define ASSERT(cond, action) do { if(!(cond)) { action; } } while(0) int _alpm_makepath(const char *path); +int _alpm_makepath_mode(const char *path, mode_t mode); int _alpm_copyfile(const char *src, const char *dest); char *_alpm_strtrim(char *str); char *_alpm_strreplace(const char *str, const char *needle, const char *replace); -- cgit v1.2.3-24-g4f1b From 0c5b68877b107f4844f29eb77a9ea5bf7b73fe01 Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Mon, 14 Jan 2008 20:28:29 +0100 Subject: Change the versioned provision format. Change the 'provname provver' format to 'provname=provver'. In .PKGINFO, the provisions are copied from the PKGBUILD without quotes. So the provision version was actually handled as a different provision... See FS#9171. Dan: Unfortunately we have to change our original specification for versioned provisions with this patch, but it ends up being the simpler and cleaner solution in the long run, and if there is any time to change it the time is now before many packages have been built. Keeping the ' ' based format would have required us to do special parsing in repo-add, as well as being susceptible to users not using quotes in their provides array. Hopefully this will resolve the issues we had with our initial plan. Sorry for the confusion. Acked-by: Nagy Gabor Signed-off-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/db.c | 2 +- lib/libalpm/deps.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index d8e770b8..1485c34a 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -650,7 +650,7 @@ int _alpm_prov_cmp(const void *provision, const void *needle) char *tmpptr; char *provname = strdup(provision); int retval = 0; - tmpptr = strchr(provname, ' '); + tmpptr = strchr(provname, '='); if(tmpptr != NULL) { /* provision-version */ *tmpptr='\0'; diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 8c302b69..ec52083e 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -336,10 +336,10 @@ int SYMEXPORT alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) satisfy = (strcmp(pkgname, dep->name) == 0 && dep_vercmp(pkgversion, dep->mod, dep->version)); - /* check provisions, format : "name version" */ + /* check provisions, format : "name=version" */ for(i = alpm_pkg_get_provides(pkg); i && !satisfy; i = i->next) { char *provname = strdup(i->data); - char *provver = strchr(provname, ' '); + char *provver = strchr(provname, '='); if(provver == NULL) { /* no provision version */ satisfy = (dep->mod == PM_DEP_MOD_ANY -- cgit v1.2.3-24-g4f1b