Age | Commit message (Collapse) | Author |
|
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.)
|
|
Toybox doesn't modify inherited environ[] (the same way we don't modify
our inherited argv[]), so instead of freeing our allocated environ[] when
we want to clear it we need to allocate a new environ[] in the else path
(at a length compatible with the existing plumbing's add stride), set the
first entry of _that_ to 0, and set toys.envc = 1 to record it's an
alloced environ.
|
|
|
|
|
|
Basic readelf(1) implementation, with output close enough to the binutils
version to be usable with scripts that expect the binutils version. This
started as an implementation of nm(1) until I realized that I almost always
want readelf instead, and that you actually have to do much of the work
needed for readelf just to implement nm. Arguably nm (being part of POSIX)
belongs in toybox while readelf doesn't. An argument could also be made that
neither really belongs in toybox, belonging in a separate set of development
tools (such as binutils or the LLVM binutils).
Doesn't support most of the architecture-specific stuff, most notably
relocations, but is aware of things like ARM exidx sections and the common
register state notes in core dumps for the "big four" architectures: arm,
arm64, x86, and x86-64.
Doesn't support symbol versions (but probably should).
Doesn't support section groups or the -t "section details" (which is a long
form of -S "section headers" that I've never seen used in practice and which
isn't part of -a). Doesn't support dumping unwind info or the hash table
bucket histograms.
Reuses the table of ELF architectures from file(1).
Not fuzzed, but successfully parses all the ELF files in my Ubuntu 18.04
system's lib directories. Attempts to exit with an error when presented with
an invalid ELF file rather than struggle on as binutils seems to.
|
|
|
|
|
|
|
|
builtin, and add -u.
|
|
|
|
|
|
An Android engineer complained that they were seeing this when not
running as root:
$ adb shell ls
ls: ./postinstall: Invalid argument
ls: ./init: Permission denied
ls: ./data_mirror: Invalid argument
ls: ./init.environ.rc: Invalid argument
ls: ./metadata: Invalid argument
acct
adb_keys
apex
From strace, it was here:
newfstatat(4, "adb_keys", 0x7fc67eca88, AT_SYMLINK_NOFOLLOW) = -1 EACCES (Permission denied)
readlinkat(4, "adb_keys", 0x5e843c7720, 4095) = -1 EINVAL (Invalid argument)
So stop looking at st.st_mode (and then deciding to do a readlinkat())
if we didn't actually successfully stat().
|
|
|
|
|
|
(Also show unknown values on Linux in hex rather than just "unknown".)
|
|
Major/minor device encoding is not portable. No two BSDs agree with
each other, and Darwin is different again.
Everyone does agree on having major()/minor()/makedev() macros, but
they disagree whether they should be in <sys/types.h> (the BSDs
including Darwin, and old versions of glibc) or <sys/sysmacros.h>
(glibc >= 2.26 and bionic).
This fixes `ls -l /dev/zero` and `stat /dev/zero` on Mac.
|
|
(If DIRTREE_SYMFOLLOW returns ENOENT, skipping the second fstatat() would
also skip the else goto error)
|
|
Includes new tests.
|
|
and #define/#undef a second symbol for the else case.
|
|
|
|
|
|
but --restrict checking should run on the path up to the last component
before unlinking so tar can't be tricked into deleting random files off
the system.
|