History log of /freebsd-14.2/bin/expr/expr.y (Results 1 – 25 of 33)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0
# b3e76948 16-Aug-2023 Warner Losh <[email protected]>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# 41bd31e6 14-Apr-2018 Conrad Meyer <[email protected]>

expr(1): Fix overflow detection when operand is INTMAX_MIN

PR: 227329
Submitted by: Tobias Stoeckmann <tobias AT stoeckmann.org>


Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0
# 8da97f00 27-Jan-2015 Stefan Eßer <[email protected]>

Fix overflow check for multiplication:
- Add special test to detect the case of -1 * INTMAX_MIN
- Protect against elimination of the test division by the optimizer

Garrett Cooper noticed that the ov

Fix overflow check for multiplication:
- Add special test to detect the case of -1 * INTMAX_MIN
- Protect against elimination of the test division by the optimizer

Garrett Cooper noticed that the overflow checks were incomplete, and Bruce
Evans suggested the use of the "volatile" qualifier to counter the effect
of the undefined behaviour, when the prior multiplication caused overflow,
and he also suggested improvements to the comments.

Reviewed by: bde
MFC after: 1 week

show more ...


Revision tags: release/10.1.0, release/9.3.0, release/10.0.0, release/9.2.0, release/8.4.0, release/9.1.0
# fcae0e38 22-May-2012 Kevin Lo <[email protected]>

Remove redundant declaration of yyparse

Reported by: tinderbox


Revision tags: release/8.3.0_cvs, release/8.3.0
# 8c3bbba8 19-Mar-2012 Eitan Adler <[email protected]>

rm[0].rm_so must be zero (an explicit check is made for zero in the
outer if condition)

Reviewed by: se
Approved by: cperciva


Revision tags: release/9.0.0
# 69759f08 09-Jul-2011 Stefan Eßer <[email protected]>

Fix style, since this file has just been touched in a major way.
No actual code changes.


# 6fbe7bf4 09-Jul-2011 Stefan Eßer <[email protected]>

Some refactoring for easier maintenance of the code. This is a follow-up
to re-establishment of 64bit arithmetic, but is committed separately, to
not obscure that conversion. This commit does not cha

Some refactoring for easier maintenance of the code. This is a follow-up
to re-establishment of 64bit arithmetic, but is committed separately, to
not obscure that conversion. This commit does not change the observed
behaviour of expr in any way. Style will be fixed in a follow-up commit.

show more ...


# fa717604 09-Jul-2011 Stefan Eßer <[email protected]>

Make /bin/expr support 64bit numeric range and range checks by default,
again. This brings back the behaviour of expr in FreeBSD-4, which had been
reverted due to an assumed incompatbility with POSIX

Make /bin/expr support 64bit numeric range and range checks by default,
again. This brings back the behaviour of expr in FreeBSD-4, which had been
reverted due to an assumed incompatbility with POSIX.1 for FreeBSD-5.

This issue has been discussed in the freebsd-standards list, and the
consensus was, that POSIX.1 is in fact not violated by this extension,
since it affects only cases of POSIX undefined behaviour (overflow of
signed long).

Other operating systems did upgrade their versions of expr to support
64bit range, after it had been initially brought to FreeBSD. They have
used it for a decade without problems, meanwhile.

The -e option is retained, but it will only select less strict checking
of numeric parameters (leading white-space, leading "+" are allowed and
skipped, an empty string is considered to represent 0 in numeric context.)
The call of check_utility_compat() as a means of establishing backwards
compatibility with FreeBSD-4 is considered obsolete, but preserved in
this commit. It is expected to be removed in a later revision of this
file.
Reviewed by: bde, das, jilles
MFC after: 2 month (those parts that do not violate POLA)

show more ...


Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0, release/8.1.0_cvs, release/8.1.0, release/7.3.0_cvs, release/7.3.0, release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0, release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0, release/7.0.0_cvs, release/7.0.0, release/6.3.0_cvs, release/6.3.0
# e1854a84 18-Feb-2007 Ceri Davies <[email protected]>

Correct typos containing my login name (plus one more in expr.y).
Found courtesy of a recursive grep in the wrong directory.


Revision tags: release/6.2.0_cvs, release/6.2.0, release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0, release/6.0.0_cvs, release/6.0.0, release/5.4.0_cvs, release/5.4.0, release/4.11.0_cvs, release/4.11.0
# 9ddb49cb 10-Jan-2005 Warner Losh <[email protected]>

/*- or .\"- or #- to begin license clauses.


Revision tags: release/5.3.0_cvs, release/5.3.0, release/4.10.0_cvs, release/4.10.0, release/5.2.1_cvs, release/5.2.1, release/5.2.0_cvs, release/5.2.0, release/4.9.0_cvs, release/4.9.0, release/5.1.0_cvs, release/5.1.0, release/4.8.0_cvs, release/4.8.0, release/5.0.0_cvs, release/5.0.0
# c9885518 28-Oct-2002 Garrett Wollman <[email protected]>

Create a small library function, check_utility_compat(3), to determine
whether a named utility should behave in FreeBSD 4.x-compatible mode
or in a standard mode (default standard). The configuratio

Create a small library function, check_utility_compat(3), to determine
whether a named utility should behave in FreeBSD 4.x-compatible mode
or in a standard mode (default standard). The configuration is done
malloc(3)-style, with either an environment variable or a symlink.

Update expr(1) to use this new interface.

show more ...


Revision tags: release/4.7.0_cvs, release/4.6.2_cvs, release/4.6.2, release/4.6.1, release/4.6.0_cvs
# 94a48596 11-May-2002 Garrett Wollman <[email protected]>

EXPR_COMPAT should imply -e, since there is no way to specify it otherwise,
and -e reflects the historic behavior of FreeBSD's expr.


# 1393277e 10-May-2002 Garrett Wollman <[email protected]>

The response to my POSIX interpretation request says that `expr'
is required to be oblivious to overflow and to use the data type `long'.
(Division by zero is undefined in ISO C so it's still OK to c

The response to my POSIX interpretation request says that `expr'
is required to be oblivious to overflow and to use the data type `long'.
(Division by zero is undefined in ISO C so it's still OK to check for it
here.) Add a new `-e' flag to get the old, more useful behavior.

show more ...


# 96ab7da3 22-Apr-2002 Garrett Wollman <[email protected]>

Provide an environment variabloe, EXPR_COMPAT, which disables option
parsing for compatibility with old implementations.


# f07e4247 22-Mar-2002 Garrett Wollman <[email protected]>

Make expr POSIX-compliant, and fix some bugs. Specifically:

- expr must conform to the Utility Syntax Guidelines, so use
getopt() to eat the (non-existent) options.

- Use the Standard type intmax_

Make expr POSIX-compliant, and fix some bugs. Specifically:

- expr must conform to the Utility Syntax Guidelines, so use
getopt() to eat the (non-existent) options.

- Use the Standard type intmax_t for arithmetic.

- If an argument cannot be *completely* converted to an integer, then
it is a string.

Additionally make some style cleanups near the modified lines. This
utility is still not completely style-compliant.

show more ...


Revision tags: release/4.5.0_cvs, release/4.4.0_cvs
# 7669d0fc 02-Feb-2002 Warner Losh <[email protected]>

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int arg

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o gc some #ifdef sun ... #endif code

Approved by: arch@, new style(9)

show more ...


# 3d06e95d 26-May-2001 Kris Kennaway <[email protected]>

Fix warnings to compile with WARNS=2 on i386 and alpha

Reviewed by: bde


Revision tags: release/4.3.0_cvs, release/4.3.0, release/4.2.0, release/4.1.1_cvs, release/4.1.0
# 915198b4 22-Jul-2000 Stefan Eßer <[email protected]>

Add overflow tests


# 64867286 10-Jul-2000 Stefan Eßer <[email protected]>

Extend numeric operations to support 64 bit numbers.


Revision tags: release/3.5.0_cvs, release/4.0.0_cvs, release/3.4.0_cvs, release/3.3.0_cvs
# 2a456239 27-Aug-1999 Peter Wemm <[email protected]>

$Id$ -> $FreeBSD$


Revision tags: release/3.2.0, release/3.1.0, release/3.0.0, release/2.2.8, release/2.2.7, release/2.2.6, release/2.2.5_cvs, release/2.2.2_cvs, release/2.2.1_cvs, release/2.2.0, release/2.1.7_cvs
# b97fa2ef 22-Feb-1997 Peter Wemm <[email protected]>

Revert $FreeBSD$ to $Id$


Revision tags: release/2.1.6_cvs, release/2.1.6.1
# 1130b656 14-Jan-1997 Jordan K. Hubbard <[email protected]>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.

show more ...


Revision tags: release/2.1.5_cvs, release/2.1.0_cvs
# 717252ea 18-Nov-1995 Joerg Wunsch <[email protected]>

Fix my own brokeness for the colon operator, when one of the arguments
was a valid integer. The actual decision between integer and string
is now context-dependant on the operator being used.


# 2a353a9f 04-Aug-1995 Joerg Wunsch <[email protected]>

expr(1) didn't comply to Posix.2 and its own man page: any
comparisions have been made as string comparisions, even in cases
where both operands clearly qualified as integers.

The fix is to make the

expr(1) didn't comply to Posix.2 and its own man page: any
comparisions have been made as string comparisions, even in cases
where both operands clearly qualified as integers.

The fix is to make the parser properly analyzing whether an operand is
a valid integer or not.

show more ...


Revision tags: release/2.0.5_cvs
# 0fd510b7 19-Mar-1995 Joerg Wunsch <[email protected]>

You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.

I (Joerg) finished most of Philippe's cleanup. /bin/sh w

You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.

I (Joerg) finished most of Philippe's cleanup. /bin/sh will still
need *allot* of work, however.

Submitted by: [email protected] (Philippe Charnier)

show more ...


12