apk: remove the unneeded --never-overwrite
turns out the logic does not work with overlays as expected due to busybox symlinks being unmanaged. remove the useless option.cute-signatures
parent
f44f34811d
commit
6417de4d10
|
@ -57,7 +57,6 @@ static struct apk_option generic_options[] = {
|
||||||
{ 0x108, "repositories-file", "Override repositories file",
|
{ 0x108, "repositories-file", "Override repositories file",
|
||||||
required_argument, "REPOFILE" },
|
required_argument, "REPOFILE" },
|
||||||
{ 0x109, "no-network", "Do not use network (cache is still used)" },
|
{ 0x109, "no-network", "Do not use network (cache is still used)" },
|
||||||
{ 0x110, "never-overwrite", "Never overwrite existing files" },
|
|
||||||
{ 0x111, "overlay-from-stdin", "Read list of overlay files from stdin" },
|
{ 0x111, "overlay-from-stdin", "Read list of overlay files from stdin" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -386,9 +385,6 @@ int main(int argc, char **argv)
|
||||||
case 0x109:
|
case 0x109:
|
||||||
apk_flags |= APK_NO_NETWORK;
|
apk_flags |= APK_NO_NETWORK;
|
||||||
break;
|
break;
|
||||||
case 0x110:
|
|
||||||
apk_flags |= APK_NEVER_OVERWRITE;
|
|
||||||
break;
|
|
||||||
case 0x111:
|
case 0x111:
|
||||||
apk_flags |= APK_OVERLAY_FROM_STDIN;
|
apk_flags |= APK_OVERLAY_FROM_STDIN;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -64,8 +64,7 @@ extern unsigned int apk_flags;
|
||||||
#define APK_INTERACTIVE 0x0400
|
#define APK_INTERACTIVE 0x0400
|
||||||
#define APK_RECURSIVE_DELETE 0x0800
|
#define APK_RECURSIVE_DELETE 0x0800
|
||||||
#define APK_NO_NETWORK 0x1000
|
#define APK_NO_NETWORK 0x1000
|
||||||
#define APK_NEVER_OVERWRITE 0x2000
|
#define APK_OVERLAY_FROM_STDIN 0x2000
|
||||||
#define APK_OVERLAY_FROM_STDIN 0x4000
|
|
||||||
|
|
||||||
#define apk_error(args...) do { apk_log("ERROR: ", args); } while (0)
|
#define apk_error(args...) do { apk_log("ERROR: ", args); } while (0)
|
||||||
#define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log("WARNING: ", args); } } while (0)
|
#define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log("WARNING: ", args); } } while (0)
|
||||||
|
|
|
@ -343,18 +343,7 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
|
||||||
if ((!S_ISDIR(ae->mode) && !S_ISREG(ae->mode)) ||
|
if ((!S_ISDIR(ae->mode) && !S_ISREG(ae->mode)) ||
|
||||||
(ae->link_target != NULL)) {
|
(ae->link_target != NULL)) {
|
||||||
/* non-standard entries need to be deleted first */
|
/* non-standard entries need to be deleted first */
|
||||||
if (apk_flags & APK_NEVER_OVERWRITE) {
|
|
||||||
if (faccessat(atfd, ae->name, F_OK,
|
|
||||||
AT_SYMLINK_NOFOLLOW) == 0) {
|
|
||||||
/* destination exists, but we are not supposed
|
|
||||||
* to overwrite, just clean the temp file */
|
|
||||||
if (suffix != NULL)
|
|
||||||
unlinkat(atfd, fn, 0);
|
unlinkat(atfd, fn, 0);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unlinkat(atfd, fn, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ae->mode & S_IFMT) {
|
switch (ae->mode & S_IFMT) {
|
||||||
|
@ -367,14 +356,8 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
|
||||||
if (ae->link_target == NULL) {
|
if (ae->link_target == NULL) {
|
||||||
int flags = O_RDWR | O_CREAT | O_TRUNC;
|
int flags = O_RDWR | O_CREAT | O_TRUNC;
|
||||||
|
|
||||||
if (apk_flags & APK_NEVER_OVERWRITE)
|
|
||||||
flags |= O_EXCL;
|
|
||||||
|
|
||||||
fd = openat(atfd, fn, flags, ae->mode & 07777);
|
fd = openat(atfd, fn, flags, ae->mode & 07777);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if ((apk_flags & APK_NEVER_OVERWRITE) &&
|
|
||||||
(errno == EEXIST))
|
|
||||||
return 0;
|
|
||||||
r = -1;
|
r = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1942,11 +1942,9 @@ static void apk_db_migrate_files(struct apk_database *db,
|
||||||
apk_checksum_compare(&file->csum, &fi.csum) == 0))
|
apk_checksum_compare(&file->csum, &fi.csum) == 0))
|
||||||
unlinkat(db->root_fd, tmpname, 0);
|
unlinkat(db->root_fd, tmpname, 0);
|
||||||
} else {
|
} else {
|
||||||
/* check if want keep existing files */
|
if (ofile->name == NULL) {
|
||||||
if ((ofile->name == NULL) ||
|
/* File was from overlay, delete the
|
||||||
((apk_flags & APK_NEVER_OVERWRITE) &&
|
* packages version */
|
||||||
(faccessat(db->root_fd, name, F_OK,
|
|
||||||
AT_SYMLINK_NOFOLLOW) == 0))) {
|
|
||||||
unlinkat(db->root_fd, tmpname, 0);
|
unlinkat(db->root_fd, tmpname, 0);
|
||||||
} else {
|
} else {
|
||||||
/* Overwrite the old file */
|
/* Overwrite the old file */
|
||||||
|
|
Loading…
Reference in New Issue