walter harms wrote:
> hi andy,
> i took a quick look at the patch and noticed:
>
> bb_perror_msg_and_die("cannot remove old file");
>
> any reason NOT to tell the user what file like in the second part ?
>
> bb_perror_msg_and_die("cannot remove old file %s",
> file_header->name);
>
Thanks for the feedback, here we go.
-Andy
Make CPIO unpack errors warning-only
Because if you don't you end up with a randomly half-installed rpm
package because, eg, a directory already existed.
Signed-off-by: Andy Green <[EMAIL PROTECTED]>
---
archival/Config.in | 9 +++++++++
archival/libunarchive/data_extract_all.c | 17 ++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
Index: busybox-1.6.0.18773/archival/Config.in
===================================================================
--- busybox-1.6.0.18773.orig/archival/Config.in
+++ busybox-1.6.0.18773/archival/Config.in
@@ -68,6 +68,14 @@ config CPIO
Unless you have a specific application which requires cpio, you should
probably say N here.
+config CPIO_NONFATAL_UNPACK_ERRORS
+ bool "cpio library unpack errors nonfatal"
+ default y if RPM
+ help
+ continue to unpack a cpio archive if a particular unpacked file has
+ errors, rather than abort with a random amount of the archive
+ unpacked.
+
config DPKG
bool "dpkg"
default n
@@ -129,6 +137,7 @@ config RPM2CPIO
config RPM
bool "rpm"
+ select CPIO_NONFATAL_UNPACK_ERRORS
default n
help
Mini RPM applet - queries and extracts RPM packages.
Index: busybox-1.6.0.18773/archival/libunarchive/data_extract_all.c
===================================================================
--- busybox-1.6.0.18773.orig/archival/libunarchive/data_extract_all.c
+++ busybox-1.6.0.18773/archival/libunarchive/data_extract_all.c
@@ -25,7 +25,15 @@ void data_extract_all(archive_handle_t *
&& (unlink(file_header->name) == -1)
&& (errno != ENOENT)
) {
- bb_perror_msg_and_die("cannot remove old file");
+#ifndef CONFIG_CPIO_NONFATAL_UNPACK_ERRORS
+ bb_perror_msg_and_die("Couldnt remove old file %s",
+ file_header->name);
+#else
+ bb_perror_msg("Couldnt remove old file %s",
+ file_header->name);
+ data_skip(archive_handle);
+ return;
+#endif
}
}
else if (archive_handle->flags & ARCHIVE_EXTRACT_NEWER) {
@@ -45,8 +53,15 @@ void data_extract_all(archive_handle_t *
return;
}
else if ((unlink(file_header->name) == -1) && (errno !=
EISDIR)) {
+#ifndef CONFIG_CPIO_NONFATAL_UNPACK_ERRORS
bb_perror_msg_and_die("cannot remove old file %s",
file_header->name);
+#else
+ bb_perror_msg("Couldnt remove old file %s",
+ file_header->name);
+ data_skip(archive_handle);
+ return;
+#endif
}
}
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox