diff --git a/NEWS b/NEWS index 68c32e0f..958d21e6 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ xbps-0.39 (???): + * xbps-rindex: fix -a/--add mode to create repodata archives with 0664 permissions; + and do not create a new archive if the file cannot be open/locked, error out + instead... otherwise the file lock is ignored. + xbps-0.38 (2014-09-14): * Disabled best pkg matching code for performance reasons. When installing diff --git a/bin/xbps-rindex/index-add.c b/bin/xbps-rindex/index-add.c index b04a2fc5..a61e4e5e 100644 --- a/bin/xbps-rindex/index-add.c +++ b/bin/xbps-rindex/index-add.c @@ -59,6 +59,12 @@ index_add(struct xbps_handle *xhp, int argc, char **argv, bool force) repodir = dirname(tmprepodir); repo = xbps_repo_open(xhp, repodir, true); + if (repo == NULL && errno != ENOENT) { + fprintf(stderr, "xbps-rindex: cannot open/lock repository " + "%s: %s\n", repodir, strerror(errno)); + rv = -1; + goto out; + } if (repo && repo->idx) { xbps_repo_open_idxfiles(repo); idx = xbps_dictionary_copy(repo->idx); diff --git a/bin/xbps-rindex/repoflush.c b/bin/xbps-rindex/repoflush.c index f75c483f..f47961ee 100644 --- a/bin/xbps-rindex/repoflush.c +++ b/bin/xbps-rindex/repoflush.c @@ -45,7 +45,6 @@ repodata_flush(struct xbps_handle *xhp, const char *repodir, struct archive *ar; char *repofile, *tname, *buf; int rv, repofd = -1; - mode_t myumask; /* Create a tempfile for our repository archive */ repofile = xbps_repo_path(xhp, repodir); @@ -95,9 +94,7 @@ repodata_flush(struct xbps_handle *xhp, const char *repodir, /* Write data to tempfile and rename */ archive_write_finish(ar); fdatasync(repofd); - myumask = umask(0); - (void)umask(myumask); - assert(fchmod(repofd, 0666 & ~myumask) != -1); + assert(fchmod(repofd, 0664) != -1); close(repofd); rename(tname, repofile); free(repofile);