| #
6a9452c8
|
| 14-Nov-2025 |
Kyle Evans <kevans@FreeBSD.org> |
lam: fix using stdin more than once
Historically, lam(1) closes stdin once we've hit EOF the first time, which would stop it from doing anything else on subsequent gatherline() calls with another op
lam: fix using stdin more than once
Historically, lam(1) closes stdin once we've hit EOF the first time, which would stop it from doing anything else on subsequent gatherline() calls with another openfile. However, this doesn't seem to be strictly necessary- the EOF flag on FILEs is quite sticky, so we can assume that a subsequent fgetc(stdin) will flag EOF properly.
This 'fixes' the below-referenced commit in the sense that it surfaced this problem as a fatal error, but the issue was pre-existing. If we do `lam - -`, then one gatherline() will fclose(stdin) and set `ip->eof` for *that* openfile, while the next one will then observe that STDIN_FILENO has been closed and turn it into an EBADF.
Add a few tests that were easy to snipe while I'm here, but I haven't aimed for anything close to exhaustive because I think re@ would prefer this fix go in sooner rather than later to land in 15.0.
Minor style adjustment for the previous commit while we're here.
Reported by: cperciva Discussed with: jrtc27 Reviewed by: des, jlduran Fixes: 4472fd66d006 ("lam: fail on I/O errors") MFC after: 3 days (tentative) Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D53750
show more ...
|
| #
4472fd66
|
| 06-Jun-2024 |
Cosimo Cecchi <cosimo@apple.com> |
lam: fail on I/O errors
I/O errors should be reported; however lam currently does not disambiguate between EOF because end-of-file was reached and EOF because an I/O error occurred. This commit chan
lam: fail on I/O errors
I/O errors should be reported; however lam currently does not disambiguate between EOF because end-of-file was reached and EOF because an I/O error occurred. This commit changes lam to exit with EX_IOERR when an I/O error occurs.
Reviewed by: imp, allanjude Sponsored by: Apple Inc. Differential Revision: https://reviews.freebsd.org/D45437
show more ...
|
| #
0b8224d1
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals.
Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require).
Sponsored by: Netflix
show more ...
|
| #
bdcbfde3
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a pe
usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
1d386b48
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
c06e7b66
|
| 07-Nov-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r340126 through r340212.
|
| #
377421df
|
| 04-Nov-2018 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
capsicum: use a new capsicum helpers in tools
Use caph_{rights,ioctls,fcntls}_limit to simplify the code.
|
| #
6a9452c8
|
| 14-Nov-2025 |
Kyle Evans <kevans@FreeBSD.org> |
lam: fix using stdin more than once
Historically, lam(1) closes stdin once we've hit EOF the first time, which would stop it from doing anything else on subsequent gatherline() calls with another op
lam: fix using stdin more than once
Historically, lam(1) closes stdin once we've hit EOF the first time, which would stop it from doing anything else on subsequent gatherline() calls with another openfile. However, this doesn't seem to be strictly necessary- the EOF flag on FILEs is quite sticky, so we can assume that a subsequent fgetc(stdin) will flag EOF properly.
This 'fixes' the below-referenced commit in the sense that it surfaced this problem as a fatal error, but the issue was pre-existing. If we do `lam - -`, then one gatherline() will fclose(stdin) and set `ip->eof` for *that* openfile, while the next one will then observe that STDIN_FILENO has been closed and turn it into an EBADF.
Add a few tests that were easy to snipe while I'm here, but I haven't aimed for anything close to exhaustive because I think re@ would prefer this fix go in sooner rather than later to land in 15.0.
Minor style adjustment for the previous commit while we're here.
Reported by: cperciva Discussed with: jrtc27 Reviewed by: des, jlduran Fixes: 4472fd66d006 ("lam: fail on I/O errors") MFC after: 3 days (tentative) Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D53750
show more ...
|
| #
4472fd66
|
| 06-Jun-2024 |
Cosimo Cecchi <cosimo@apple.com> |
lam: fail on I/O errors
I/O errors should be reported; however lam currently does not disambiguate between EOF because end-of-file was reached and EOF because an I/O error occurred. This commit chan
lam: fail on I/O errors
I/O errors should be reported; however lam currently does not disambiguate between EOF because end-of-file was reached and EOF because an I/O error occurred. This commit changes lam to exit with EX_IOERR when an I/O error occurs.
Reviewed by: imp, allanjude Sponsored by: Apple Inc. Differential Revision: https://reviews.freebsd.org/D45437
show more ...
|
| #
0b8224d1
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals.
Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require).
Sponsored by: Netflix
show more ...
|
| #
bdcbfde3
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a pe
usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
1d386b48
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
c06e7b66
|
| 07-Nov-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r340126 through r340212.
|
| #
377421df
|
| 04-Nov-2018 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
capsicum: use a new capsicum helpers in tools
Use caph_{rights,ioctls,fcntls}_limit to simplify the code.
|
| #
7672a014
|
| 19-Jun-2018 |
Mariusz Zaborski <oshogbo@FreeBSD.org> |
Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.
No functional change intended.
|
| #
82725ba9
|
| 23-Nov-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r325999 through r326131.
|
| #
8a16b7a1
|
| 20-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier f
General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point.
show more ...
|
| #
861152d2
|
| 15-Mar-2017 |
Baptiste Daroussin <bapt@FreeBSD.org> |
Do not die on system built without CAPSICUM
|
| #
348238db
|
| 01-Mar-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r314420 through r314481.
|
| #
fbbd9655
|
| 28-Feb-2017 |
Warner Losh <imp@FreeBSD.org> |
Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is
Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point.
Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
show more ...
|
| #
6ae9acde
|
| 23-Feb-2017 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r313896 through r314128.
|
| #
0064a5b3
|
| 22-Feb-2017 |
Baptiste Daroussin <bapt@FreeBSD.org> |
Better fix for r314098
The actual issue was the fact that if - was used then some restriction were already set to stdin when we were applying caph_limit_stdio which was failing due to the fact the f
Better fix for r314098
The actual issue was the fact that if - was used then some restriction were already set to stdin when we were applying caph_limit_stdio which was failing due to the fact the fd was the fd was already restricted to lower rights.
Restricting stdio before actually opening the files prevent trying to raise the right and fixes the issue.
And this allows to keep failing the program if restriction failed
Approved by: allanjude Differential Revision: https://reviews.freebsd.org/D9723
show more ...
|
| #
e872af3a
|
| 22-Feb-2017 |
Allan Jude <allanjude@FreeBSD.org> |
lam(1): Failing to restrict stdin/stdout/stderr should not be fatal
When fed from a pipe, lam(1) would sometimes fail: lam: unable to limit stdio: Capabilities insufficient
fixed regression in port
lam(1): Failing to restrict stdin/stdout/stderr should not be fatal
When fed from a pipe, lam(1) would sometimes fail: lam: unable to limit stdio: Capabilities insufficient
fixed regression in portsnap(8) introduced in r313938
This broke portsnap(8), the app that the capsicumization of lam(1) was meant to secure.
# portsnap fetch update Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found. Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... done. Fetching snapshot metadata... done. Updating from Tue Feb 21 16:05:39 MSK 2017 to Tue Feb 21 16:59:30 MSK 2017. Fetching 5 metadata patches.lam: unable to limit stdio: Capabilities insufficient done. Applying metadata patches... done. Fetching 5 metadata files... lam: unable to limit stdio: Capabilities insufficient /usr/sbin/portsnap: cannot open 8c94d2c3f8fcea20eb1fd82021566c99c63a010e6b3702ee11e7a491795bcfb8.gz: No such file or directory metadata is corrupt.
Reported by: Vladimir Zakharov <zakharov.vv@gmail.com>, Ben Woods <woodsb02@gmail.com>
show more ...
|
| #
ba032055
|
| 19-Feb-2017 |
Allan Jude <allanjude@FreeBSD.org> |
Capsicum-ize lam(1)
lam(1) is used in portsnap(8), so lock it down
Reviewed by: emaste, cem, jonathan Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D8076
|
| #
8fa0b743
|
| 23-Jan-2012 |
Xin LI <delphij@FreeBSD.org> |
IFC @230489 (pending review).
|