Age | Commit message (Collapse) | Author |
|
Inspired by some of the small patches that have gone by recently.
Limited to only things found in `generated/help.h`, plus a wider cleanup
for the more common "milisecond" typo.
|
|
Very few places actually check for errors from emit, and I actually see
the same endless loop from "sed (GNU sed) 4.4" on current Debian, so I'm
not sure this isn't Broken As Designed, but an endless loop spewing
"short write" (or saying nothing, in the case of GNU sed) really doesn't
feel like useful behavior in face of EPIPE, which really isn't going to
fix itself. Certainly not being able to run the sed tests to completion
is pretty annoying --- which is why, unless we remove this test as
invalid, we should probably also add a SKIP_HOST=1 to the "b loop" test.
Note that even with this fix you'll see the error twice:
sed: short write: Broken pipe
sed: short write: Broken pipe
Once from the first = command to fail, and then another from the !FLAG(n)
flush of the pattern space.
|
|
The test for \N where N was larger than the number of capturing groups
in the regular expression was incorrect, and firing for cases such as
matching __(ARM_)?NR_([a-z]*) against __NR_read, where the first group is
empty (because it failed to match) but the second group did match "read".
Use regex_t's re_nsub for the error check, and treat rm_so == -1 as a
signal to just copy nothing into the result.
(Found trying to build minijail in AOSP.)
|
|
|
|
|
|
Used to construct SELinux policies in the AOSP build.
I left loopfiles_lines with its hard-coded '\n' because although cut(1)
also has a -z option, I can't find any case where it's used in any of
the codebases searchable by me. (And fmt(1), the other user, doesn't
even have the option.) YAGNI.
Bug: http://b/122744241
|
|
For a definition of "fix" that's even _more_ of a deviation from posix, but
matches what debian does...
|
|
|
|
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
|
|
adjusting existing users.
|
|
|
|
|
|
Say "toybox" before version string. Tweak sed to preserve lie-to-autoconf.
|
|
Or more accurately, s@[[:space:]@]@replace@ which can't treat the @ in
[] as a delimiter but has to know about nested [[]] to make that decision.
|
|
|
|
|
|
add xopenro() that takes one argument and understands "-" means stdin,
and switch over lots of users.
|
|
|
|
|
|
|
|
|
|
|
|
effect of "sed -e 'a\'" with no trailing line). But there's an actual user,
and it's not hard to implement, and it's not hard to implement, and there
isn't an obvious _other_ way to do it, so add the behavior and a test for it.
Fix some bad/missing comments while I was there, and add a couple TODOs.
|
|
Found by afl-fuzz.
|
|
It uses a sed expression that assumes you can escape - to use it as a literal
(you can't, it has to be first or last char of the range), and assumes
you have to escape delimiters in sed [] context (you don't), and/or that
non-printf escapes become the literal character (they don't, the backslash
is preserved as a literal), meaning it winds up doing "s/[\-\]//" which is
a length 1 range, which is officially undefined behavior according to posix,
and regcomp errors out.
But if we don't accept it (like other implementations do) the perl build
breaks. So collapse [A-A] into just [A].
Testcae taken from perl 5.22.0 file Makefile.SH line 8.
(While we're at it, remove an unused argument from a function.)
|
|
clang scan-build flags up this line as being unread, so clearing from code.
|
|
|
|
|
|
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.
|
|
|
|
(If a flag is 1, you can multiply it by the value you want and get that value
else zero without a branch or conditional assignment.) So move -E one to the
left so FLAG_r is 1 again, and add a [+Er] suffix instead of testing
FLAG_r | FLAG_E in the users.
|
|
an int. Even though long _is_ 32 bits on a 32 bit systems, gcc warns about it because reasons.
Also, the warning being that "expects int, but type is wchar_t"... no, type
is not wchar_t. Type is probably long. Specify the ACTUAL TYPE, not the random
typedef alias for it. If the translated type _did_ match, there wouldn't
be a warning! (This is why c89 promoted all arguments to int, precisely
so this wasn't a problem.)
|
|
GNU sed silently supports -E as an alias for -r too.
|
|
The problem was that readline() was returning a newline at the end of each
string, which wasn't getting stripped in the parser and thus \ wasn't at the
end of a line for -f, it was escaping a literal newline, so the continuation
logic didn't trigger. Remove some redundant null checks while we're at it,
and don't bother terminating a string we don't return (yes we leak memory
in an error path, but it's about to error_exit() anyway).
|
|
resume position, so the script would restart from beginning.
|
|
without a \ escaping the newline.
|
|
|
|
|
|
the same command.)
|
|
|
|
|
|
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
|
|
FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
|
|
|
|
|