Age | Commit message (Collapse) | Author |
|
The s/// command would copy the \ of substitutions before deciding what to
do with them (generally overwriting the \ with the new data). When the
substitution was A) at the very end of the new string, B) resolved to nothing,
it could leave a trailing \ that didn't belong there and didn't get overwritten
because the "copy trailing data" part that copies the original string's null
terminator already happened before the \ overwrote it.
The ghostwheel() function restarts regexes after embedded NUL bytes, but
if the string it's passed is _longer_ than the length it's told then it
gets confused (and it means we're off the end of our allocation so segfaults
are likely).
Fix: test for \ first and move the "copy byte" logic into an else case.
|
|
|
|
zeroes (nul terminator overwritten).
|
|
|
|
warning.
|
|
including that. (Worked until I did a "make clean".)
|
|
|
|
|
|
The tizen guys wanted this. Yeah, I know there's base64 code in
uuencode/uudecode, but that this has -i, input lines aren't of fixed length,
encode/decode are in same file, there's no prefix/suffix code, it always
writes to stdout... Eliminating the code duplication wouldn't be worth
the if/else I'd have to add, so I just did a new one.
Factored out the base64 table init into lib.c though: that was worth sharing.
|
|
The semantics of strncat() and strncpy() are non-obvious, so let's not use 'em.
Both zero all their remaining buffer space, and with strncat() the size is
the space left at the _end_ of the string (not the size of the buffer) so
it's way too easy to stomp memory you don't own. As long as we have to measure
stuff ourselves to get it right, just use memcpy().
|
|
(it also adds a feature, -R, because toybox makes that so easy.)
you'll probably want fancier configuration here because although the
--as-needed works okay, a typical Ubuntu box will have the .so but not
the .h files. i did consider adding a toys/selinux/ directory, but
given that existing tools like ls and id will want -Z SELinux options,
i wasn't sure whether you'd think it was worth segregating the
SELinux-only toys.
note that this won't help the tizen smack users (and patch for smack
won't help SELinux users). so you might want to think about where
you'd like us to be aiming: #if USE_SELINUX/USE_SMACK in all the
relevant places, or a toys/selinux and a toys/smack (though we'd still
need #if in at least ls and id), or a lib/security.c that concentrates
all the differences into one file?
|
|
messed up.
|
|
A newline after 'b' commands in -e command line patterns was being discarded
as whitespace, a single element regex match on a {} was leaving stale state
for the next line, and giant -e blobs of instructions were saying things
like problem at character 432 (note: nulls inserted for regex processing
aren't always cleaned up, screws up error reporting).
|
|
xfork() to portability.h and #ifdef based on __uClinux__ (which seems to be the nommu compiler define).
|
|
|
|
|
|
to stdout.
|
|
and remove final delay (after all output) for "vmstat 2 3" case.
|
|
standard.
|
|
The OS mostly catches this for block devices, but calling "mount -a" twice
shouldn't overmount tmpfs entries with new tmpfs instances. (This needs a test
suite entry, and the test suite needs a root context to run in...)
|
|
build break (open(O_CREAT) without permissions).
|
|
|
|
shouldn't loop endlessly.
|
|
with the one in pending.
|
|
|
|
I'm here (to be described on the mailing list).
|
|
calling root-only commands through the multiplexer.
It would say "no such command" when it should say "not root".
|
|
|
|
regex pattern match.
|
|
to finish before exiting.)
|
|
|
|
|
|
|
|
|
|
|
|
ones (in the "change" subdirectory), and tweak scripts/make.sh to avoid redundant work when rebuilding.
|
|
anything left in the line, and more tests.
|
|
(I added the "only run if root" stanza at the beginning.)
|
|
Probe the default buffer size, replace the constants with FLAG_x macros, add -r,
replace the byte at a time output with a single xwrite(), more comments.
|
|
tweaking the spacing.
I didn't apply the POSIXLY_CORRECT gnuism because it's a can of worms (as would
be LSB_CORRECT), and you can presumably alias df="df -P" if you want that.
Possibly in future I should factor out the "readahead and align columns based
on measuring the largest value in each" code from ls and apply it here.
|
|
most notably:
* Android switched to mksh several releases ago.
* system/core/reboot is Android's reboot(1) (and sdcard is how
emulated sdcards work in production, not a testing thing).
* I removed all the "apparently unused" tools from the tree, since
they were all actually unused with the exception of lsusb which people
would build as/when they needed it. (which may need resurrecting when
they come back and find there's no "lsusb -v" in toolbox.)
|
|
We zero the buffer and if the link read fails that's left alone, so
it's ok for the symlink not to be there. Unfortunately, typecasting the
return value to (void) doesn't shut up gcc, and having an if(); with the
semicolon on the same line doesn't shut up llvm. (The semicolon on a new
line would, but C does not have significant whitespace and I'm not going
to humor llvm if it plans to start.)
So far, empty curly brackets consistently get the warning to shut up.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The CFG_* symbols are always defined so if() can use them as compile-time
constants, so don't if defined() them.
Doing USE_BLAH() around variable definitions opens up the same potential for
config-dependent build breaks as #ifdefs do, just make the whole command
depend on the symbol for now, factor out the utmpx infrastructure later.
The PTY probe was always failing because it used NULL without #including
the header that defines it. Substitute 0 instead.
|
|
Android is missing all of these; we need to probe for some so we have
a config symbol to depend on.
sethostname() is easily replaced.
We got termios.h via pty.h; now it's not included in configure-step tools,
so we need termios.h to generate globals.
|