Fixed issue 22: always set perms from binpkg to existing files while unpacking.
This commit is contained in:
parent
af9bd15af7
commit
06745b70ae
6
NEWS
6
NEWS
@ -1,3 +1,9 @@
|
|||||||
|
xbps-0.15 (???):
|
||||||
|
|
||||||
|
* Fixed issue 22: "Updating a package doesn't set correct perms when
|
||||||
|
file not modified". When extracting package files, always set
|
||||||
|
permissions from binary package, even if file has not been modified.
|
||||||
|
|
||||||
xbps-0.14 (2012-02-28):
|
xbps-0.14 (2012-02-28):
|
||||||
|
|
||||||
* Fixed 'xbps-bin reconfigure all' (regression added in 0.13).
|
* Fixed 'xbps-bin reconfigure all' (regression added in 0.13).
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
*/
|
*/
|
||||||
#define XBPS_PKGINDEX_VERSION "1.4"
|
#define XBPS_PKGINDEX_VERSION "1.4"
|
||||||
|
|
||||||
#define XBPS_API_VERSION "20120228"
|
#define XBPS_API_VERSION "20120307"
|
||||||
#define XBPS_VERSION "0.14"
|
#define XBPS_VERSION "0.15"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def XBPS_RELVER
|
* @def XBPS_RELVER
|
||||||
|
@ -158,6 +158,7 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
|
|||||||
prop_array_t array;
|
prop_array_t array;
|
||||||
const struct xbps_handle *xhp = xbps_handle_get();
|
const struct xbps_handle *xhp = xbps_handle_get();
|
||||||
const struct stat *entry_statp;
|
const struct stat *entry_statp;
|
||||||
|
struct stat st;
|
||||||
struct xbps_unpack_cb_data *xucd = NULL;
|
struct xbps_unpack_cb_data *xucd = NULL;
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
size_t nmetadata = 0, entry_idx = 0;
|
size_t nmetadata = 0, entry_idx = 0;
|
||||||
@ -383,20 +384,44 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
|
|||||||
if (S_ISREG(entry_statp->st_mode)) {
|
if (S_ISREG(entry_statp->st_mode)) {
|
||||||
if (xbps_entry_is_a_conf_file(propsd, entry_pname))
|
if (xbps_entry_is_a_conf_file(propsd, entry_pname))
|
||||||
conf_file = true;
|
conf_file = true;
|
||||||
if (access(entry_pname, R_OK) == 0) {
|
if (stat(entry_pname, &st) == 0) {
|
||||||
file_exists = true;
|
file_exists = true;
|
||||||
rv = xbps_file_hash_check_dictionary(filesd,
|
rv = xbps_file_hash_check_dictionary(filesd,
|
||||||
conf_file ? "conf_files" : "files",
|
conf_file ? "conf_files" : "files",
|
||||||
entry_pname);
|
entry_pname);
|
||||||
if (rv == -1) {
|
if (rv == -1) {
|
||||||
|
/* error */
|
||||||
xbps_dbg_printf("%s-%s: failed to check"
|
xbps_dbg_printf("%s-%s: failed to check"
|
||||||
" hash for `%s': %s\n", pkgname,
|
" hash for `%s': %s\n", pkgname,
|
||||||
version, entry_pname,
|
version, entry_pname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
/* error */
|
|
||||||
goto out;
|
goto out;
|
||||||
|
} else if (rv == 1) {
|
||||||
|
/* hash doesn't match, extract file */
|
||||||
|
rv = 0;
|
||||||
} else if (rv == 0) {
|
} else if (rv == 0) {
|
||||||
/* hash match, skip */
|
/*
|
||||||
|
* Always set entry perms in existing
|
||||||
|
* file, even when hash is matched.
|
||||||
|
*/
|
||||||
|
if (chmod(entry_pname,
|
||||||
|
entry_statp->st_mode) != 0) {
|
||||||
|
xbps_dbg_printf("%s-%s: failed "
|
||||||
|
"to set perms %s to %s: %s\n",
|
||||||
|
pkgname, version,
|
||||||
|
archive_entry_strmode(entry),
|
||||||
|
entry_pname,
|
||||||
|
strerror(errno));
|
||||||
|
rv = EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
xbps_dbg_printf("%s-%s: entry %s perms "
|
||||||
|
"to %s.\n", pkgname, version,
|
||||||
|
entry_pname,
|
||||||
|
archive_entry_strmode(entry));
|
||||||
|
/*
|
||||||
|
* hash match, skip extraction.
|
||||||
|
*/
|
||||||
xbps_dbg_printf("%s-%s: entry %s "
|
xbps_dbg_printf("%s-%s: entry %s "
|
||||||
"matches current SHA256, "
|
"matches current SHA256, "
|
||||||
"skipping...\n", pkgname,
|
"skipping...\n", pkgname,
|
||||||
@ -404,7 +429,6 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
|
|||||||
archive_read_data_skip(ar);
|
archive_read_data_skip(ar);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rv = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!update && conf_file && file_exists) {
|
if (!update && conf_file && file_exists) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user