Glenn L McGrath | 90d2bff | 2004-05-01 00:49:49 +0000 | [diff] [blame] | 1 | Busybox TODO |
| 2 | |
Rob Landley | df4cdaf | 2006-05-19 20:47:55 +0000 | [diff] [blame] | 3 | Stuff that needs to be done. This is organized by who plans to get around to |
| 4 | doing it eventually, but that doesn't mean they "own" the item. If you want to |
| 5 | do one of these bounce an email off the person it's listed under to see if they |
| 6 | have any suggestions how they plan to go about it, and to minimize conflicts |
| 7 | between your work and theirs. But otherwise, all of these are fair game. |
Glenn L McGrath | 90d2bff | 2004-05-01 00:49:49 +0000 | [diff] [blame] | 8 | |
Rob Landley | df4cdaf | 2006-05-19 20:47:55 +0000 | [diff] [blame] | 9 | Rob Landley <rob@landley.net>: |
| 10 | Migrate calloc() and bb_calloc() occurrences to bb_xzalloc(). |
| 11 | Remove obsolete _() wrapper crud for internationalization we don't do. |
| 12 | Figure out where we need utf8 support, and add it. |
| 13 | |
| 14 | sh |
| 15 | The command shell situation is a big mess. We have three or four different |
| 16 | shells that don't really share any code, and the "standalone shell" doesn't |
| 17 | work all that well (especially not in a chroot environment), due to apps not |
| 18 | being reentrant. I'm writing a new shell (bbsh) to unify the various |
| 19 | shells and configurably add the minimal set of bash features people |
| 20 | actually use. The hardest part is it has to configure down as small as |
| 21 | lash while providing lash's features. The rest is easy in comparison. |
| 22 | bzip2 |
| 23 | Compression-side support. |
| 24 | init |
| 25 | General cleanup. |
| 26 | Unify base64 handling. |
| 27 | There's base64 encoding and decoding going on in: |
| 28 | networking/wget.c:base64enc() |
| 29 | coreutils/uudecode.c:read_base64() |
| 30 | coreutils/uuencode.c:tbl_base64[] |
| 31 | networking/httpd.c:decodeBase64() |
| 32 | And probably elsewhere. That needs to be unified into libbb functions. |
| 33 | Do a SUSv3 audit |
| 34 | Look at the full Single Unix Specification version 3 (available online at |
| 35 | "http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and |
| 36 | figure out which of our apps are compliant, and what we're missing that |
| 37 | we might actually care about. |
| 38 | |
| 39 | Even better would be some kind of automated compliance test harness that |
| 40 | exercises each command line option and the various corner cases. |
| 41 | Internationalization |
| 42 | How much internationalization should we do? |
| 43 | |
| 44 | The low hanging fruit is UTF-8 character set support. We should do this. |
| 45 | (Vodz pointed out the shell's cmdedit as needing work here. What else?) |
| 46 | |
| 47 | We also have lots of hardwired english text messages. Consolidating this |
| 48 | into some kind of message table not only makes translation easier, but |
| 49 | also allows us to consolidate redundant (or close) strings. |
| 50 | |
| 51 | We probably don't want to be bloated with locale support. (Not unless we |
| 52 | can cleanly export it from our underlying C library without having to |
| 53 | concern ourselves with it directly. Perhaps a few specific things like a |
| 54 | config option for "date" are low hanging fruit here?) |
| 55 | |
| 56 | What level should things happen at? How much do we care about |
| 57 | internationalizing the text console when X11 and xterms are so much better |
| 58 | at it? (There's some infrastructure here we don't implement: The |
| 59 | "unicode_start" and "unicode_stop" shell scripts need "vt-is-UTF8" and a |
| 60 | --unicode option to loadkeys. That implies a real loadkeys/dumpkeys |
| 61 | implementation to replace loadkmap/dumpkmap. Plus messing with console font |
| 62 | loading. Is it worth it, or do we just say "use X"?) |
| 63 | |
| 64 | Individual compilation of applets. |
| 65 | It would be nice if busybox had the option to compile to individual applets, |
| 66 | for people who want an alternate implementation less bloated than the gnu |
| 67 | utils (or simply with less political baggage), but without it being one big |
| 68 | executable. |
| 69 | |
| 70 | Turning libbb into a real dll is another possibility, especially if libbb |
| 71 | could export some of the other library interfaces we've already more or less |
| 72 | got the code for (like zlib). |
| 73 | buildroot - Make a "dogfood" option |
| 74 | Busybox 1.1 will be capable of replacing most gnu packages for real world |
| 75 | use, such as developing software or in a live CD. It needs wider testing. |
| 76 | |
| 77 | Busybox should now be able to replace bzip2, coreutils, e2fsprogs, file, |
| 78 | findutils, gawk, grep, inetutils, less, modutils, net-tools, patch, procps, |
| 79 | sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The resulting |
| 80 | system should be self-hosting (I.E. able to rebuild itself from source |
| 81 | code). This means it would need (at least) binutils, gcc, and make, or |
| 82 | equivalents. |
| 83 | |
| 84 | It would be a good "eating our own dogfood" test if buildroot had the option |
| 85 | of using a "make allyesconfig" busybox instead of the all of the above |
| 86 | packages. Anything that's wrong with the resulting system, we can fix. (It |
| 87 | would be nice to be able to upgrade busybox to be able to replace bash and |
| 88 | diffutils as well, but we're not there yet.) |
| 89 | |
| 90 | One example of an existing system that does this already is Firmware Linux: |
| 91 | http://www.landley.net/code/firmware |
| 92 | initramfs |
| 93 | Busybox should have a sample initramfs build script. This depends on |
| 94 | bbsh, mdev, and switch_root. |
| 95 | |
| 96 | |
| 97 | Bernhard Fischer <rep.nop@anon.at>: |
| 98 | Makefile stuff: |
| 99 | make -j is broken, -j1 is forced atm |
| 100 | |
| 101 | As yet unclaimed: |
| 102 | |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 103 | ---- |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 104 | find |
Rob Landley | c58fd15 | 2005-10-25 20:22:50 +0000 | [diff] [blame] | 105 | doesn't understand (), lots of susv3 stuff. |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 106 | ---- |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 107 | diff |
Rob Landley | df4cdaf | 2006-05-19 20:47:55 +0000 | [diff] [blame] | 108 | Make sure we handle empty files properly: |
Rob Landley | 8bcc6e9 | 2006-01-09 00:54:46 +0000 | [diff] [blame] | 109 | From the patch man page: |
| 110 | |
| 111 | you can remove a file by sending out a context diff that compares |
| 112 | the file to be deleted with an empty file dated the Epoch. The |
| 113 | file will be removed unless patch is conforming to POSIX and the |
| 114 | -E or --remove-empty-files option is not given. |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 115 | --- |
| 116 | patch |
Rob Landley | c9c959c | 2005-10-27 00:57:50 +0000 | [diff] [blame] | 117 | Should have simple fuzz factor support to apply patches at an offset which |
Rob Landley | 078bacf | 2005-09-01 03:02:23 +0000 | [diff] [blame] | 118 | shouldn't take up too much space. |
Rob Landley | c9c959c | 2005-10-27 00:57:50 +0000 | [diff] [blame] | 119 | |
| 120 | And while we're at it, a new patch filename quoting format is apparently |
| 121 | coming soon: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2 |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 122 | --- |
| 123 | man |
| 124 | It would be nice to have a man command. Not one that handles troff or |
| 125 | anything, just one that can handle preformatted ascii man pages, possibly |
| 126 | compressed. This could probably be a script in the extras directory that |
Rob Landley | c58fd15 | 2005-10-25 20:22:50 +0000 | [diff] [blame] | 127 | calls cat/zcat/bzcat | less |
Rob Landley | 8bcc6e9 | 2006-01-09 00:54:46 +0000 | [diff] [blame] | 128 | |
| 129 | (How doclifter might work into this is anybody's guess.) |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 130 | --- |
Rob Landley | 8bcc6e9 | 2006-01-09 00:54:46 +0000 | [diff] [blame] | 131 | ar |
| 132 | Write support? |
| 133 | --- |
Bernhard Reutner-Fischer | fc477f4 | 2006-04-26 19:40:15 +0000 | [diff] [blame] | 134 | crond |
| 135 | turn FEATURE_DEBUG_OPT into ENABLE_FEATURE_CROND_DEBUG_OPT |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 136 | |
| 137 | Architectural issues: |
| 138 | |
Rob Landley | 7b7c99c | 2005-11-04 20:45:54 +0000 | [diff] [blame] | 139 | bb_close() with fsync() |
| 140 | We should have a bb_close() in place of normal close, with a CONFIG_ option |
| 141 | to not just check the return value of close() for an error, but fsync(). |
| 142 | Close can't reliably report anything useful because if write() accepted the |
Rob Landley | 8bcc6e9 | 2006-01-09 00:54:46 +0000 | [diff] [blame] | 143 | data then it either went out to the network or it's in cache or a pipe |
| 144 | buffer. Either way, there's no guarantee it'll make it to its final |
| 145 | destination before close() gets called, so there's no guarantee that any |
| 146 | error will be reported. |
| 147 | |
Rob Landley | 7b7c99c | 2005-11-04 20:45:54 +0000 | [diff] [blame] | 148 | You need to call fsync() if you care about errors that occur after write(), |
| 149 | but that can have a big performance impact. So make it a config option. |
| 150 | --- |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 151 | Unify archivers |
| 152 | Lots of archivers have the same general infrastructure. The directory |
| 153 | traversal code should be factored out, and the guts of each archiver could |
| 154 | be some setup code and a series of callbacks for "add this file", |
| 155 | "add this directory", "add this symlink" and so on. |
| 156 | |
| 157 | This could clean up tar and zip, and make it cheaper to add cpio and ar |
Rob Landley | 8bcc6e9 | 2006-01-09 00:54:46 +0000 | [diff] [blame] | 158 | write support, and possibly even cheaply add things like mkisofs or |
| 159 | mksquashfs someday, if they become relevant. |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 160 | --- |
| 161 | Text buffer support. |
Rob Landley | c58fd15 | 2005-10-25 20:22:50 +0000 | [diff] [blame] | 162 | Several existing applets (sort, vi, less...) read |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 163 | a whole file into memory and act on it. There might be an opportunity |
| 164 | for shared code in there that could be moved into libbb... |
| 165 | --- |
Rob Landley | 958fa2a | 2005-06-11 22:10:42 +0000 | [diff] [blame] | 166 | Memory Allocation |
| 167 | We have a CONFIG_BUFFER mechanism that lets us select whether to do memory |
| 168 | allocation on the stack or the heap. Unfortunately, we're not using it much. |
| 169 | We need to audit our memory allocations and turn a lot of malloc/free calls |
| 170 | into RESERVE_CONFIG_BUFFER/RELEASE_CONFIG_BUFFER. |
Bernhard Reutner-Fischer | ef7ccac | 2006-03-13 20:32:48 +0000 | [diff] [blame] | 171 | For a start, see e.g. make CFLAGS_EXTRA=-Wlarger-than-64 |
Rob Landley | a882126 | 2005-09-16 14:58:55 +0000 | [diff] [blame] | 172 | |
Rob Landley | 958fa2a | 2005-06-11 22:10:42 +0000 | [diff] [blame] | 173 | And while we're at it, many of the CONFIG_FEATURE_CLEAN_UP #ifdefs will be |
| 174 | optimized out by the compiler in the stack allocation case (since there's no |
| 175 | free for an alloca()), and this means that various cleanup loops that just |
| 176 | call free might also be optimized out by the compiler if written right, so |
| 177 | we can yank those #ifdefs too, and generally clean up the code. |
Rob Landley | a882126 | 2005-09-16 14:58:55 +0000 | [diff] [blame] | 178 | --- |
| 179 | Switch CONFIG_SYMBOLS to ENABLE_SYMBOLS |
| 180 | |
| 181 | In busybox 1.0 and earlier, configuration was done by CONFIG_SYMBOLS |
| 182 | that were either defined or undefined to indicate whether the symbol was |
| 183 | selected in the .config file. They were used with #ifdefs, ala: |
| 184 | |
| 185 | #ifdef CONFIG_SYMBOL |
| 186 | if (other_test) { |
| 187 | do_code(); |
| 188 | } |
| 189 | #endif |
| 190 | |
| 191 | In 1.1, we have new ENABLE_SYMBOLS which are always defined (as 0 or 1), |
| 192 | meaning you can still use them for preprocessor tests by replacing |
| 193 | "#ifdef CONFIG_SYMBOL" with "#if ENABLE_SYMBOL". But more importantly, we |
| 194 | can use them as a true or false test in normal C code: |
| 195 | |
| 196 | if (ENABLE_SYMBOL && other_test) { |
| 197 | do_code(); |
| 198 | } |
| 199 | |
| 200 | (Optimizing away if() statements that resolve to a constant value |
| 201 | is known as "dead code elimination", an optimization so old and simple that |
| 202 | Turbo Pascal for DOS did it twenty years ago. Even modern mini-compilers |
| 203 | like the Tiny C Compiler (tcc) and the Small Device C Compiler (SDCC) |
| 204 | perform dead code elimination.) |
| 205 | |
| 206 | Right now, busybox.h is #including both "config.h" (defining the |
| 207 | CONFIG_SYMBOLS) and "bb_config.h" (defining the ENABLE_SYMBOLS). At some |
| 208 | point in the future, it would be nice to wean ourselves off of the |
| 209 | CONFIG versions. (Among other things, some defective build environments |
| 210 | leak the Linux kernel's CONFIG_SYMBOLS into the system's standard #include |
| 211 | files. We've experienced collisions before.) |
| 212 | --- |
| 213 | FEATURE_CLEAN_UP |
| 214 | This is more an unresolved issue than a to-do item. More thought is needed. |
| 215 | |
| 216 | Normally we rely on exit() to free memory, close files, and unmap segments |
| 217 | for us. This makes most calls to free(), close(), and unmap() optional in |
| 218 | busybox applets that don't intend to run for very long, and optional stuff |
| 219 | can be omitted to save size. |
| 220 | |
| 221 | The idea was raised that we could simulate fork/exit with setjmp/longjmp |
| 222 | for _really_ brainless embedded systems, or speed up the standalone shell |
| 223 | by not forking. Doing so would require a reliable FEATURE_CLEAN_UP. |
| 224 | Unfortunately, this isn't as easy as it sounds. |
| 225 | |
| 226 | The problem is, lots of things exit(), sometimes unexpectedly (xmalloc()) |
| 227 | and sometimes reliably (bb_perror_msg_and_die() or show_usage()). This |
| 228 | jumps out of the normal flow control and bypasses any cleanup code we |
| 229 | put at the end of our applets. |
| 230 | |
| 231 | It's possible to add hooks to libbb functions like xmalloc() and bb_xopen() |
| 232 | to add their entries to a linked list, which could be traversed and |
| 233 | freed/closed automatically. (This would need to be able to free just the |
| 234 | entries after a checkpoint to be usable for a forkless standalone shell. |
| 235 | You don't want to free the shell's own resources.) |
| 236 | |
| 237 | Right now, FEATURE_CLEAN_UP is more or less a debugging aid, to make things |
| 238 | like valgrind happy. It's also documentation of _what_ we're trusting |
| 239 | exit() to clean up for us. But new infrastructure to auto-free stuff would |
| 240 | render the existing FEATURE_CLEAN_UP code redundant. |
| 241 | |
| 242 | For right now, exit() handles it just fine. |
Rob Landley | 8bcc6e9 | 2006-01-09 00:54:46 +0000 | [diff] [blame] | 243 | |
| 244 | |
| 245 | |
| 246 | Minor stuff: |
| 247 | watchdog.c could autodetect the timer duration via: |
| 248 | if(!ioctl (fd, WDIOC_GETTIMEOUT, &tmo)) timer_duration = 1 + (tmo / 2); |
| 249 | Unfortunately, that needs linux/watchdog.h and that contains unfiltered |
| 250 | kernel types on some distros, which breaks the build. |
Bernhard Reutner-Fischer | 2677cf1 | 2006-01-13 08:46:39 +0000 | [diff] [blame] | 251 | |
| 252 | |
| 253 | Code cleanup: |
| 254 | |
| 255 | Replace deprecated functions. |
| 256 | |
| 257 | bzero() -> memset() |
| 258 | --- |
| 259 | sigblock(), siggetmask(), sigsetmask(), sigmask() -> sigprocmask et al |
| 260 | --- |
Bernhard Reutner-Fischer | 34fc71f | 2006-04-12 18:50:19 +0000 | [diff] [blame] | 261 | vdprintf() -> similar sized functionality |
| 262 | --- |
Bernhard Reutner-Fischer | 2677cf1 | 2006-01-13 08:46:39 +0000 | [diff] [blame] | 263 | |