Age | Commit message (Collapse) | Author |
|
(ls would read from an uninitalized variable and never use the result because
the test is afterwards, but asan freaks about impurity and unclean quantum
state that's never observed or some such. You read uninitialized but
definitely allocated stack memory into a REGISTER, and then performed
an ADDITION on it to produce a result you never use! For SHAME!)
|
|
The filter() function modifies st_blocks so it's always 1KiB rather than
512B blocks, but the human-readable output was still assuming 512B. This
meant that `ls -sh` was showing figures half the size of `ls -s`, and
that the "total" line with -h was also off by a factor of 2.
No new test, because I don't know how to write one that would work on
all file systems.
Bug: http://b/153383721
|
|
This only touches 24 of the 68 toys/posix/ files --- the others were
already canonical.
Potentially contentious, so worth stating explicitly, is that there
were 8 matches for "COMMAND..." amongst all existing help output,
with 7 matches for various inconsistent variants involving something
with "ARG", so I resolved that in favor of using "COMMAND..." (which
is also shorter overall, and avoids nested []s).
|
|
bionic works around the fact that you can't use an O_PATH fd with
fgetxattr(2), but glibc doesn't.
Fixes https://github.com/landley/toybox/issues/158.
|
|
but the problem is some vertical sort arrangements are impossible, and that's
what it was testing for. For example, showing 29 entries in 9 columns with
horizontal sort requires 4 rows:
1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18
19 20 21 22 23 24 25 26 27
29 29 x x x x x x x
But with vertical sort that would be:
1 5 9 13 17 21 25 29 x
2 6 10 14 18 22 26 x x
3 7 11 15 19 23 27 x x
4 8 12 16 20 24 28 x x
It still doesn't fit in 3 rows (3x9=27) but with 4 rows the 7 leftover spaces
eats a whole column, so you _can't_ have 9 columns with vertical sort.
|
|
in whitespace accounting, eliminate lastcol, same sort[next] in dt, don't
count trailing whitespace on last entry in row.
|
|
variable declarations go at the start of blocks, and remove specific
people's names from todo items (anybody can do any todo).
|
|
When in modes `-C` and `-x` we need to remove the trailing whitespace
on each line. This is the behavior of other `ls` commands.
Other `ls` commands will print the last filename and then print a
newline. Prior to this patch we would print the last filename, followed
by two spaces, and then print a newline.
Previously, we would get to the end of the loop and print the padding.
I couldn't figure out a way to determine when the program had reached
the end of a line. So I piggybacked off of the newline code.
|
|
|
|
We need two spaces between filenames because that is the convention
followed by other implementations. More importantly, if we do not have
two spaces, certain Unicode file names cause filenames to run together.
In Unicode, combining characters come before the character they modify.
If a filename ends in a combining character, the combining character
attaches to the space that follows it, causing the space not to be
visible. Having a two-space gap stops the above issue from happening.
For context and a bit more information, see mailing list link below.
https://www.mail-archive.com/toybox@lists.landley.net/msg05986.html
|
|
When user builds toybox CFG_TOYBOX_I18N disabled and tries to list
folder contents with multibyte characters other than UTF-8 ls might
seqfault since wcrtomb returns -1
while locale set to fi_FI-UTF-8 disable CFG_TOYBOX_I18N
touch őőőőaaőő
ls
|
|
Two more spacing bugs here, one before the security context for -Z, and
one after the size with --full-time.
Before:
$ ./toybox ls -lZ --full-time Config.
-rw-r----- 1 enh primarygroup? 56162019-09-07 21:09:32.892215100 -0700 Config.in
After:
$ ./toybox ls -lZ --full-time Config.
-rw-r----- 1 enh primarygroup ? 5616 2019-09-07 21:09:32.892215100 -0700 Config.in
|
|
This broke a netd test (but sadly in postsubmit rather than presubmit).
Also add a trivial test that would at least have caught this bug.
Bug: http://b/140453237
|
|
|
|
Commit c26870dab3462c6176936384b090df6b9ba46dee broke ls' error
reporting for files that don't exist. `ls $F` is used by some as an
equivalent of `test -e $F`.
This patch also adds a regression test.
|
|
Tweak DIRTREE_STATLESS so it returns zero stat for any error (I'm testing
that dev, ino, and blksize are all zero), and fill in file type from readdir()
|
|
|
|
More consistent tense, capitalization, and punctuation. A few commands were
missing an introductory line, so I copied those from the first comment
line.
|
|
|
|
|
|
(Well, when you say --color or "alias ls='ls --color=auto'" in your shell.)
|
|
|
|
(And, for some reason, timezone. Individual files have timezones?)
|
|
|
|
|
|
While we're at it, ls -m wordwrap was one column early.
|
|
|
|
|
|
|
|
The recent refactoring broke ls -lh by multiplying all sizes by 0
rather than 1.
|
|
(Two spaces padding between columns, and -k is hardwired on.)
|
|
(We should use xprintf and similar to flush and check if stdout went away
once per line. No point flushing partway through a line, so in ls only use it
on things outputting a newline char.)
|
|
-h should apply to -s too. (Previously it only applied to the "total"
line in -s output.)
|
|
of number, but never NULL. Both returned in static buffer good through
next call.)
|
|
|
|
|
|
|
|
handle infinite depth. Fix docs, tweak dirtree_handle_callback() semantics,
remove dirtree_start() and don't export dirtree_handle_callback(), instead
offer dirtree_flagread(). (dirtree_read() is a wrapper around dirtree_flagread
passing 0 for flags.)
|
|
major/minor/makedev, but glibc has vowed to break existing programs
(https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html)
and replace it with _another_ non-standard header (not in posix or lsb),
so let's just add functions to lib/ that do the transform ourselves.
|
|
(because ls uses nonstandard directory recursion which collates all the
command line arguments under a fake top node, which needs more thorough
initialization).
|
|
|
|
checking, and fix up format checking complaints.
Added out(type, value) function to stat to avoid a zillion printf typecasts.
|
|
|
|
Valgrind complains that we add uninitalized memory to totals[] fields we never
read from. (If we didn't set it in entrylen() we don't use it during display,
they're testing the same flags), but valgrind doesn't understand that.
|
|
|
|
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.
|
|
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.
|
|
Right-aligned looks pretty good to me, but it's not what anyone else does.
|
|
It's user then group, not the other way round.
|