aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/lam
Commit message (Collapse)AuthorAgeFilesLines
* lam: fix using stdin more than onceKyle Evans2025-11-144-4/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* lam: fail on I/O errorsCosimo Cecchi2024-06-061-0/+4
| | | | | | | | | | | 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
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-9/+0
| | | | | | | | | | | 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
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-273-6/+0
| | | | | | | | 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
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+1
|
* The lam(1) man page is unclear about the uppercase versions of the flagsAllan Jude2019-01-041-10/+24
| | | | | | | | PR: 229571 Submitted by: Tim Chase <freebsd@tim.thechases.com> Notes: svn path=/head/; revision=342754
* capsicum: use a new capsicum helpers in toolsMariusz Zaborski2018-11-041-2/+1
| | | | | | | Use caph_{rights,ioctls,fcntls}_limit to simplify the code. Notes: svn path=/head/; revision=340138
* Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.Mariusz Zaborski2018-06-191-1/+1
| | | | | | | No functional change intended. Notes: svn path=/head/; revision=335395
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-05-091-0/+1
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=318000
* Do not die on system built without CAPSICUMBaptiste Daroussin2017-03-151-1/+2
| | | | Notes: svn path=/head/; revision=315309
* Renumber copyright clause 4Warner Losh2017-02-282-2/+2
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314436
* Better fix for r314098Baptiste Daroussin2017-02-221-1/+2
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314099
* lam(1): Failing to restrict stdin/stdout/stderr should not be fatalAllan Jude2017-02-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=314098
* Capsicum-ize lam(1)Allan Jude2017-02-191-0/+20
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=313938
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-271-1/+3
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | Fix missing AUTHOR section for jot(1), rs(1), and lam(1)Allan Jude2015-04-071-1/+3
|/ | | | | | | | | | | | PR: 196786 Differential Revision: https://reviews.freebsd.org/D2115 Submitted by: John A. Kunze (Author) Approved by: wblock (mentor) MFC after: 1 week Sponsored by: ScaleEngine Inc. Notes: svn path=/head/; revision=281209
* Mark global functions and/or variables in lam(1) static where possible.Ed Schouten2011-11-061-5/+5
| | | | | | | This allows compilers and static analyzers to more thorough analysis. Notes: svn path=/head/; revision=227240
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-112-8/+0
| | | | | | | | | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Also add $FreeBSD$ to a few files to keep svn happy. Discussed with: imp, rwatson Notes: svn path=/head/; revision=216370
* ANSIfy various tools in usr.bin/.Ed Schouten2010-01-021-1/+1
| | | | | | | | Most of these tools properly build at WARNS=6, except for their K&R function declarations. Fix this, so we can bump WARNS as well. Notes: svn path=/head/; revision=201382
* Document that jot(1), rs(1), and lam(1) first appeared in 4.2BSD.Colin Percival2006-10-201-0/+5
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=163515
* Call usage() instead of being insolent.Juli Mallett2005-08-051-5/+4
| | | | Notes: svn path=/head/; revision=148713
* Document incorrect handling of multibyte characters.Tim J. Robbins2004-08-121-1/+5
| | | | Notes: svn path=/head/; revision=133561
* Avoid passing negative values to tolower() on machines with signed chars.Tim J. Robbins2004-07-191-1/+1
| | | | Notes: svn path=/head/; revision=132404
* Back out my minorly disputed and possibly not well thought out changes to howJuli Mallett2002-07-011-7/+7
| | | | | | | arguments are processed, at least temporarily. Notes: svn path=/head/; revision=99221
* Consistently use FBSDIDDavid E. O'Brien2002-06-301-2/+2
| | | | Notes: svn path=/head/; revision=99112
* Increment morefiles, balance braces. This should really be using getopt(3).Juli Mallett2002-06-271-2/+3
| | | | Notes: svn path=/head/; revision=98934
* Instead of not using argc and doing other great evil, check for no argumentsJuli Mallett2002-06-271-5/+6
| | | | | | | | in main() and print usage, or if there are too many arguments, handle that there, too. Notes: svn path=/head/; revision=98933
* Use `The .Nm utility'Philippe Charnier2002-04-201-3/+4
| | | | Notes: svn path=/head/; revision=95124
* Remove leaf node WARNS?=2 (that mainly I added). This shouldMark Murray2002-02-081-1/+0
| | | | | | | help the GCC3 transition and CURRENT in general. Notes: svn path=/head/; revision=90415
* Cross-reference between lam(1) and paste(1). Add a STANDARDS section toGarrett Wollman2001-09-211-1/+9
| | | | | | | | | | lam(1) indicating that paste(1) is a standard way to do some of the same things. MFC after: 1 week Notes: svn path=/head/; revision=83745
* Constify, staticize, and set WARNS=2.Mike Barcroft2001-08-062-9/+11
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=81222
* Remove whitespace at EOL.Dima Dorfman2001-07-151-2/+2
| | | | Notes: svn path=/head/; revision=79755
* mdoc(7) police: use the default ``file ...'' feature of the .Ar macro.Ruslan Ermilov2001-02-131-2/+2
| | | | Notes: svn path=/head/; revision=72432
* Fix style(9) bugs from previous commit: remove space after functionMike Heffner2001-02-081-6/+6
| | | | | | | | | names and revert to char *[]. bde by: bde, imp Notes: svn path=/head/; revision=72178
* De-__P()-ify, convert K&R style declarations to ANSI onesMike Heffner2001-02-081-13/+8
| | | | Notes: svn path=/head/; revision=72153
* Prevent string overflows by using safer string functionsMike Heffner2001-02-081-21/+27
| | | | | | | | | | | | Use tolower() rather than bit or-ing Sanity check user specified printf() format Exit when too many input files are given Remove register from variables Reviewed by: markm, imp Notes: svn path=/head/; revision=72152
* mdoc(7) police: split punctuation characters + misc fixes.Ruslan Ermilov2001-02-011-5/+5
| | | | Notes: svn path=/head/; revision=71895