Age | Commit message (Collapse) | Author |
|
As with ls, it doesn't seem like -Z should be guarded behind LSM
availability. On a non-SELinux system, the label is always "unconfined".
|
|
Used by Android.
|
|
(Matches beginning and EOF at once.)
|
|
|
|
This lets '(x)\1' match, as reported by Isabella Parakiss.
|
|
an extra newline because the test for whether we have an existing string to
append a newline to was checking if struct step had data appended to it,
and the /x/ regex is data appended to it. Change test to check for null
terminator at ->arg1 offset.
|
|
|
|
inspired by:
https://android-review.googlesource.com/#/c/152663/4/libc/bionic/fgetxattr.cpp
|
|
Also, if you mkdir "$(echo -e "one\ntwo"); chmod -r one*; ls -q one*
it honors -q.
|
|
the global so "install -g 0" doesn't alias to "cp --preserve 0" and error out.
through to --preserve 0"
|
|
On Android, the filesystem column is pretty wide. Actually measure the widths.
|
|
|
|
Adds XVFORK() macro, teaches xpopen_both() to call /proc/self/exe with NULL
argv (and converts cpio -p to use that), adds TOYBOX_FORK guards to some
unconverted commands.
|
|
Note: vfork(), like fork(), can return -1 if too many processes, and
we should notice and fail loudly.
|
|
Elliott Hughes found a bug https://android-review.googlesource.com/#/c/170020/
and Daniel K. Levy worked out the problem: the user/group/newer arguments
to find weren't consuming their arguments when not checking the results of
their comparison (because an earlier test had already caused their
parenthetical group to fail). This confused the argument parsing logic
and could lead to segfaults.
I applied a different fix that reorganized the existing tests instead of
adding a new test. (Looks like a big commit but it's mostly whitespace
due to extra curly brackets changing indendentation levels.)
|
|
|
|
|
|
This fixes the build break, the change to yesno() prototype accidentally got
checked in last commit. (Oops, sorry.)
|
|
and update the tests.
|
|
It turns out that people are anticipating the switch to toybox ls from
toolbox ls on the assumption that this will finally bring -h support.
Let's not disappoint.
I've merged two existing buffers in listfiles whose uses didn't
overlap into one. It may be possible to cram this into toybuf with the
other stuff, but it didn't seem worth the extra complexity for 64B of
stack, especially since we were already living with that for time
formatting anyway.
|
|
This doesn't address the lack of support for a variable-width
"Filesystems" column, but it doesn't make the current situation any
worse either.
This is the last of the missing -h options. The other commands with -h
also have --si, but only for df did it get a corresponding short
option (and I've never personally used --si on du or ls, so let's wait
until someone actually cares).
|
|
Right-aligned looks pretty good to me, but it's not what anyone else does.
|
|
We need to remove the destination, not the source, to be able to overwrite.
|
|
Now that the kernel's 128k environment size has been lifted, it might be
possible to feed in a gigabyte of suffix so argv[2] is enough larger than
argv[1] that char *s decrements past NULL and points to arbitrary high
memory (I.E. strlen(suffix) > (long)base), at which point the base > s
test is defeated and we strcmp() against a wild pointer.
Which is read only anyway and on 64 bit you probably couldn't hit any
interesting addresses, but the fix is easy enough: compare strlen values
instead of pointers. So do that instead.
|
|
|
|
Correctly and portably check for non-normal dates, and explicitly show
the "before" and "after" dates (in the format of the user's choosing).
Clear the struct tm in date_main rather than parse_default because on
one path the struct tm is actually initialized. Explicitly clear the
tm_sec field in parse_default because -- experiment shows -- that
should not be preserved. Only do the "what does this 2-digit year
mean?" dance if we actually parsed a 2-digit year. Show the right
string in the error message if strptime fails.
Also add more tests, and use UTC in the tests to avoid flakiness.
|
|
uninitialized trash in struct tm fields could segfault glibc's strftime().
|
|
looks like. dd uses "7 MB" where du uses "7M", for example. this patch
adds flags, similar to the BSD humanize_number. most callers will pass 0.
|
|
It's user then group, not the other way round.
|
|
not stomping on gnu's "an extra argument tells it to set the time so let's
add -s to do the same thing" extension).
Nanoseconds aren't uniformly supported by these apis, so had to stick it in
GLOBALS() and pull it out later. Awkward, open to suggestions for a better way.
(Also, the setting API is microseconds, not nanoseconds. Collect nano, convert
to micro so we can switch APIs later without changing date's external UI again.)
Oh, and shrink really_long_name_mktime() with a for() loop (and rename it)
although I may go back and redo that for portability to hypothetical libraries
if I can convert this mess to struct timespec with proper nanoseconds support.
But that needs an extended strptime() which needs an extended struct tm,
and between us and that is convincing posix computers got fast enough to
care about fractions of a second.
(Yes, I'm aware gnu added %N to date without adding it to strptime, implying
they reimplemented strptime longhand inside date. I'm not doing that.)
|
|
Humans get upset when date(1) lets mktime(3) work out what the 99th day
of the 99th month would be rather than rejecting the invalid date. For
the subtly wrong cases, rather than get into the leap year business,
let's rely on localtime_r(3).
|
|
|
|
|
|
|
|
|
|
-inum is a commonly implemented extension to search by inode number.
Linux's fs-layer tracepoints log many events in terms of inodes, so
"find -inum" is useful for mapping those events back to specific files.
|
|
|
|
|
|
Can't say I'm happy with the API (-z and -Z to keep them independent would
be nice), but compatibility with what exists trumps having a good API...
|
|
There's a nanoseconds field value that says use current time, which I set
but forgot to clear in the right places. (Oops.)
|
|
|
|
The most likely reason for setfscreatecon to fail is that you don't have permission, and that's reported by the write return EACCES. There isn't really a "bad" context; they're just strings.
Before:
$ adb shell mkdir -Z x y
mkdir: bad -Z 'x'
After:
$ adb shell mkdir -Z x y
mkdir: -Z 'x' failed: Permission denied
Other than this, the ToT mkdir works fine with SELinux.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
to greppable TODO annotations in the individual files. (grep -riw TODO)
|
|
Doing a world writeable mkdir and _then_ adding a label seems like a race
window, so set the global "create stuff with these labels" context, then
do the creates.
|