changeset | 2f2c7ae058d7 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Only switch on printf format warnings for error_exit() and friends when 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. |
files |
changeset | ef5d02d0d37f |
---|---|
branch | |
bookmark | |
tag | |
user | Elliott Hughes <enh@google.com> |
description | let the compiler check format strings 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. |
files |
changeset | 6b494fdd61e0 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Alright, the Android guys agree with the musl guys: faccessat(AT_SYMLINK_NOFOLLOW) is not supported. |
files |
changeset | 5d003cc2fa16 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Lift the basename/libgen.h shenanigans back out of portability.c and make it a static inline in portability.h, and prototype dirname() while we're at it. |
files |
changeset | 692be264d4f0 |
---|---|
branch | |
bookmark | |
tag | |
user | Elliott Hughes <enh@google.com> |
description | fix non-glibc basename(3) usage I considered a #else on the big #ifdef __GLIBC__ above, but that seemed harder to follow. |
files |
changeset | 988f3d13b925 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Move pty.h back to toys.h (under LSB 4.1 headers). |
files |
changeset | c1715c752e89 |
---|---|
branch | |
bookmark | |
tag | |
user | Elliott Hughes <enh@google.com> |
description | AOSP master has <pty.h> and builds netcat/nc. |
files |
changeset | d4bc084916fd |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | id.c #ifdefectomy. (ifdefs belong in headers, not in C code.) |
files |
changeset | b84024067049 |
---|---|
branch | |
bookmark | |
tag | |
user | Elliott Hughes <enh@google.com> |
description | This patch adds a TOYBOX_SELINUX configuration option to control both 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). |
files |
changeset | aafd2f28245a |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | When you include the posix header libgen.h, glibc #defines basename to some random other symbol name (because gnu) and this screws up nontrivial macro expansions of NEWTOY(basename), so work around it in portability.h. |
files |
changeset | ce22ad7a26c1 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Work with buildroot's extensively patched uClibc, and for nommu support move xfork() to portability.h and #ifdef based on __uClinux__ (which seems to be the nommu compiler define). |
files |
changeset | e85e5f3b87c2 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | As long as Android's going to require fortify, fixup the warnings it generates. |
files |
changeset | da72fa267b7b |
---|---|
branch | |
bookmark | |
tag | |
user | Elliott Hughes <enh@google.com> |
description | A patch against your current ToT that builds in AOSP master. |
files |
changeset | 73eb55d21cde |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Patch from Elliott Hughes for Android/bionic build. |
files |
changeset | a3500bd8b322 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Fixups for the android/bionic build probes patch. 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. |
files |
changeset | 685a0da6ca59 |
---|---|
branch | |
bookmark | |
tag | |
user | Isaac Dunham <ibid.ag@gmail.com> |
description | probe for getspnam(), forkpty(), utmpx, replace sethostname() 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. |
files |
changeset | 7afd32673a5c |
---|---|
branch | |
bookmark | |
tag | 0.5.0 |
user | Rob Landley <rob@landley.net> |
description | Workaround for musl's faccessat bug (the rm -r "error: is a directory" thing). 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. |
files |
changeset | ca340df928bc |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Tweak portability.h for uClibc version in buildroot defconfig. 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. |
files |
changeset | 240bd13db413 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Work around uClibc brain-damage. |
files |
changeset | 00c20f410c46 |
---|---|
branch | |
bookmark | |
tag | |
user | Ashwini Sharma <ak.ashwini1981@gmail.com> |
description | Patches to commands for issues reported from static analysis tool. 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.] |
files |
changeset | 5149632b0d07 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Add utf8 support to ls -C. Use wcwidth() instead of strlen(), and extend the -q substitution to also whiteout nonprintable characters that are nonparseable utf8 snippets. |
files |
changeset | 6f18a0845db3 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Use compiler built-in macros to determine if argument parsing can use double 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. |
files |
changeset | 565980862743 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Probes for O_NOFOLLOW that compile and run something aren't compatible with cross compiling, so just #define it to 0 if it's not in fcntl.h where posix-2008 says. |
files |
changeset | 63db77909fc8 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Group headers by standard (POSIX or LSB) or function (internationalization, networking). Move headers standards ignore (but which have been there >15 years) to lib/portability.h. Fold xregcomp into lib since it's posix. |
files |
changeset | 8b62561ce52a |
---|---|
branch | |
bookmark | |
tag | |
user | Isaac Dunham <ibid.ag@gmail.com> |
description | Two changes to shut up GCC: * __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. |
files |
changeset | d01ab969cc5d |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Only define MNT_DETACH for old glibc, portability.h included _before_ sys/mount.h... |
files |
changeset | 3570984a1015 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Regression test against Ancient Build Environment (Ubuntu 8.04), fixup bit-rot. |
files |
changeset | 52e69f6710ca |
---|---|
branch | |
bookmark | |
tag | 0.4.4 |
user | Rob Landley <rob@landley.net> |
description | Compile time probe to fish O_NOFOLLOW out of linux headers when fcntl doesn't conform to posix-2008. |
files |
changeset | 5a2b83a92521 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | O_NOFOLLOW is specified by posix-2008 and varies by target, don't try to supply them for broken headers. |
files |
changeset | bbec26ccb40c |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Comment updates and a policy statement about avoiding #define GNU_dammit |
files |
changeset | 4ffb735aea59 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | More support for old (~2008) build environments, move the #ifdef checks for symbols out of specific library version checks (shouldn't hurt anything), remove obsolete debug macro. |
files |
changeset | 9a6b08e7fe94 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Work around more random uClibc-specific breakage. |
files |
changeset | fb17cd078e63 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Fix ancient glibc workaround to force fstatat64 |
files |
changeset | ff8a27d3ab8f |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | The headers of uClibc and older glibc got unhappy with O_DIRECTORY and some other stuff. Fix it up in portability.h. |
files |
changeset | 9fb5fe6eb13f |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | More touch cleanup to use generic infrastructure: use getdate() from libc, use flag macros, option parsing can collect argument strings in global block, use existing perror_* macros. |
files |
changeset | 8871e8002812 |
---|---|
branch | |
bookmark | |
tag | 0.4.1 |
user | Rob Landley <rob@landley.net> |
description | Older versions of glibc predated posix-2008. They still provide most of what 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. |
files |
changeset | 58d2fd7484bd |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | More header fiddling: crypt.h is silly, SUSv4 requires crypt() to be prototyped in unistd.h. The fact glibc refuses to do so without a wacky #define is a glibc bug, treat it as such. |
files |
changeset | b2194045c40e |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Remove "feature test macros", replace non-portable fdprintf() with standard fprintf(). |
files |
changeset | 1f5bd8c93093 |
---|---|
branch | |
bookmark | |
tag | |
user | Georgi Chorbadzhiyski <gf@unixsol.org> |
description | Implement Apple and Android versions of getline(), getdelim(), and clearenv(). |
files |
changeset | 31215cc6c9f2 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Consolidate headers. |
files |
changeset | 9051cb744d0a |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Shut up even MORE gcc/glibc spurious warnings. |
files |
changeset | 5f1d3ad8a888 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Add noreturn mark to [p]error_exit(), suggested by Charlie Shepherd. |
files |
changeset | c3d1d74d5d8f |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | MacOS X has a defective sed with no -r. |
files |
changeset | 884c03c29f21 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Teach build to build only the toys/*.c selected in .config, and teach CFG_TOYSH_DEBUG to shut up the spurious "gcc can't tell that this is never actually used uninitialized because gcc is stupid" warnings. |
files |
changeset | 69efffcacd70 |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Add fdprintf(). Remove reread() and rewrite() which handle -EINTR, which shouldn't be a problem if we register signal handlers with sigaction(SA_RESTART) Straighten out count and len (I generally consistently use "count" for the current progress and "len" for the total, but this time I got them backwards for some reason and don't want to confuse myself in future.) |
files |
changeset | 41d55b5d49fd |
---|---|
branch | |
bookmark | |
tag | |
user | Rob Landley <rob@landley.net> |
description | Add start of mke2fs/gene2fs, and some other stuff I've been working on. |
files |