Age | Commit message (Collapse) | Author |
|
This makes it more likely that you can actually debug something like
"sed: bad regex: empty (sub)expression" or
"sed: bad regex: parentheses not balanced" from a build failure log,
where you don't necessarily know where the failure came from.
This also seems like it might be useful generally, although GNU grep
doesn't include this detail in its error messages, and busybox doesn't
even seem to notice that regcomp() failed?
(Realistically if the Android build team wants to move forward with "one
true regex implementation", we're going to have to add some GNU-isms to
the Android regex implementation. But we'd need to find them first! Note
that the two examples given above are real examples from failed buildbot
builds, but they occur early in the respective builds so there are
likely many more to look at after these. Interestingly, the first of the
two appears to be the more general case of something disallowed by POSIX
that xregcomp() already has a workaround for.)
|
|
I added a #include above this, which caused subtle breakages on 32-bit
systems. Move it to the top of the file to fix it and avoid making a
similar mistake in future.
|
|
One reason to use toybox on the host is to get the same behavior across
Android/Linux/macOS. Unfortunately (as we've seen from a few bugs) one
area where that doesn't quite work is that toybox uses the libc regular
expression implementation. That's fine, and mostly what users want, but
those folks trying to get the exact same behavior everywhere might want
to switch in a known regex implementation (bionic's NetBSD regex
implementation, say) for increased consistency.
That actually works pretty well, but portability.h has an #ifndef test
for REG_STARTEND before including <regex.h> that gets in the way. To
make up for that, this patch removes the unnecessary #include <regex.h>
from grep.c itself.
|
|
|
|
|
|
|
|
|
|
We need to *name = 0 explicitly for the !name && !statless case, so don't
need the +1 in memset that was only zeroing in the !name && statless case.
|
|
tar asks dirtree_path() to reserve space for a trailing '/', but recent
changes broke that for the case that was resolving to just a strdup().
Caught by `export ASAN=1` and `make test_tar`.
|
|
|
|
|
|
|
|
|
|
when passed in extra allocation length or else free() gets very unhappy.
|
|
|
|
|
|
broke the password: prompt.
|
|
The comma thing turned into an internationalization can of worms,
don't go there. Keep the "show megabytes on systems with >10G"
logic which includes not showing 0.0 for single digit values.
|
|
and use the comma format when selected even if <3 digits (no 0.0M)
|
|
|
|
This round trip occurs in practice with $KBUILD_BUILD_TIMESTAMP in
kernel builds.
|
|
Some of the grep tests were still failing because we weren't flushing
stdout --- xflush takes a bool that says whether to actually flush, so
we need to pass 1, not 0.
|
|
This is why the tests have been failing since
42303209f44a335025b9cd1dbe5dd2f3069f2e99.
|
|
|
|
|
|
Helps for terminals narrower than 80 columns (such as ConnectBot on a
current Android device).
|
|
|
|
Requested in https://github.com/landley/toybox/issues/130, quoting an
old version of the toybox help. This is also supported by coreutils.
Set $LANG to C in the date tests so that they pass with TEST_HOST=1
(they were already failing for me, presumably related to a newer glibc).
|
|
|
|
This is a follow-on from 310eefe, addressing the case where sscanf fails
and returns -1.
|
|
|
|
|
|
I suspect the rest of the non-POSIX signals might end up like this, but this is the subset that needs to be #ifdef'ed to fix the macOS build.
|
|
|
|
|
|
Do not therefore assume it being available linuxwide
Fixes
| lib/portability.c:433:3: error: use of undeclared identifier 'SIGSTKFLT'
| SIGNIFY(STKFLT), SIGNIFY(POLL), SIGNIFY(PWR),
| ^
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
because scanf("0%o") needs a 0 _and_ one or more digits. So add it to
the end of the \n translation list (where it returns the null terminator).
|
|
refactoring while I was looking at the codepath.
|
|
|
|
|
|
|
|
with memset() instead of = {}, and move TT.alarm to local variable.
|
|
|
|
Some of the bringup folks are debugging RTC issues and asked for this.
Rather than duplicate the weird xtzset dance with mktime, I've factored
that out into a new xmktime that takes a boolean for whether to use UTC
or local time.
Otherwise, the slight cleanup of hwclock.c is entirely optional. The
only functional change there is that util-linux 2.34's hwclock uses ISO
time format, which is the usual toybox preference anyway, so I've
switched it over to that rather than ctime(3).
Bug: http://b/152042947
|
|
|
|
We were incorrectly passing a pointer to a pointer of an
unsigned long long, when we just wanted to pass a pointer
to the unsigned long long. This is especially bad on 32-bit
systems, where we're then writing a 64-bits into a 32-bit value
within ioctl.
We fix this to pass a pointer to the unsigned long long.
Test: On 32-bit device, no longer see native crash from toybox
Bug: http://b/151311535
Signed-off-by: Elliott Hughes <enh@google.com>
|
|
The shift was a remnant from when BLKGETSIZE (which measures in
blocks) was being used on Linux. The Mac has two separate ioctls
for block count and block size, which we're already multiplying
together. And on Linux we're using BLKGETSIZE64, which returns a
result in bytes, not blocks. So lose the shift.
|
|
The recent re-enablement of the BLKGETSIZE64 code broke the Mac
build. Use the equivalent <sys/disk.h> ioctl() pair instead.
|
|
I came here because the new -Wno-unreachable-code-loop-increment warning
didn't like the for loop on line 86. That loop is indeed not necessary.
Use strend() to do a string suffix match.
Use memmem() to search. It's available on macOS and Android by default,
but it's behind _GNU_SOURCE for glibc, so add that to portability.h.
Output the tags in the same order as the Debian modinfo.
I've left "parmtype" in even though the Debian modinfo doesn't output it
at all.
Also fix the tests so that they work on a device that has modules for
multiple kernels installed (like my laptop) --- make sure that the two
modules we pick come from the same kernel.
|
|
(Update to the 64 bit API while we're there. And yes, I checked in the
kernel, it's 512 byte units.)
|