Remove FEATURE_VERBOSE_CP_MESSAGE, which is kind of useless. The help entry
about it is wrong (it doesn't change "cannot create" to "cannot remove", it's
create in both cases), the option costs 60 bytes (which even if it was
a space _savings_ would barely be worth the complexity of a config option).
And worst of all, the system messages aren't actually that bad. Neither
"Cannot stat /dir/file: not a directory" nor "cannot create /dir/file: no
such file or directory" are especially confusing.
--- git/coreutils/libcoreutils/cp_mv_stat.c 2009-05-18 19:07:25.000000000
-0500
+++ patch/coreutils/libcoreutils/cp_mv_stat.c 2009-06-03 00:01:36.000000000
-0500
@@ -26,17 +26,9 @@
int FAST_FUNC cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf)
{
if (sf(fn, fn_stat) < 0) {
- if (errno != ENOENT) {
-#if ENABLE_FEATURE_VERBOSE_CP_MESSAGE
- if (errno == ENOTDIR) {
- bb_error_msg("cannot stat '%s': Path has
non-directory component", fn);
- return -1;
- }
-#endif
- bb_perror_msg("cannot stat '%s'", fn);
- return -1;
- }
- return 0;
+ if (errno == ENOENT) return 0;
+ bb_perror_msg("cannot stat '%s'", fn);
+ return -1;
}
if (S_ISDIR(fn_stat->st_mode)) {
return 3;
--- git/libbb/Config.in 2009-05-18 19:07:25.000000000 -0500
+++ patch/libbb/Config.in 2009-06-03 00:12:20.000000000 -0500
@@ -114,21 +114,6 @@
correctly, or want to save on code size (about 300 bytes),
then do not turn this option on.
-config FEATURE_VERBOSE_CP_MESSAGE
- bool "Give more precise messages when copy fails (cp, mv etc)"
- default n
- help
- Error messages with this feature enabled:
- $ cp file /does_not_exist/file
- cp: cannot create '/does_not_exist/file': Path does not exist
- $ cp file /vmlinuz/file
- cp: cannot stat '/vmlinuz/file': Path has non-directory component
- If this feature is not enabled, they will be, respectively:
- cp: cannot remove '/does_not_exist/file': No such file or directory
- cp: cannot stat '/vmlinuz/file': Not a directory
- respectively.
- This will cost you ~60 bytes.
-
config FEATURE_COPYBUF_KB
int "Copy buffer size, in kilobytes"
range 1 1024
--- git/libbb/copy_file.c 2009-05-18 19:07:25.000000000 -0500
+++ patch/libbb/copy_file.c 2009-06-03 00:11:54.000000000 -0500
@@ -51,14 +51,6 @@
return 0; // not allowed to overwrite
}
if (unlink(dest) < 0) {
-#if ENABLE_FEATURE_VERBOSE_CP_MESSAGE
- if (e == errno && e == ENOENT) {
- /* e == ENOTDIR is similar: path has non-dir component,
- * but in this case we don't even reach copy_file() */
- bb_error_msg("cannot create '%s': Path does not exist",
dest);
- return -1; // error
- }
-#endif
errno = e;
bb_perror_msg("cannot create '%s'", dest);
return -1; // error
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox