History log of /src/bin/expr/expr.y |
Revision | | Date | Author | Comments |
1.55 |
| 29-Jun-2025 |
rillig | expr: use characters instead of bytes for ":" and "length"
Required by POSIX.
|
1.54 |
| 12-Apr-2025 |
rillig | expr: sort grammar rules by operator precedence
For easier reading; no functional change intended.
|
1.53 |
| 15-Mar-2025 |
rillig | expr: ensure that the result of '|' is never empty
Required by POSIX since at least 2004.
|
1.52 |
| 15-Mar-2025 |
rillig | expr: only skip '--' once
|
1.51 |
| 15-Mar-2025 |
rillig | expr: clean up
|
1.50 |
| 15-Mar-2025 |
rillig | expr: don't evaluate irrelevant conditions
|
1.49 |
| 15-Mar-2025 |
rillig | expr: clean up grammar and code
|
1.48 |
| 15-Mar-2025 |
rillig | expr: extract expression evaluation functions from the grammar
|
1.47 |
| 14-Mar-2025 |
rillig | expr: fix out-of-bounds memory read for empty command line argument
|
1.46 |
| 11-Jun-2020 |
kamil | branches: 1.46.8; Fix typo
|
1.45 |
| 27-Jun-2018 |
kamil | branches: 1.45.2; Add a missing check to handle correctly 0 * 0 in expr(1)
|
1.44 |
| 27-Jun-2018 |
kamil | Improve the * operator handling in expr(1)
Fixes overflow detection in expressions INT * -UINT.
Detected with libFuzzer & UBSan.
|
1.43 |
| 14-Jun-2018 |
christos | remove notreached
|
1.42 |
| 14-Jun-2018 |
christos | return to caller instead of exit(2)
|
1.41 |
| 13-Jun-2018 |
kamil | Detect properly overflow in expr(1) for 0 + INT
|
1.40 |
| 12-Jun-2018 |
kamil | Rework perform_arith_op() in expr(1) to omit Undefined Behavior
The current implementation of operations - + * / % could cause Undefined Behavior and in narrow cases (INT64_MIN / -1 and INT64_MIN % -1) SIGFPE and crash duping core.
Detected with MKSANITIZER enabled for the Undefined Behavior variation: # eval expr '4611686018427387904 + 4611686018427387904' /public/src.git/bin/expr/expr.y:315:12: runtime error: signed integer overflow: 4611686018427387904 + 4611686018427387904 cannot be represented in type 'long'
All bin/t_expr ATF tests pass now in a sanitized userland.
Sponsored by <The NetBSD Foundation>
|
1.39 |
| 05-Sep-2016 |
sevan | branches: 1.39.12; Drop main() prototype.
|
1.38 |
| 15-Mar-2012 |
joerg | Add __printflike attribution to use vprintf and friends with an argument as format string.
|
1.37 |
| 25-Aug-2011 |
joerg | branches: 1.37.2; Mark yyerror as dead.
|
1.36 |
| 20-Jan-2009 |
joerg | Revert for now, pending discussion of how expr should behave in the case of pre-POSIX expressions.
|
1.35 |
| 20-Jan-2009 |
joerg | SUS says that expr must support "--" to prevent interpretation of negative numbers as options.
|
1.34 |
| 30-Apr-2008 |
martin | Normalize TNF license, move to 2 clause.
|
1.33 |
| 17-Mar-2006 |
rumble | branches: 1.33.18; Handle asprintf failing to allocate.
|
1.32 |
| 01-Jun-2005 |
lukem | appease gcc -Wuninitialized
|
1.31 |
| 20-Apr-2004 |
jdolecek | add support for 'length' keyword, for compatibility with GNU expr
|
1.30 |
| 20-Mar-2004 |
jdolecek | explicitly use REG_BASIC when calling regcomp(3), instead of 0
|
1.29 |
| 14-Feb-2003 |
grant | 'NetBSD.org'
|
1.28 |
| 16-Sep-2001 |
wiz | Use {g,s}etprogname, and some other KNF stuff. Patch by Petri Koistinen.
|
1.27 |
| 06-May-2001 |
jmc | Various cleanups/fixes. Change the add/subtract overflow checks to use an unsigned to do the op and then cast back into the signed var to check the signs.
Make multiply shortcut on either right or left being 0. Make multiply's overflow test not fail on simple cases like 1 * -1 Make the multiple overflow test pass all the regress tests.
|
1.26 |
| 05-May-2001 |
jmc | Various changes to fix bugs in PR bin/12838.
Make sure all precendence is spelled out correctly (comparison does not have the same level as the arithmetic operators..) Break the arithemtic operators into 2 classes (+- are lower than */%) Restructure the arithmetic code into a function either class above can call. Finally, add a whole suite of regression tests (checked in separately) which the previous code failed on 3 of them.
|
1.25 |
| 25-Apr-2001 |
simonb | Spell occurred correctly.
|
1.24 |
| 04-Feb-2001 |
christos | remove redundant declaration of yyparse
|
1.23 |
| 30-Oct-2000 |
jdolecek | add a hack to properly handle '--' as first argument - it's ignored if it would cause syntax error, otherwise treated as common string; this is so that both 'expr -- : .' and 'expr -- foo : .' works This addresses standards/11230 by Ben Harris.
while here, make all global variables but main() static, use const more
|
1.22 |
| 29-Oct-2000 |
thorpej | The "&" operator has a higer precedence than "|".
|
1.21 |
| 27-Oct-2000 |
jdolecek | also credit J.T. Conklin in copyright message
|
1.20 |
| 26-Oct-2000 |
jdolecek | fix operator precedence - | or & have lower priority than arithmetic operations, compare, or : This should fix bin/11318 by Love <lha@stacken.kth.se>
|
1.19 |
| 29-Sep-2000 |
jdolecek | in regexp handling code, fix the format passed to asprintf() to be actually in intended form - use "%.*s" and not incorrect "%*s"
Bug found by Launey Thomas <ljt@alum.mit.edu> and reported in private e-mail.
|
1.18 |
| 21-Sep-2000 |
jdolecek | Fix bug in regexp handling, caused not quite complete conversion from old expr.c. This fixes PR # 11060.
While here, convert the code to use asprintf() instead of strdup() followed by truncating of new string and move definition of errstr to block where it's used.
|
1.17 |
| 19-Sep-2000 |
jdolecek | reimplement expr using lexical parser generated by yacc highlights: * / is treated correctly depending upon context (addresses PR # 10995) * use 64 bit arithmetic, so expr is able to process integer values from -(2**63) to (2**63 - 1) * checks for integer over- & underflows added * error messages improved, more error checking added
add AUTHOR section to manpage add BUGS section, and mention possible drawbacks with other expr implementations
XXX the old expr treated empty string in arithmetic expressions as if it was 0 XXX this behaviour has been retained
|
1.16 |
| 16-Jul-1994 |
mycroft | Clean up deleted files.
|
1.15 |
| 10-Jul-1994 |
cgd | don't forget a cast, and thereby fix the regexp problems on big-endian machines
|
1.14 |
| 16-Nov-1993 |
jtc | branches: 1.14.2; Fix insignificant memory leak.
|
1.13 |
| 04-Oct-1993 |
jtc | Allow expressions like "expr 'ABC' : '^.*$' to work as is done in other expr implementations.
|
1.12 |
| 14-Sep-1993 |
jtc | Fix grammar to eliminate support for unary minus expressions -- they weren't supported, they aren't standard, and they caused expr to dump core.
|
1.11 |
| 17-Aug-1993 |
jtc | Use err() routine for error messages. If string does not match \( \) subexpression, return a null string.
|
1.10 |
| 16-Aug-1993 |
jtc | expr is supposed to do string comparisons using the locale specific collation sequence, so use strcoll instead of strcmp.
|
1.9 |
| 20-Jul-1993 |
jtc | Now truely POSIX 1003.2 (D11.2) compliant.
|
1.8 |
| 20-Jul-1993 |
jtc | Don't coerce strings to int in comparisons.
|
1.7 |
| 20-Jul-1993 |
jtc | integer arguments were not coerced to strings for the `:' operator. bad things: core dumps, etc. will happen if integer values make it up the parse tree.
|
1.6 |
| 14-Jun-1993 |
jtc | Updated to POSIX regular expression routines. (Previous checkin was aborted by stray ^C)
|
1.5 |
| 05-Jun-1993 |
cgd | update for latest version of patches from jtconklin@kaleida.com
|
1.4 |
| 23-Mar-1993 |
cgd | added J.T. Conklin's changes to get parens working fine, etc.
|
1.3 |
| 23-Mar-1993 |
cgd | changed "Id" to "Header" for rcsids
|
1.2 |
| 22-Mar-1993 |
cgd | added rcs ids to all files
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.14.2.1 |
| 10-Jul-1994 |
cgd | fix regexp problems. from trunk.
|
1.33.18.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.37.2.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.39.12.2 |
| 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.39.12.1 |
| 25-Jun-2018 |
pgoyette | Sync with HEAD
|
1.45.2.2 |
| 21-Apr-2020 |
martin | Ooops, restore accidently removed files from merge mishap
|
1.45.2.1 |
| 21-Apr-2020 |
martin | Sync with HEAD
|
1.46.8.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|