History log of /openbsd-current/usr.bin/less/ch.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.23 14-Apr-2024 guenther

Delete support for the LESSOPEN and LESSCLOSE environment variables
aka the "Input Preprocessor": it's been a source for multiple
security bugs in the past as everything has to deal with handling
arbitrary filenames and generally resulted in multiple TOCTOU issues.
The base system never included a default LESSOPEN setting like some
Linux distributions did, but it's a suds-filled sink full of knives
to try to use safely.

ok tb@ deraadt@ millert@


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.22 07-Aug-2021 schwarze

Bugfix:
Delete ugly and incorrect workaround for a Linux kernel bug.
If a file is temporarily empty, that by no means implies
it might be permanently non-seekable.

Patch from seL4 at disroot dot org on tech@.
OK both Theos: tb@ and deraadt@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.21 03-Sep-2019 deraadt

less uses a correct raceless signal method of indicating signal events in
a volatile sig_atomic_t variable, and then processing events in the mainloop.
But only one variable was used for 3 signals, with |= bit operations which
are signal interruptable! Rewrite the code to use 3 independent variables
and cleanup how the mainloop observes indications.
ok schwarze


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.20 17-Mar-2018 krw

Fix use after free that caused the creation of a spurious file.

As guenther@ said "fix whatever led to the \337 x 16 crap".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 17-Sep-2016 deraadt

little bit more KNF


Revision tags: OPENBSD_6_0_BASE
# 1.18 16-Mar-2016 mmcc

style(9) includes

ok nicm@


# 1.17 16-Mar-2016 mmcc

Wrap a macro's args in parentheses. No binary change.

I'm discussing with deraadt@ whether it's a good idea to convert some of
these to functions. The one changed by this commit probably isn't
eligible because it defines only a for loop's condition, but many others
in less(1) should probably be converted.

ok millert@


Revision tags: OPENBSD_5_9_BASE
# 1.16 27-Dec-2015 mmcc

Put macro arg in parentheses.

ok nicm@


# 1.15 09-Nov-2015 deraadt

use (off_t)-1 rather than a BAD_LSEEK wrapper


# 1.14 09-Nov-2015 deraadt

error() is not a stdarg function, so there is no reason for NULL_PARG
to be special. Simply use NULL.


# 1.13 06-Nov-2015 nicm

Garrett D'Amore has agreed to moving his copyright line up above the
terms with the existing copyright, so it is clear it applies the same
terms.


# 1.12 05-Nov-2015 tedu

deregister


# 1.11 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.9 21-Sep-2011 millert

Use volatile sig_atomic_t, not int, for the sigs variable. Also
move the call to bell() out of u_interrupt() (a signal handler).
OK and with help from deraadt@


# 1.8 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.7 02-Apr-2006 deraadt

use SEEK_* for lseek()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.6 06-Aug-2003 millert

Remove some double semicolons (hmm, do two semis equal a maxi?).
I've skipped the GNU stuff for now. From Patrick Latifi.


# 1.5 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.4 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.3 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


# 1.22 07-Aug-2021 schwarze

Bugfix:
Delete ugly and incorrect workaround for a Linux kernel bug.
If a file is temporarily empty, that by no means implies
it might be permanently non-seekable.

Patch from seL4 at disroot dot org on tech@.
OK both Theos: tb@ and deraadt@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.21 03-Sep-2019 deraadt

less uses a correct raceless signal method of indicating signal events in
a volatile sig_atomic_t variable, and then processing events in the mainloop.
But only one variable was used for 3 signals, with |= bit operations which
are signal interruptable! Rewrite the code to use 3 independent variables
and cleanup how the mainloop observes indications.
ok schwarze


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.20 17-Mar-2018 krw

Fix use after free that caused the creation of a spurious file.

As guenther@ said "fix whatever led to the \337 x 16 crap".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 17-Sep-2016 deraadt

little bit more KNF


Revision tags: OPENBSD_6_0_BASE
# 1.18 16-Mar-2016 mmcc

style(9) includes

ok nicm@


# 1.17 16-Mar-2016 mmcc

Wrap a macro's args in parentheses. No binary change.

I'm discussing with deraadt@ whether it's a good idea to convert some of
these to functions. The one changed by this commit probably isn't
eligible because it defines only a for loop's condition, but many others
in less(1) should probably be converted.

ok millert@


Revision tags: OPENBSD_5_9_BASE
# 1.16 27-Dec-2015 mmcc

Put macro arg in parentheses.

ok nicm@


# 1.15 09-Nov-2015 deraadt

use (off_t)-1 rather than a BAD_LSEEK wrapper


# 1.14 09-Nov-2015 deraadt

error() is not a stdarg function, so there is no reason for NULL_PARG
to be special. Simply use NULL.


# 1.13 06-Nov-2015 nicm

Garrett D'Amore has agreed to moving his copyright line up above the
terms with the existing copyright, so it is clear it applies the same
terms.


# 1.12 05-Nov-2015 tedu

deregister


# 1.11 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.9 21-Sep-2011 millert

Use volatile sig_atomic_t, not int, for the sigs variable. Also
move the call to bell() out of u_interrupt() (a signal handler).
OK and with help from deraadt@


# 1.8 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.7 02-Apr-2006 deraadt

use SEEK_* for lseek()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.6 06-Aug-2003 millert

Remove some double semicolons (hmm, do two semis equal a maxi?).
I've skipped the GNU stuff for now. From Patrick Latifi.


# 1.5 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.4 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.3 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


# 1.21 03-Sep-2019 deraadt

less uses a correct raceless signal method of indicating signal events in
a volatile sig_atomic_t variable, and then processing events in the mainloop.
But only one variable was used for 3 signals, with |= bit operations which
are signal interruptable! Rewrite the code to use 3 independent variables
and cleanup how the mainloop observes indications.
ok schwarze


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.20 17-Mar-2018 krw

Fix use after free that caused the creation of a spurious file.

As guenther@ said "fix whatever led to the \337 x 16 crap".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 17-Sep-2016 deraadt

little bit more KNF


Revision tags: OPENBSD_6_0_BASE
# 1.18 16-Mar-2016 mmcc

style(9) includes

ok nicm@


# 1.17 16-Mar-2016 mmcc

Wrap a macro's args in parentheses. No binary change.

I'm discussing with deraadt@ whether it's a good idea to convert some of
these to functions. The one changed by this commit probably isn't
eligible because it defines only a for loop's condition, but many others
in less(1) should probably be converted.

ok millert@


Revision tags: OPENBSD_5_9_BASE
# 1.16 27-Dec-2015 mmcc

Put macro arg in parentheses.

ok nicm@


# 1.15 09-Nov-2015 deraadt

use (off_t)-1 rather than a BAD_LSEEK wrapper


# 1.14 09-Nov-2015 deraadt

error() is not a stdarg function, so there is no reason for NULL_PARG
to be special. Simply use NULL.


# 1.13 06-Nov-2015 nicm

Garrett D'Amore has agreed to moving his copyright line up above the
terms with the existing copyright, so it is clear it applies the same
terms.


# 1.12 05-Nov-2015 tedu

deregister


# 1.11 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.9 21-Sep-2011 millert

Use volatile sig_atomic_t, not int, for the sigs variable. Also
move the call to bell() out of u_interrupt() (a signal handler).
OK and with help from deraadt@


# 1.8 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.7 02-Apr-2006 deraadt

use SEEK_* for lseek()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.6 06-Aug-2003 millert

Remove some double semicolons (hmm, do two semis equal a maxi?).
I've skipped the GNU stuff for now. From Patrick Latifi.


# 1.5 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.4 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.3 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_3_BASE
# 1.20 17-Mar-2018 krw

Fix use after free that caused the creation of a spurious file.

As guenther@ said "fix whatever led to the \337 x 16 crap".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 17-Sep-2016 deraadt

little bit more KNF


Revision tags: OPENBSD_6_0_BASE
# 1.18 16-Mar-2016 mmcc

style(9) includes

ok nicm@


# 1.17 16-Mar-2016 mmcc

Wrap a macro's args in parentheses. No binary change.

I'm discussing with deraadt@ whether it's a good idea to convert some of
these to functions. The one changed by this commit probably isn't
eligible because it defines only a for loop's condition, but many others
in less(1) should probably be converted.

ok millert@


Revision tags: OPENBSD_5_9_BASE
# 1.16 27-Dec-2015 mmcc

Put macro arg in parentheses.

ok nicm@


# 1.15 09-Nov-2015 deraadt

use (off_t)-1 rather than a BAD_LSEEK wrapper


# 1.14 09-Nov-2015 deraadt

error() is not a stdarg function, so there is no reason for NULL_PARG
to be special. Simply use NULL.


# 1.13 06-Nov-2015 nicm

Garrett D'Amore has agreed to moving his copyright line up above the
terms with the existing copyright, so it is clear it applies the same
terms.


# 1.12 05-Nov-2015 tedu

deregister


# 1.11 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.9 21-Sep-2011 millert

Use volatile sig_atomic_t, not int, for the sigs variable. Also
move the call to bell() out of u_interrupt() (a signal handler).
OK and with help from deraadt@


# 1.8 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.7 02-Apr-2006 deraadt

use SEEK_* for lseek()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.6 06-Aug-2003 millert

Remove some double semicolons (hmm, do two semis equal a maxi?).
I've skipped the GNU stuff for now. From Patrick Latifi.


# 1.5 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.4 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.3 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 17-Sep-2016 deraadt

little bit more KNF


Revision tags: OPENBSD_6_0_BASE
# 1.18 16-Mar-2016 mmcc

style(9) includes

ok nicm@


# 1.17 16-Mar-2016 mmcc

Wrap a macro's args in parentheses. No binary change.

I'm discussing with deraadt@ whether it's a good idea to convert some of
these to functions. The one changed by this commit probably isn't
eligible because it defines only a for loop's condition, but many others
in less(1) should probably be converted.

ok millert@


Revision tags: OPENBSD_5_9_BASE
# 1.16 27-Dec-2015 mmcc

Put macro arg in parentheses.

ok nicm@


# 1.15 09-Nov-2015 deraadt

use (off_t)-1 rather than a BAD_LSEEK wrapper


# 1.14 09-Nov-2015 deraadt

error() is not a stdarg function, so there is no reason for NULL_PARG
to be special. Simply use NULL.


# 1.13 06-Nov-2015 nicm

Garrett D'Amore has agreed to moving his copyright line up above the
terms with the existing copyright, so it is clear it applies the same
terms.


# 1.12 05-Nov-2015 tedu

deregister


# 1.11 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.10 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.9 21-Sep-2011 millert

Use volatile sig_atomic_t, not int, for the sigs variable. Also
move the call to bell() out of u_interrupt() (a signal handler).
OK and with help from deraadt@


# 1.8 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.7 02-Apr-2006 deraadt

use SEEK_* for lseek()


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.6 06-Aug-2003 millert

Remove some double semicolons (hmm, do two semis equal a maxi?).
I've skipped the GNU stuff for now. From Patrick Latifi.


# 1.5 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.4 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.3 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision