From f033f8607f156464747abe57487c1f6226f94001 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 31 May 2015 05:11:28 -0500 Subject: [PATCH] Move the magic list of commands needing cleanup from toys/pending/README to greppable TODO annotations in the individual files. (grep -riw TODO) --- lib/password.c | 2 ++ lib/pending.h | 2 ++ toys/other/chroot.c | 5 +++++ toys/other/login.c | 3 +++ toys/other/modinfo.c | 2 ++ toys/other/vconfig.c | 2 ++ toys/other/vmstat.c | 3 +++ toys/pending/README | 10 ++-------- toys/posix/cut.c | 4 +++- toys/posix/du.c | 2 ++ toys/posix/touch.c | 4 +++- toys/posix/xargs.c | 2 ++ 12 files changed, 31 insertions(+), 10 deletions(-) diff --git a/lib/password.c b/lib/password.c index 9654d42..bf13c44 100644 --- a/lib/password.c +++ b/lib/password.c @@ -1,6 +1,8 @@ /* password.c - password read/update helper functions. * * Copyright 2012 Ashwini Kumar + * + * TODO: cleanup */ #include "toys.h" diff --git a/lib/pending.h b/lib/pending.h index c67d81c..ffbd025 100644 --- a/lib/pending.h +++ b/lib/pending.h @@ -4,3 +4,5 @@ #define MAX_SALT_LEN 20 //3 for id, 16 for key, 1 for '\0' int read_password(char * buff, int buflen, char* mesg); int update_password(char *filename, char* username, char* encrypted); + +// TODO this goes away when lib/password.c cleaned up diff --git a/toys/other/chroot.c b/toys/other/chroot.c index e82dd80..4260d98 100644 --- a/toys/other/chroot.c +++ b/toys/other/chroot.c @@ -1,6 +1,11 @@ /* chroot.c - Run command in new root directory. * * Copyright 2007 Rob Landley + * + * TODO: The test for root is "==" so root can trivially escape a chroot by + * moving it below cwd, ala mkdir("sub"); chroot("sub"); chdir("../../../..") + * The container guys use pivot_root() to deal with this, which does actually + * edit mount tree. (New option? Kernel patch?) USE_CHROOT(NEWTOY(chroot, "^<1", TOYFLAG_USR|TOYFLAG_SBIN)) diff --git a/toys/other/login.c b/toys/other/login.c index 837dd97..b728286 100644 --- a/toys/other/login.c +++ b/toys/other/login.c @@ -4,6 +4,9 @@ * * No support for PAM/securetty/selinux/login script/issue/utmp * Relies on libcrypt for hash calculation. + * + * TODO: this command predates "pending" but needs cleanup. It #defines + * random stuff, calls exit() form a signal handler... yeah. USE_LOGIN(NEWTOY(login, ">1fph:", TOYFLAG_BIN)) diff --git a/toys/other/modinfo.c b/toys/other/modinfo.c index a7e6b4b..3a7e821 100644 --- a/toys/other/modinfo.c +++ b/toys/other/modinfo.c @@ -1,6 +1,8 @@ /* modinfo.c - Display module info * * Copyright 2012 Andre Renaud + * + * TODO: cleanup USE_MODINFO(NEWTOY(modinfo, "<1b:k:F:0", TOYFLAG_BIN)) diff --git a/toys/other/vconfig.c b/toys/other/vconfig.c index eff918c..fd78527 100644 --- a/toys/other/vconfig.c +++ b/toys/other/vconfig.c @@ -4,6 +4,8 @@ * Copyright 2012 Kyungwan Han * * No standard + * + * TODO: cleanup USE_VCONFIG(NEWTOY(vconfig, "<2>4", TOYFLAG_NEEDROOT|TOYFLAG_SBIN)) diff --git a/toys/other/vmstat.c b/toys/other/vmstat.c index eed7945..c11e46b 100644 --- a/toys/other/vmstat.c +++ b/toys/other/vmstat.c @@ -1,6 +1,9 @@ /* vmstat.c - Report virtual memory statistics. * * Copyright 2012 Elie De Brauwer + * + * TODO: I have no idea how the "io" and "system" categories are calculated. + * whatever we're doing isn't matching what other implementations are doing. USE_VMSTAT(NEWTOY(vmstat, ">2n", TOYFLAG_BIN)) diff --git a/toys/pending/README b/toys/pending/README index 0257e2b..2eb83e1 100644 --- a/toys/pending/README +++ b/toys/pending/README @@ -7,14 +7,8 @@ Code in this directory may or may not work, some of the commands here are unfinished stubs, others just need a more thorough inspection than we've had time for yet. Everything in here defaults to "n" in defconfig. -Library code awaiting cleanup lives in lib/pending.c - -The following commands predate the pending directory, and are awaiting -cleanup but don't live here: - - vmstat, login, du, vconfig, chroot, cut, touch, modinfo, xargs - - lib/password.c +Outside of this directory, several commands (and some library code) have +TODO annotations. This directory should go away before the 1.0 release. It's just a staging area so code submissions don't get lost while awaiting more thorough (and diff --git a/toys/posix/cut.c b/toys/posix/cut.c index ca014ae..bb2b22d 100644 --- a/toys/posix/cut.c +++ b/toys/posix/cut.c @@ -3,7 +3,9 @@ * Copyright 2012 Ranjan Kumar * Copyright 2012 Kyungwan Han * - * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html + * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html + * + * TODO: cleanup USE_CUT(NEWTOY(cut, "b:|c:|f:|d:sn[!cbf]", TOYFLAG_USR|TOYFLAG_BIN)) diff --git a/toys/posix/du.c b/toys/posix/du.c index c72019e..4302997 100644 --- a/toys/posix/du.c +++ b/toys/posix/du.c @@ -3,6 +3,8 @@ * Copyright 2012 Ashwini Kumar * * See http://opengroup.org/onlinepubs/9699919799/utilities/du.html + * + * TODO: cleanup USE_DU(NEWTOY(du, "d#<0hmlcaHkKLsx[-HL][-kKmh]", TOYFLAG_USR|TOYFLAG_BIN)) diff --git a/toys/posix/touch.c b/toys/posix/touch.c index bf96b79..c5ebbab 100644 --- a/toys/posix/touch.c +++ b/toys/posix/touch.c @@ -2,7 +2,9 @@ * * Copyright 2012 Choubey Ji * - * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html + * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html + * + * TODO: have another go at merging the -t and -d stanzas USE_TOUCH(NEWTOY(touch, "acd:mr:t:h[!dtr]", TOYFLAG_BIN)) diff --git a/toys/posix/xargs.c b/toys/posix/xargs.c index cde71f6..8178bf0 100644 --- a/toys/posix/xargs.c +++ b/toys/posix/xargs.c @@ -3,6 +3,8 @@ * Copyright 2011 Rob Landley * * See http://opengroup.org/onlinepubs/9699919799/utilities/xargs.html + * + * TODO: Rich's whitespace objection, env size isn't fixed anymore. USE_XARGS(NEWTOY(xargs, "^I:E:L#ptxrn#<1s#0", TOYFLAG_USR|TOYFLAG_BIN)) -- 2.7.4