mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Fixed a bunch of stuff:
* Fixed segfault caused by "touch -c" * Fixed segfault caused by "rm -f" * Fixed segfault caused by "ln -s -s" and similar abuses. * Fixed segfault caused by "cp -a -a" and similar abuses. * Implemented "rm -- <foo>" updated docs accordingly. -Erik
This commit is contained in:
parent
c389d91181
commit
815e904470
@ -50,6 +50,11 @@
|
|||||||
* Fixed all fatalError() calls lacking a "\n", thanks to Pavel Roskin.
|
* Fixed all fatalError() calls lacking a "\n", thanks to Pavel Roskin.
|
||||||
* Fixed a segfault in yes when no args were given -- Pavel Roskin.
|
* Fixed a segfault in yes when no args were given -- Pavel Roskin.
|
||||||
* Simplified freeramdisk and added argument checking -- Pavel Roskin.
|
* Simplified freeramdisk and added argument checking -- Pavel Roskin.
|
||||||
|
* Fixed segfault caused by "touch -c"
|
||||||
|
* Fixed segfault caused by "rm -f"
|
||||||
|
* Fixed segfault caused by "ln -s -s" and similar abuses.
|
||||||
|
* Fixed segfault caused by "cp -a -a" and similar abuses.
|
||||||
|
* Implemented "rm -- <foo>"
|
||||||
* "which" rewritten to use stat(). Fixes to improve its compatability
|
* "which" rewritten to use stat(). Fixes to improve its compatability
|
||||||
with traditional implementations -- Pavel Roskin.
|
with traditional implementations -- Pavel Roskin.
|
||||||
* More doc updates
|
* More doc updates
|
||||||
|
2
Makefile
2
Makefile
@ -26,7 +26,7 @@ export VERSION
|
|||||||
# Set the following to `true' to make a debuggable build.
|
# Set the following to `true' to make a debuggable build.
|
||||||
# Leave this set to `false' for production use.
|
# Leave this set to `false' for production use.
|
||||||
# eg: `make DODEBUG=true tests'
|
# eg: `make DODEBUG=true tests'
|
||||||
DODEBUG = false
|
DODEBUG = true
|
||||||
|
|
||||||
# If you want a static binary, turn this on.
|
# If you want a static binary, turn this on.
|
||||||
DOSTATIC = false
|
DOSTATIC = false
|
||||||
|
6
TODO
6
TODO
@ -26,12 +26,6 @@ Bugs that need fixing before the 0.44 release goes out the door:
|
|||||||
chmod -R
|
chmod -R
|
||||||
chown -R
|
chown -R
|
||||||
chgrp -R
|
chgrp -R
|
||||||
cp -a -a
|
|
||||||
ln -s -s
|
|
||||||
rm -f
|
|
||||||
rm -f -
|
|
||||||
rm -- -
|
|
||||||
touch -c
|
|
||||||
- I believe that swaponoff may also be also broken (check it).
|
- I believe that swaponoff may also be also broken (check it).
|
||||||
- It used to be that BusyBox tar would happily overwrite existing files on
|
- It used to be that BusyBox tar would happily overwrite existing files on
|
||||||
an extraction. However, as of 0.42, BusyBox tar simply dies as soon as an
|
an extraction. However, as of 0.42, BusyBox tar simply dies as soon as an
|
||||||
|
@ -59,25 +59,30 @@ extern int ln_main(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (**argv == '-') {
|
while (--argc >= 0 && *argv && **argv) {
|
||||||
while (*++(*argv))
|
while (**argv == '-') {
|
||||||
switch (**argv) {
|
while (*++(*argv))
|
||||||
case 's':
|
switch (**argv) {
|
||||||
symlinkFlag = TRUE;
|
case 's':
|
||||||
break;
|
symlinkFlag = TRUE;
|
||||||
case 'f':
|
break;
|
||||||
removeoldFlag = TRUE;
|
case 'f':
|
||||||
break;
|
removeoldFlag = TRUE;
|
||||||
case 'n':
|
break;
|
||||||
followLinks = FALSE;
|
case 'n':
|
||||||
break;
|
followLinks = FALSE;
|
||||||
default:
|
break;
|
||||||
usage(ln_usage);
|
default:
|
||||||
}
|
usage(ln_usage);
|
||||||
argc--;
|
}
|
||||||
|
}
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc < 1) {
|
||||||
|
fatalError("ln: missing file argument\n");
|
||||||
|
}
|
||||||
|
|
||||||
linkName = argv[argc - 1];
|
linkName = argv[argc - 1];
|
||||||
|
|
||||||
if (strlen(linkName) > BUFSIZ) {
|
if (strlen(linkName) > BUFSIZ) {
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
static const char *rm_usage = "rm [OPTION]... FILE...\n"
|
static const char *rm_usage = "rm [OPTION]... FILE...\n"
|
||||||
#ifndef BB_FEATURE_TRIVIAL_HELP
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
"\nRemove (unlink) the FILE(s).\n\n"
|
"\nRemove (unlink) the FILE(s). You may use '--' to\n"
|
||||||
|
"indicate that all following arguments are non-options.\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-f\t\tremove existing destinations, never prompt\n"
|
"\t-f\t\tremove existing destinations, never prompt\n"
|
||||||
"\t-r or -R\tremove the contents of directories recursively\n"
|
"\t-r or -R\tremove the contents of directories recursively\n"
|
||||||
@ -64,29 +65,33 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
|
|||||||
|
|
||||||
extern int rm_main(int argc, char **argv)
|
extern int rm_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int stopIt=FALSE;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
usage(rm_usage);
|
usage(rm_usage);
|
||||||
}
|
}
|
||||||
argc--;
|
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (**argv == '-') {
|
while (--argc >= 0 && *argv && **argv && stopIt==FALSE) {
|
||||||
while (*++(*argv))
|
while (**argv == '-') {
|
||||||
switch (**argv) {
|
while (*++(*argv))
|
||||||
case 'R':
|
switch (**argv) {
|
||||||
case 'r':
|
case 'R':
|
||||||
recursiveFlag = TRUE;
|
case 'r':
|
||||||
break;
|
recursiveFlag = TRUE;
|
||||||
case 'f':
|
break;
|
||||||
forceFlag = TRUE;
|
case 'f':
|
||||||
break;
|
forceFlag = TRUE;
|
||||||
default:
|
break;
|
||||||
usage(rm_usage);
|
case '-':
|
||||||
}
|
stopIt = TRUE;
|
||||||
argc--;
|
break;
|
||||||
|
default:
|
||||||
|
usage(rm_usage);
|
||||||
|
}
|
||||||
|
}
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
51
cp_mv.c
51
cp_mv.c
@ -203,37 +203,42 @@ extern int cp_mv_main(int argc, char **argv)
|
|||||||
if (dz_i == is_cp) {
|
if (dz_i == is_cp) {
|
||||||
recursiveFlag = preserveFlag = forceFlag = FALSE;
|
recursiveFlag = preserveFlag = forceFlag = FALSE;
|
||||||
followLinks = TRUE;
|
followLinks = TRUE;
|
||||||
while (**argv == '-') {
|
while (--argc >= 0 && *argv && **argv) {
|
||||||
while (*++(*argv)) {
|
while (**argv == '-') {
|
||||||
switch (**argv) {
|
while (*++(*argv)) {
|
||||||
case 'a':
|
switch (**argv) {
|
||||||
followLinks = FALSE;
|
case 'a':
|
||||||
preserveFlag = TRUE;
|
followLinks = FALSE;
|
||||||
recursiveFlag = TRUE;
|
preserveFlag = TRUE;
|
||||||
break;
|
recursiveFlag = TRUE;
|
||||||
case 'd':
|
break;
|
||||||
followLinks = FALSE;
|
case 'd':
|
||||||
break;
|
followLinks = FALSE;
|
||||||
case 'p':
|
break;
|
||||||
preserveFlag = TRUE;
|
case 'p':
|
||||||
break;
|
preserveFlag = TRUE;
|
||||||
case 'R':
|
break;
|
||||||
recursiveFlag = TRUE;
|
case 'R':
|
||||||
break;
|
recursiveFlag = TRUE;
|
||||||
case 'f':
|
break;
|
||||||
forceFlag = TRUE;
|
case 'f':
|
||||||
break;
|
forceFlag = TRUE;
|
||||||
default:
|
break;
|
||||||
usage(cp_mv_usage[is_cp]);
|
default:
|
||||||
|
usage(cp_mv_usage[is_cp]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argc--;
|
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
if (argc < 1) {
|
||||||
|
fatalError("cp: missing file argument\n");
|
||||||
|
}
|
||||||
} else { /* (dz_i == is_mv) */
|
} else { /* (dz_i == is_mv) */
|
||||||
recursiveFlag = preserveFlag = TRUE;
|
recursiveFlag = preserveFlag = TRUE;
|
||||||
followLinks = FALSE;
|
followLinks = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (strlen(argv[argc - 1]) > BUFSIZ) {
|
if (strlen(argv[argc - 1]) > BUFSIZ) {
|
||||||
fprintf(stderr, name_too_long, "cp");
|
fprintf(stderr, name_too_long, "cp");
|
||||||
|
@ -1327,7 +1327,8 @@ Instructs the kernel to reboot the system.
|
|||||||
|
|
||||||
Usage: rm [OPTION]... FILE...
|
Usage: rm [OPTION]... FILE...
|
||||||
|
|
||||||
Remove (unlink) the FILE(s).
|
Remove (unlink) the FILE(s). You may use '--' to
|
||||||
|
indicate that all following arguments are non-options.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
@ -1946,4 +1947,4 @@ Enrique Zanardi <ezanardi@ull.es>
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
# $Id: busybox.pod,v 1.34 2000/06/05 17:23:06 andersen Exp $
|
# $Id: busybox.pod,v 1.35 2000/06/06 16:15:23 andersen Exp $
|
||||||
|
37
ln.c
37
ln.c
@ -59,25 +59,30 @@ extern int ln_main(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (**argv == '-') {
|
while (--argc >= 0 && *argv && **argv) {
|
||||||
while (*++(*argv))
|
while (**argv == '-') {
|
||||||
switch (**argv) {
|
while (*++(*argv))
|
||||||
case 's':
|
switch (**argv) {
|
||||||
symlinkFlag = TRUE;
|
case 's':
|
||||||
break;
|
symlinkFlag = TRUE;
|
||||||
case 'f':
|
break;
|
||||||
removeoldFlag = TRUE;
|
case 'f':
|
||||||
break;
|
removeoldFlag = TRUE;
|
||||||
case 'n':
|
break;
|
||||||
followLinks = FALSE;
|
case 'n':
|
||||||
break;
|
followLinks = FALSE;
|
||||||
default:
|
break;
|
||||||
usage(ln_usage);
|
default:
|
||||||
}
|
usage(ln_usage);
|
||||||
argc--;
|
}
|
||||||
|
}
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc < 1) {
|
||||||
|
fatalError("ln: missing file argument\n");
|
||||||
|
}
|
||||||
|
|
||||||
linkName = argv[argc - 1];
|
linkName = argv[argc - 1];
|
||||||
|
|
||||||
if (strlen(linkName) > BUFSIZ) {
|
if (strlen(linkName) > BUFSIZ) {
|
||||||
|
@ -188,7 +188,7 @@ static volatile void show_usage()
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t-n [14|30]\tSpecify the maximum length of filenames\n");
|
"\t-n [14|30]\tSpecify the maximum length of filenames\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t-i\t\tSpecify the number of inodes for the filesystem\n");
|
"\t-i INODES\tSpecify the number of inodes for the filesystem\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t-l FILENAME\tRead the bad blocks list from FILENAME\n");
|
"\t-l FILENAME\tRead the bad blocks list from FILENAME\n");
|
||||||
fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n");
|
fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n");
|
||||||
|
37
rm.c
37
rm.c
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
static const char *rm_usage = "rm [OPTION]... FILE...\n"
|
static const char *rm_usage = "rm [OPTION]... FILE...\n"
|
||||||
#ifndef BB_FEATURE_TRIVIAL_HELP
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
"\nRemove (unlink) the FILE(s).\n\n"
|
"\nRemove (unlink) the FILE(s). You may use '--' to\n"
|
||||||
|
"indicate that all following arguments are non-options.\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-f\t\tremove existing destinations, never prompt\n"
|
"\t-f\t\tremove existing destinations, never prompt\n"
|
||||||
"\t-r or -R\tremove the contents of directories recursively\n"
|
"\t-r or -R\tremove the contents of directories recursively\n"
|
||||||
@ -64,29 +65,33 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
|
|||||||
|
|
||||||
extern int rm_main(int argc, char **argv)
|
extern int rm_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
int stopIt=FALSE;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
usage(rm_usage);
|
usage(rm_usage);
|
||||||
}
|
}
|
||||||
argc--;
|
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (**argv == '-') {
|
while (--argc >= 0 && *argv && **argv && stopIt==FALSE) {
|
||||||
while (*++(*argv))
|
while (**argv == '-') {
|
||||||
switch (**argv) {
|
while (*++(*argv))
|
||||||
case 'R':
|
switch (**argv) {
|
||||||
case 'r':
|
case 'R':
|
||||||
recursiveFlag = TRUE;
|
case 'r':
|
||||||
break;
|
recursiveFlag = TRUE;
|
||||||
case 'f':
|
break;
|
||||||
forceFlag = TRUE;
|
case 'f':
|
||||||
break;
|
forceFlag = TRUE;
|
||||||
default:
|
break;
|
||||||
usage(rm_usage);
|
case '-':
|
||||||
}
|
stopIt = TRUE;
|
||||||
argc--;
|
break;
|
||||||
|
default:
|
||||||
|
usage(rm_usage);
|
||||||
|
}
|
||||||
|
}
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ static volatile void show_usage()
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t-n [14|30]\tSpecify the maximum length of filenames\n");
|
"\t-n [14|30]\tSpecify the maximum length of filenames\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t-i\t\tSpecify the number of inodes for the filesystem\n");
|
"\t-i INODES\tSpecify the number of inodes for the filesystem\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\t-l FILENAME\tRead the bad blocks list from FILENAME\n");
|
"\t-l FILENAME\tRead the bad blocks list from FILENAME\n");
|
||||||
fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n");
|
fprintf(stderr, "\t-v\t\tMake a Minix version 2 filesystem\n\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user