unpack: apply correctly file permissions to existent files.

Will be backported to the 0.26.x branch.
This commit is contained in:
Juan RP 2013-10-30 12:02:16 +01:00
parent 0247b49f86
commit 747f250202
2 changed files with 26 additions and 21 deletions

5
NEWS
View File

@ -26,6 +26,11 @@ xbps-0.27 (???):
Starting from now on all remote repositories must be signed and verified.
Local repos do not need to be signed and they will work as before.
xbps-0.26.2 (2013-10-30):
* unpack: apply correctly permissions and mode to existent files if the those files
in the archive are modified compared to what it's currently on disk.
xbps-0.26.1 (2013-10-25):
* xbps-uhelper: added new action "real-version" that only prints the version

View File

@ -459,27 +459,6 @@ unpack_archive(struct xbps_handle *xhp,
free(p2);
}
}
/*
* Check if current file mode differs from file mode
* in binpkg and apply perms if true.
*/
if (!force && file_exists && skip_extract &&
(archive_entry_mode(entry) != st.st_mode)) {
if (chmod(entry_pname,
archive_entry_mode(entry)) != 0) {
xbps_dbg_printf(xhp,
"%s: failed "
"to set perms %s to %s: %s\n",
pkgver, archive_entry_strmode(entry),
entry_pname,
strerror(errno));
rv = EINVAL;
goto out;
}
xbps_dbg_printf(xhp, "%s: entry %s changed file "
"mode to %s.\n", pkgver, entry_pname,
archive_entry_strmode(entry));
}
/*
* Check if current uid/gid differs from file in binpkg,
* and change permissions if true.
@ -503,6 +482,27 @@ unpack_archive(struct xbps_handle *xhp,
archive_entry_gid(entry));
}
}
/*
* Check if current file mode differs from file mode
* in binpkg and apply perms if true.
*/
if (!force && file_exists && skip_extract &&
(archive_entry_mode(entry) != st.st_mode)) {
if (chmod(entry_pname,
archive_entry_mode(entry)) != 0) {
xbps_dbg_printf(xhp,
"%s: failed "
"to set perms %s to %s: %s\n",
pkgver, archive_entry_strmode(entry),
entry_pname,
strerror(errno));
rv = EINVAL;
goto out;
}
xbps_dbg_printf(xhp, "%s: entry %s changed file "
"mode to %s.\n", pkgver, entry_pname,
archive_entry_strmode(entry));
}
if (!update && conf_file && file_exists && !skip_extract) {
/*