| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
cut_main 1388 1402 +14
packed_usage 34934 34933 -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-1) Total: 13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
cut_main 1339 1391 +52
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
cut_main 1261 1353 +92
packed_usage 34925 34901 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 92/-24) Total: 68 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
cut_main 1204 1261 +57
static.cut_longopts - 20 +20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 77/0) Total: 77 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
cut_main 1228 1201 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 0068ce2fa (cut: add toybox-compatible options -O OUTSEP,
-D, -F LIST) added detection of reversed ranges. Further
improvements are possible.
- The test for reversed ranges compared the start after it had been
decremented with the end before decrement. It thus missed ranges
of the form 2-1.
- Zero isn't a valid start value for a range. (Nor is it a valid
end value, but that's caught by the test for a reversed range.)
- The code
if (!*ltok)
e = INT_MAX;
duplicates a check that's already been made.
- Display the actual range in the error message to make it easier
to find which range was at fault.
function old new delta
.rodata 100273 100287 +14
cut_main 1239 1237 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-2) Total: 12 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Using cut with the delimiter flag ("-d") with the "-s" flag to only
output lines containing the delimiter will print blank lines. This is
deviant behavior from cut provided by GNU Coreutils. Blank lines should
be omitted if "-s" is used with "-d".
This change introduces a somewhat naiive, yet efficient solution, where
line length is checked before looping though bytes. If line length is
zero and the "-s" flag is used, the code will jump to parsing the next
line to avoid printing a newline character.
function old new delta
cut_main 1196 1185 -11
Signed-off-by: Colin McAllister <colinmca242@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix bug introduced in busybox 1.37.0 that broke kernel builds.
Fixes commit e2287f99fe6f (od: for !DESKTOP, match output more closely
to GNU coreutils 9.1, implement -s)
function old new delta
rewrite 967 976 +9
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When text is inserted by insertLine() the lines following the
insertion are moved down and the insertion point is made the new
current line. To avoid too much scanning of the linked list of
lines setCurNum() may use the position of the old current line to
determine the location of the new current line.
If the insertion point is before the old current line in the file
the latter will have been moved down, so its line pointer needs to
be adjusted.
function old new delta
insertLine 162 180 +18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 18/0) Total: 18 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The command 'cut -b 3-2' failed to detect that the bounds were
incorrectly ordered, though the check worked when the difference
between the bounds was larger.
The comparison was made after the lower bound has been decremented
but before the upper bound had.
Adds 0-16 bytes.
(GitHub issue #467)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The POSIX standard allows inference rules to be redefined but not
the .DEFAULT rule. There is no explicit exception for .DEFAULT to:
Only one target rule for any given target can contain commands.
Treat redefinition of a .DEFAULT rule as an error in POSIX mode
but allow it as an extension.
Also, the code didn't allow an inference rule with dependencies to
redefine an existing inference rule. This is no longer the case.
Adds 64-96 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit e90345c10 (make: allow empty commands) rearranged readline()
in a way that broke the use of conditionals within the definition
of a rule.
Add a test case to detect this. Adjust readline() so that
conditionals are processed before returning command lines or
checking for empty lines and comments.
Remove the test for a leading tab in skip_lines(). This allows
conditionals in the definition of a rule to be indented with a
leading tab.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
GNU make doesn't allow inference rules or the .DEFAULT target to
be used for phony targets.
POSIX is unclear on the matter but there doesn't seem to be an
explicit prohibition of inference rules or .DEFAULT.
Follow the GNU make behaviour as a non-POSIX extension.
Adds 48-80 bytes.
(pdpmake GitHub issue 56)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
pdpmake didn't allow rules to have empty commands. There are
circumstances where this may be useful.
Make the following changes:
- Add a flag to readline() to indicate the next line is expected
to be a command. If this flag is true and the input line starts
with a tab return it immediately, thus skipping the check for
an empty line or comment line.
- In docmds() skip tabs and spaces after a command prefix. If the
resulting command is empty don't print it or try to execute it.
- In newcmd() allow empty commands.
Adds 48-96 bytes.
(pdpmake GitHub issue 56)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When text is inserted by insertLine() the lines following the
insertion are moved down and the insertion point is made the new
current line. To avoid too much scanning of the linked list of
lines setCurNum() may use the position of the old current line to
determine the location of the new current line.
If the insertion point is before the old current line in the file
the latter will have been moved down, so its line pointer needs to
be adjusted.
(GitHub issue #431)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| | |
Something is fishy with constrcts like "3==v=3" in gawk,
they should not work, but do. Ignore those for now.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that POSIX.1-2024 has been released we can replace all
references to the 202X draft standard with 2024.
Make this change throughout the code and testsuite.
The pragma 'posix_2024' has been added. 'posix_202x' remains as
an alias for the same.
The 2024 standard is enforced by default in POSIX mode.
|
| |
| |
| |
| |
| |
| | |
The test 'Complex chain of macro assignments' relies on recursive
macro expansion. This is a POSIX 202X feature, so the test should
be moved to the appropriate section of the test script.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit d6b764116 (make: fix detection of target rules) checked
for target rules before macro assignments. This failed for some
Makefiles generated by autotools because partially defined macros
were expanded while testing for a target rule.
Revert to checking for macro assignments first, but try to detect
if the proposed left hand side of the assignment might form part
of a target rule with an inline command.
Also handle the case where the ';' separator of the inline command
has been obfuscated by putting it in a macro.
Saves 128-160 bytes.
(GitHub pdpmake issues 31, 44)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
GNU make and bmake have different implementations for := macro
assignment. In POSIX 202X these are supported by the forms ::=
and :::= respectively. Only the former was supported on the
pdpmake command line.
Add the required support in process_macros() and update the usage
message.
Adds 48-64 bytes.
|
| |
| |
| |
| |
| | |
The test 'Return error if command fails' needed an exit code of 2.
POSIX only requires an exit code greater than 0.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The -q option returns an exit status to indicate if targets are
up-to-date (0) or in need of updating (1) but without updating
them. As an exception (imported from GNU make) build commands
with a '+' prefix are executed.
pdpmake didn't implement the exception. Doing so required moving
handling of the -q option down into docmds().
Saves 48 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The -t option (in general) causes targets to be touched instead of
having build commands run to create them. There were two problems.
The flag variable 'ssilent' in docmds was too small (uint8_t) to
contain the value of 'dotouch' (uint32_t). Truncation of the
value resulted in build commands being echoed when they shouldn't
have been.
The POSIX specification is unclear as to how build commands with
a '+' prefix interact with touch. The rationale indicates that
this feature was imported from GNU make, so the behaviour has been
made to match what it does: if a '+' build command is run the
target is not touched.
The code has been rearranged to move the call to touch() up into
docmds().
Adds 48 bytes.
|
| |
| |
| |
| |
| |
| | |
A couple of tests require backslashes to be escaped.
The test for CURDIR should use 'pwd -P' to resolve symlinks.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add support for the conditional directives ifeq and ifneq.
These follow GNU make in allowing things like:
ifeq (arg1,arg2)
ifeq 'arg1' 'arg2'
In the second case single or double quotes may be used.
Macros are expanded in the two arguments and the resulting strings
are compared.
Adds 240-248 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
POSIX only requires $< and $* to be set for inference rules, not
target rules.
As an extension allow them to be set for target rules, as in
GNU make. This may or may not be useful.
In POSIX mode, when $< and $* are only set for inference rules,
they're set to an empty string for target rules. This avoids
the possibility of stale values being used.
Adds 64-80 bytes.
(GitHub issue #407)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Austin Group defect report 1626 introduced support for the CURDIR
macro:
https://www.austingroupbugs.net/view.php?id=1626
Implement this as a POSIX 202X feature.
Adds 160-176 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
POSIX requires macro definitions to appear before targets on the
command line. Allow mixed macros and targets as an extension.
All macros on the command line are read first, then the targets
are processed.
Costs 64-80 bytes.
(GitHub issue #406)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
POSIX says, regarding execution of commands:
The execution line shall then be executed by a shell as if it
were passed as the argument to the system() interface, except
that if errors are not being ignored then the shell -e option
shall also be in effect.
As a non-POSIX extension, skip the use of the -e option. This is
how GNU make and BSD make behave.
(GitHub issue #409)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
POSIX doesn't allow the '#' comment marker to be escaped, though
some implementations do.
As a non-POSIX extension allow '#' to be escaped with a preceding
backslash.
It isn't necessary to escape '#' in macro expansions or command
lines: these cases are covered by an existing extension. Commit
0aceca867 (make: comments in macro expansions and command lines)
Adds 16-32 bytes.
(pdpmake GitHub issue 38)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
time_main 1217 1316 +99
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Patch by M Rubon <rubonmtz@gmail.com>:
Busybox awk handles references to empty (not provided in the input)
fields differently during the first line of input, as compared to
subsequent lines.
$ (echo a ; echo b) | awk '$2 != 0' #wrong
b
No field $2 value is provided in the input. When awk references field
$2 for the "a" line, it is seen to have a different behaviour than
when it is referenced for the "b" line.
Problem in BusyBox v1.36.1 embedded in OpenWrt 23.05.0
Same problem also in 21.02 versions of OpenWrt
Same problem in BusyBox v1.37.0.git
I get the correct expected output from Ubuntu gawk and Debian mawk,
and from my fix.
will@dev:~$ (echo a ; echo b) | awk '$2 != 0' #correct
a
b
will@dev:~/busybox$ (echo a ; echo b ) | ./busybox awk '$2 != 0' #fixed
a
b
I built and poked into the source code at editors/awk.c The function
fsrealloc(int size) is core to allocating, initializing, reallocating,
and reinitializing fields, both real input line fields and imaginary
fields that the script references but do not exist in the input.
When fsrealloc() needs more field space than it has previously
allocated, it initializes those new fields differently than how they
are later reinitialized for the next input line. This works fine for
fields defined in the input, like $1, but does not work the first time
when there is no input for that field (e.g. field $99)
My one-line fix simply makes the initialization and clrvar()
reinitialization use the same value for .type. I am not sure if there
are regression tests to run, but I have not done those.
I'm not sure if I understand why clrvar() is not setting .type to a
default constant value, but in any case I have left that untouched.
function old new delta
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a build command fails and the '-k' option (continue on error)
is in effect, no further commands should be executed for the
current target.
Also, the resulting diagnostic should be reported to stderr. As
should the final 'not built due to errors' diagnostic.
Adds 80 bytes.
(pdpmake GitHub issue 35)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add option to change the running directory before starting the process.
This can be done using -d or --chdir options. Add also test cases to
start-stop-daemon to test out the directory change option.
function old new delta
packed_usage 34602 34648 +46
start_stop_daemon_main 1107 1130 +23
start_stop_daemon_longopts 156 164 +8
.rodata 105382 105384 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 79/0) Total: 79 bytes
Signed-off-by: ejaaskel <esa.jaaskela@suomi24.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The presence of an equal sign in an inline command on a target
rule caused the line to be detected as a macro assignment.
For example:
target:; @echo a = $(a)
Rearrange input parsing so target rules are detected before macro
assignments. This is made more complex by having to allow for the
':=', '::=' and ':::=' assignment operators. (And for targets
containing colons on Windows.)
Costs 240-248 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a build command returned a non-zero exit status 'make'
reported a warning and returned an exit code of zero.
This was due to the misuse of the status returned by system(3).
As the man page says:
the return value is a "wait status" that can be examined using
the macros described in waitpid(2). (i.e., WIFEXITED(),
WEXITSTATUS(), and so on).
Use the error() function to correctly report the problem on stderr
and return an exit status of 2.
Some additional changes in the same area:
- When a target is removed report the diagnostic on stderr, as
required by POSIX.
- When a build command receives a signal GNU make removes the target.
bmake doesn't and it isn't required by POSIX. Implement this as an
extension.
- Expand the error message when a build command fails so it includes
the exit status or signal number, as obtained from the value
returned by system(3).
- Alter the WIN32 implementation of system(3) to handle exit codes
which represent termination as if by a signal.
Adds 200-240 bytes.
(GitHub issue #354)
|
| |
| |
| |
| | |
Add a test for the problem reported in -w32 GitHub issue #354.
|
| |
| |
| |
| |
| | |
The testsuite includes some Windows-specific tests. Exclude these
when running a test on a native build to avoid upsetting the results.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The changes introduced to support the --binary option gave incorrect
results when comparing files with CRLF line endings *without* the
--binary option present.
The code needs to keep track of the position within the file and is
confused by text mode.
As an alternative solution, always use binary mode but skip the CR
of a CRLF pair when the --binary option isn't used. This gives
results matching GNU diff when comparing files with matching line
endings, with or without --binary. When line endings differ the
results aren't always the same.
Costs 32 bytes in the 32-bit build, saves 16 in 64-bit.
(GitHub issue #348)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
REG_STARTEND)
function old new delta
awk_sub 637 714 +77
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
awk_sub 559 544 -15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Discovered while adding code to disallow assignments to non-lvalues
function old new delta
parse_expr 936 991 +55
.rodata 105243 105247 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 59/0) Total: 59 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
awk_split 543 544 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
.rodata 105255 105252 -3
od_main 1917 1901 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|