When a directory is specified a source to the cp command with a slash
at the end of the name, it has been treated as the list of files in the
directory. This is very annoying when using command completion in bash.
This causes such a directory name to be treated the same as one without
the slash.
Don't treat directories differently in cp when the directory name is specified
with a slash at the end.
diff -ru toybox-0.8.2/toys/posix/cp.c toybox-mod/toys/posix/cp.c
--- toybox-0.8.2/toys/posix/cp.c 2019-10-18 13:29:51.000000000 -0400
+++ toybox-mod/toys/posix/cp.c 2019-10-27 20:38:35.000000000 -0400
@@ -404,10 +404,8 @@
char *src = toys.optargs[i], *trail = src;
int rc = 1;
- if (CFG_MV && toys.which->name[0] == 'm') {
- while (*++trail);
- if (*--trail == '/') *trail = 0;
- }
+ while (*++trail);
+ if (*--trail == '/') *trail = 0;
if (destdir) {
char *s = FLAG(D) ? getdirname(src) : getbasename(src);
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net