Age | Commit message (Collapse) | Author |
|
|
|
both did it) so use getbasename instead.
|
|
|
|
have noticed yet.
|
|
This isn't a shell builtin, it uses prlimit to target any pid (without -P
it defaults to $PPID, so acts like historical ulimit by default).
|
|
checking, and fix up format checking complaints.
Added out(type, value) function to stat to avoid a zillion printf typecasts.
|
|
|
|
https://android-review.googlesource.com/159035/
|
|
portability.h to new lib/lsm.h. Update ls.c to use it.
Fix "ls . toys" (two directories when one is . or ..), which was filtering
out the . as something we shouldn't recurse into even though it was explicitly
listed on the command line. For some reason "ls -Z . toys" is still segfaulting
though (but "ls -Z ." isn't), need to figure out why...
|
|
|
|
|
|
|
|
|
|
|
|
TOYBOX_DEBUG enabled.
One again gcc manages to be incompetent about producing warnings. For example,
in bzcat we error_exit() with a message that's an error code fed into an
array of string constants, and apparently dereferencing an array of string
literals doesn't give you a string literal according to -Wformat-security.
Not breaking the code to humor the compiler here, the compiler is wrong.
|
|
i'll be AFK for a week, so here's the patch i've been using this
evening to find other format string mistakes. BSD uses __printflike
and takes two arguments instead of hard-coding (1,2), but i figured
that as long as you don't need the generality you'd prefer not to have
it. and it's easy enough to retrofit if we ever do have a formatting
function that takes other arguments.
|
|
faccessat(AT_SYMLINK_NOFOLLOW) is not supported.
|
|
a static inline in portability.h, and prototype dirname() while we're at it.
|
|
I considered a #else on the big #ifdef __GLIBC__ above, but that
seemed harder to follow.
|
|
|
|
|
|
|
|
the SELinux commands (such as chcon) and the SELinux-specific options
to regular commands (such as ls -Z).
This lets us #include <selinux/selinux.h> in portability.h.
I've also fixed chcon to insist on being given the a context argument.
This patch also adds -Z to id and fixes id's regular output (-G should
be separated by spaces, non-G output should be separated by commas,
and you don't want a double comma where the egid is omitted from the
list of groups).
|
|
random other symbol name (because gnu) and this screws up nontrivial macro expansions of NEWTOY(basename), so work around it in portability.h.
|
|
xfork() to portability.h and #ifdef based on __uClinux__ (which seems to be the nommu compiler define).
|
|
|
|
|
|
|
|
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.
|
|
The Linux man page says I can use AT_SYMLINK_NOFOLLOW. It works in glibc,
uclibc, and klibc, but musl returns -EINVAL any time you pass in that flag
and the maintainer says that's not a bug and insists the man page and those
other libraries all change to match musl's behavior.
Toybox uses it to avoid scheduling unnecessary metadata writes for things we're
about to delete (have to chmod unreadable directories so we can descend into
them to delete their contents, the chmod happens before we descend so the
disk I/O has plenty of time to be scheduled) because the extra writes wear out
SSD faster. It's just an optimization and I don't really care if it works
_well_ (the fchmodat call _also_ takes AT_SYMLINK_NOFOLLOW so that's covered),
but musl's behavior uniquely makes the check always error and thus breaks normal
"rm -r".
Yes this workaround is checking #ifdef __MUSL__ which the library does not
supply (because its code is perfect and will thus never need to be worked
around). You can CFLAGS=-D__MUSL__ if you don't echo "#define __MUSL__" >>
include/features.h when installing the library.
|
|
I've been locally patching uClibc to not violate posix-2008 (you don't need
to define a GNU macro to get a posix function), but uClibc is obsolete and
moribund (development peaked in 2006, last bugfix release was over 2 years
ago), and the largest remaining user (buildroot) doesn't bother to apply such
a patch. Since even buildroot is slowly migrating to musl-libc, just do the
portability tweak for what the last release of the old thing actually did.
|
|
|
|
portability.h.patch - it is for O_CLOEXEC, as compiler complained of it.
Makefile.patch - for cleaning generated/*.o files and libopts.dat file
[Fixup to uniq.c from Rob.]
|
|
Use wcwidth() instead of strlen(), and extend the -q substitution to also
whiteout nonprintable characters that are nonparseable utf8 snippets.
|
|
or float for FLOAT arguments. (I.E. whether double fits in a long's memory.) Check in a way that the macros not being defined just gives us the shorter one.
|
|
cross compiling, so just #define it to 0 if it's not in fcntl.h where posix-2008 says.
|
|
networking). Move headers standards ignore (but which have been there >15 years) to lib/portability.h. Fold xregcomp into lib since it's posix.
|
|
* __GLIBC__ was checked unconditionally;
this made for a very messy build on musl.
* int fd in chvt is always initialized; GCC 3.4 does not recognize this.
|
|
sys/mount.h...
|
|
|
|
doesn't conform to posix-2008.
|
|
supply them for broken headers.
|
|
|
|
symbols out of specific library version checks (shouldn't hurt anything), remove obsolete debug macro.
|
|
|
|
|
|
other stuff. Fix it up in portability.h.
|
|
use flag macros, option parsing can collect argument strings in global block, use existing perror_* macros.
|
|
we need, but require a boot to the headers to get them to admit it. Note that uClibc lies and claims to be glibc so we have to specifically exclude it here.
|