Glenn L McGrath | 90d2bff | 2004-05-01 00:49:49 +0000 | [diff] [blame] | 1 | Busybox TODO |
| 2 | |
| 3 | Stuff that needs to be done |
| 4 | |
Eric Andersen | b413a70 | 2005-02-13 22:20:35 +0000 | [diff] [blame] | 5 | tr - missing SuS3 features in busybox 1.0pre10 |
Glenn L McGrath | 90d2bff | 2004-05-01 00:49:49 +0000 | [diff] [blame] | 6 | |
| 7 | tr doesnt support [:blank:], [:digit:] or other predefined classes, [=equiv=] |
| 8 | support is also missing. |
| 9 | ---- |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 10 | find |
| 11 | doesn't understand () or -exec, and these are actually used out in the real |
| 12 | world. The "make uninstall" of lots of things (including busybox itself) |
| 13 | breaks because of this, and sometimes even "make install" (like udev). |
| 14 | ---- |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 15 | sh |
| 16 | The command shell situation is a big mess. We have three or four different |
| 17 | shells that don't really share any code, and the "standalone shell" doesn't |
| 18 | work all that well (especially not in a chroot environment), due to apps not |
| 19 | being reentrant. Unifying the various shells and figuring out a configurable |
| 20 | way of adding the minimal set of bash features a given script uses is a big |
| 21 | job, but it be a big improvement. |
Rob Landley | a937640 | 2005-08-23 23:08:17 +0000 | [diff] [blame] | 22 | |
| 23 | Note: Rob Landley (rob@landley.net) is working on this one, but very slowly... |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 24 | --- |
| 25 | gzip |
| 26 | Can't handle compressing multiple files at once. (I don't mean making a |
| 27 | multiple file archive, I mean compressing more than one file at a time.) |
| 28 | Some global variables aren't re-initialized between runs. |
| 29 | --- |
| 30 | gunzip |
| 31 | same problem as gzip. "gunzip one.gz two.gz three.gz" doesn't work for |
| 32 | two.gz and three.gz due to global variables not getting reset. |
| 33 | --- |
| 34 | diff |
| 35 | We should have a diff -u command. We have patch, we should have diff |
| 36 | (we only need to support unified diffs though). |
| 37 | --- |
Rob Landley | a937640 | 2005-08-23 23:08:17 +0000 | [diff] [blame] | 38 | fuser |
| 39 | Would be nice. The basic susv3 options, plus fuser -k. |
| 40 | --- |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 41 | patch |
Rob Landley | 078bacf | 2005-09-01 03:02:23 +0000 | [diff] [blame] | 42 | should have simple fuzz factor support to apply patches at an offset which |
| 43 | shouldn't take up too much space. |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 44 | --- |
| 45 | man |
| 46 | It would be nice to have a man command. Not one that handles troff or |
| 47 | anything, just one that can handle preformatted ascii man pages, possibly |
| 48 | compressed. This could probably be a script in the extras directory that |
| 49 | calls cat/zcatbzcat | more |
| 50 | --- |
Rob Landley | f4bb212 | 2005-01-24 06:56:24 +0000 | [diff] [blame] | 51 | bzip2 |
| 52 | Compression-side support. |
| 53 | |
| 54 | |
| 55 | Architectural issues: |
| 56 | |
| 57 | Do a SUSv3 audit |
| 58 | Look at the full Single Unix Specification version 3 (available online at |
| 59 | "http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and |
| 60 | figure out which of our apps are compliant, and what we're missing that |
| 61 | we might actually care about. |
| 62 | |
| 63 | Even better would be some kind of automated compliance test harness that |
| 64 | exercises each command line option and the various corner cases. |
| 65 | -- |
| 66 | Unify archivers |
| 67 | Lots of archivers have the same general infrastructure. The directory |
| 68 | traversal code should be factored out, and the guts of each archiver could |
| 69 | be some setup code and a series of callbacks for "add this file", |
| 70 | "add this directory", "add this symlink" and so on. |
| 71 | |
| 72 | This could clean up tar and zip, and make it cheaper to add cpio and ar |
| 73 | write support, and possibly even cheaply add things like mkisofs someday, |
| 74 | if it becomes relevant. |
| 75 | --- |
| 76 | Text buffer support. |
| 77 | Several existing applets and potential additions (sort, vi, less...) read |
| 78 | a whole file into memory and act on it. There might be an opportunity |
| 79 | for shared code in there that could be moved into libbb... |
| 80 | --- |
| 81 | Individual compilation of applets. |
| 82 | It would be nice if busybox had the option to compile to individual applets, |
| 83 | for people who want an alternate implementation less bloated than the gnu |
| 84 | utils (or simply with less political baggage), but without it being one big |
| 85 | executable. |
| 86 | |
| 87 | Turning libbb into a real dll is another possibility, especially if libbb |
| 88 | could export some of the other library interfaces we've already more or less |
| 89 | got the code for (like zlib). |
| 90 | --- |
| 91 | buildroot - Make a "dogfood" option |
| 92 | Busybox is now capable of replacing most gnu packages for real world use, |
| 93 | such as developing software or in a live CD. A system built from busybox |
| 94 | (1.00 with updated sort.c), uclibc 0.9.27, gcc, binutils, make, and a few |
| 95 | other development tools (http://www.landley.net/code/firmware has an example |
| 96 | system using autoconf, automake, bison, flex, libtools, m4, zlib, |
| 97 | and groff: dunno what subset of that is actually necessary) is capable of |
| 98 | rebuilding itself, from scratch, under itself. |
| 99 | |
| 100 | It would be a good "eating our own dogfood" test if buildroot had the option |
| 101 | of using busybox instead of bzip2, coreutils, file, findutils, gawk, grep, |
| 102 | inetutils, modutils, net-tools, procps, sed, shadow, sysklogd, sysvinit, tar, |
| 103 | util-linux, and vim. Anything that's wrong with the resulting system, we |
| 104 | can fix. (It would be nice to be able to upgrade busybox to be able to |
| 105 | replace bash, diffutils, gzip, less, and patch as well.) |
Rob Landley | 958fa2a | 2005-06-11 22:10:42 +0000 | [diff] [blame] | 106 | --- |
| 107 | Memory Allocation |
| 108 | We have a CONFIG_BUFFER mechanism that lets us select whether to do memory |
| 109 | allocation on the stack or the heap. Unfortunately, we're not using it much. |
| 110 | We need to audit our memory allocations and turn a lot of malloc/free calls |
| 111 | into RESERVE_CONFIG_BUFFER/RELEASE_CONFIG_BUFFER. |
Rob Landley | a882126 | 2005-09-16 14:58:55 +0000 | [diff] [blame] | 112 | |
Rob Landley | 958fa2a | 2005-06-11 22:10:42 +0000 | [diff] [blame] | 113 | And while we're at it, many of the CONFIG_FEATURE_CLEAN_UP #ifdefs will be |
| 114 | optimized out by the compiler in the stack allocation case (since there's no |
| 115 | free for an alloca()), and this means that various cleanup loops that just |
| 116 | call free might also be optimized out by the compiler if written right, so |
| 117 | we can yank those #ifdefs too, and generally clean up the code. |
Rob Landley | a882126 | 2005-09-16 14:58:55 +0000 | [diff] [blame] | 118 | --- |
| 119 | Switch CONFIG_SYMBOLS to ENABLE_SYMBOLS |
| 120 | |
| 121 | In busybox 1.0 and earlier, configuration was done by CONFIG_SYMBOLS |
| 122 | that were either defined or undefined to indicate whether the symbol was |
| 123 | selected in the .config file. They were used with #ifdefs, ala: |
| 124 | |
| 125 | #ifdef CONFIG_SYMBOL |
| 126 | if (other_test) { |
| 127 | do_code(); |
| 128 | } |
| 129 | #endif |
| 130 | |
| 131 | In 1.1, we have new ENABLE_SYMBOLS which are always defined (as 0 or 1), |
| 132 | meaning you can still use them for preprocessor tests by replacing |
| 133 | "#ifdef CONFIG_SYMBOL" with "#if ENABLE_SYMBOL". But more importantly, we |
| 134 | can use them as a true or false test in normal C code: |
| 135 | |
| 136 | if (ENABLE_SYMBOL && other_test) { |
| 137 | do_code(); |
| 138 | } |
| 139 | |
| 140 | (Optimizing away if() statements that resolve to a constant value |
| 141 | is known as "dead code elimination", an optimization so old and simple that |
| 142 | Turbo Pascal for DOS did it twenty years ago. Even modern mini-compilers |
| 143 | like the Tiny C Compiler (tcc) and the Small Device C Compiler (SDCC) |
| 144 | perform dead code elimination.) |
| 145 | |
| 146 | Right now, busybox.h is #including both "config.h" (defining the |
| 147 | CONFIG_SYMBOLS) and "bb_config.h" (defining the ENABLE_SYMBOLS). At some |
| 148 | point in the future, it would be nice to wean ourselves off of the |
| 149 | CONFIG versions. (Among other things, some defective build environments |
| 150 | leak the Linux kernel's CONFIG_SYMBOLS into the system's standard #include |
| 151 | files. We've experienced collisions before.) |
| 152 | --- |
| 153 | FEATURE_CLEAN_UP |
| 154 | This is more an unresolved issue than a to-do item. More thought is needed. |
| 155 | |
| 156 | Normally we rely on exit() to free memory, close files, and unmap segments |
| 157 | for us. This makes most calls to free(), close(), and unmap() optional in |
| 158 | busybox applets that don't intend to run for very long, and optional stuff |
| 159 | can be omitted to save size. |
| 160 | |
| 161 | The idea was raised that we could simulate fork/exit with setjmp/longjmp |
| 162 | for _really_ brainless embedded systems, or speed up the standalone shell |
| 163 | by not forking. Doing so would require a reliable FEATURE_CLEAN_UP. |
| 164 | Unfortunately, this isn't as easy as it sounds. |
| 165 | |
| 166 | The problem is, lots of things exit(), sometimes unexpectedly (xmalloc()) |
| 167 | and sometimes reliably (bb_perror_msg_and_die() or show_usage()). This |
| 168 | jumps out of the normal flow control and bypasses any cleanup code we |
| 169 | put at the end of our applets. |
| 170 | |
| 171 | It's possible to add hooks to libbb functions like xmalloc() and bb_xopen() |
| 172 | to add their entries to a linked list, which could be traversed and |
| 173 | freed/closed automatically. (This would need to be able to free just the |
| 174 | entries after a checkpoint to be usable for a forkless standalone shell. |
| 175 | You don't want to free the shell's own resources.) |
| 176 | |
| 177 | Right now, FEATURE_CLEAN_UP is more or less a debugging aid, to make things |
| 178 | like valgrind happy. It's also documentation of _what_ we're trusting |
| 179 | exit() to clean up for us. But new infrastructure to auto-free stuff would |
| 180 | render the existing FEATURE_CLEAN_UP code redundant. |
| 181 | |
| 182 | For right now, exit() handles it just fine. |