summaryrefslogtreecommitdiff
path: root/usr.bin/tail
Commit message (Collapse)AuthorAgeFilesLines
* Use -F instead of -f in tail(1) examplesMateusz Piotrowski2020-03-221-2/+2
| | | | | | | | | | | | | | | There is an example in tail(1) manual page explaining how to use tail(1) to track the contents of /var/log/messages. The example uses the -f flag to follow the file. The problem with the -f flag is that it cannot handle the situation where /var/log/messages is rotated. Hence, use -F instead in the example. Reviewed by: asomers MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D24157 Notes: svn path=/head/; revision=359229
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+2
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* Add Makefile.depend.optionsSimon J. Gerraty2019-12-111-0/+8
| | | | | | | | | | | | | | | | | | | | Leaf directories that have dependencies impacted by options need a Makefile.depend.options file to avoid churn in Makefile.depend DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc can be set in local.dirdeps-options.mk which can add to those set in Makefile.depend.options See share/mk/dirdeps-options.mk Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22469 Notes: svn path=/head/; revision=355616
* Fix tail -f in capability mode.Mark Johnston2019-12-061-5/+8
| | | | | | | | | | | | | | We were not adding CAP_EVENT to input file capabilities, so kevent() always failed with ENOTCAPABLE. tail implements a fallback mode to poll the file in this case, so the failure was not apparent. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22709 Notes: svn path=/head/; revision=355470
* fileargs_init() sets errno on failure.Mark Johnston2019-11-061-1/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354368
* tail: fix the checks if the file was rotatedMariusz Zaborski2019-06-096-11/+31
| | | | | | | | | | | | | | | | | The freopen(3) was replaced with fileargs_open(3) and fclose(3). In the following function, we skip if the stream is standard in, so it is safe to do so. This also requires us to change the logic first to open the file and then check its status. The stat(2) is disallowed in capability mode. This commit unbrakes the -F option. The bug was introduced in the r348708. Reported by: pho Tested by: pho Notes: svn path=/head/; revision=348842
* tail: style nitsMariusz Zaborski2019-06-091-1/+2
| | | | Notes: svn path=/head/; revision=348833
* tail: disable capsicum in rescue modeMariusz Zaborski2019-06-051-1/+1
| | | | | | | | | All rescue application are not capsicumized. Reported by: jenkins Notes: svn path=/head/; revision=348711
* tail: fix style nit introduced in the r348708Mariusz Zaborski2019-06-051-1/+0
| | | | Notes: svn path=/head/; revision=348710
* tail: capsicumizeMariusz Zaborski2019-06-052-2/+30
| | | | | | | | Submitted by: Nik Sultana <sultana@seas.upenn.edu> Differential Revision: https://reviews.freebsd.org/D20393 Notes: svn path=/head/; revision=348708
* Drop "All rights reserved" from the files I ownAlan Somers2019-03-111-1/+2
| | | | | | | | | Also, add SPDX tags where needed. MFC after: 2 weeks Notes: svn path=/head/; revision=345034
* tail(1): Address mandoc concern (space before punctuation after macro)Kyle Evans2018-04-101-1/+1
| | | | | | | X-MFC-With: r332372 Notes: svn path=/head/; revision=332373
* tail(1): Add some long optionsKyle Evans2018-04-102-5/+15
| | | | | | | | | | | | Add --blocks, --bytes, and --lines long options for -b, -c, and -n respectively. This improves tail(1)'s compatibility with its GNU counterpart in a straightforward way. Reviewed by: eadler (earlier version) MFC after: 3 days Notes: svn path=/head/; revision=332372
* tail: fix "tail -r" for piped input that begins with '\n'Alan Somers2018-02-192-2/+49
| | | | | | | | | | | | | | A subtle logic bug, probably introduced in r311895, caused tail to print the first two lines of piped input in forward order, if the very first character was a newline. PR: 222671 Reported by: Jim Long <freebsd-bugzilla@umpquanet.com>, pprocacci@gmail.com MFC after: 3 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=329606
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-206-0/+12
| | | | | | | | | | | | | | | | | 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: Connect new directories.Bryan Drewery2017-10-311-0/+11
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Unbreak :broken_pipeEnji Cooper2017-09-091-4/+4
| | | | | | | | | - Capture exit code in pipeline and test in output. - Drop awk use in favor of `sleep 2`. This helps guarantee the EPIPE behavior without the potential race. Notes: svn path=/head/; revision=323348
* Check result of seq call and save output via atf_check -oEnji Cooper2017-09-091-1/+1
| | | | | | | | This ensures that seq outputting to ints will not fail as silently if there's an error. Notes: svn path=/head/; revision=323345
* tail(1): Do not print bogus errno stringConrad Meyer2017-09-012-3/+23
| | | | | | | | | | | | | | | | In the case where write(2) does not return -1, it does not initialize errno. This can happen when a broken pipe causes a short write. I attempted to adapt the submitted test case to ATF but could not figure out how to make the test run in the ATF environment. So the aborted test is left disabled, in case someone would like to run it manually or fix it. PR: 221976 Submitted by: <martin AT lispworks.com> (earlier version) Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323123
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Renumber copyright clause 4Warner Losh2017-02-287-7/+7
| | | | | | | | | | | | 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
* Fix build of usr.bin/tail with GCCAlan Somers2017-01-111-7/+11
| | | | | | | | | | | Submitted by: pluknet Reported by: pluknet MFC after: 27 days X-MFC-with: 311895 Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=311928
* Fix memory leaks during "tail -r" of an irregular fileAlan Somers2017-01-104-77/+309
| | | | | | | | | | | | | | | | | * Rewrite r_buf to use standard tail queues instead of a hand-rolled circular linked list. Free dynamic allocations when done. * Remove an optimization for the case where the file is a multiple of 128KB in size and there is a scarcity of memory. * Add ATF tests for "tail -r" and its variants. Reported by: Valgrind Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9067 Notes: svn path=/head/; revision=311895
* Misc Coverity fixes for tail(1)Alan Somers2017-01-041-1/+8
| | | | | | | | | | | | | CID 1006402: Initialize stack variable CID 271580: Don't leak memory when ENOMEM. Reported by: Coverity CID: 271580 1006402 MFC after: 4 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=311340
* 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
| * 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
| * Merge from headSimon J. Gerraty2013-09-054-5/+18
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=255263
| * sync from headSimon J. Gerraty2013-04-121-1/+12
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=249429
| * | 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 with HEAD.David E. O'Brien2013-02-081-3/+2
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * | | 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
* | | | Print file names without stdio buffering to avoid mixing buffered andJaakko Heinonen2013-06-094-5/+18
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | unbuffered ouput. PR: bin/176886 Reviewed by: mjg Notes: svn path=/head/; revision=251565
* | | Remove EOL whitespace accidentally introduced in r248393.Joel Dahl2013-03-171-1/+1
| | | | | | | | | | | | Notes: svn path=/head/; revision=248414
* | | Add a couple of examples.Joel Dahl2013-03-161-1/+12
| |/ |/| | | | | | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=248393
* | Use calloc() to get zeroed memory.Xin LI2013-01-081-3/+2
|/ | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=245184
* Add missing static keywords to tail(1)Ed Schouten2011-11-062-4/+4
| | | | Notes: svn path=/head/; revision=227184
* tail: Fix crash if -F'ed file's filesystem disappears.Jilles Tjoelker2011-08-141-2/+4
| | | | | | | | | | | | | | | | If tail notices that a file it is following no longer exists (because stat() fails), it will output any final lines and then close the file. If the read operation also causes an error, such as when the filesystem is forcefully unmounted, it closes the file as well, leading to fclose(NULL) and a segmentation fault. PR: bin/159750 Submitted by: swills Approved by: re (kib) MFC after: 1 week Notes: svn path=/head/; revision=224865
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-117-28/+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
* Build usr.bin/ with WARNS=6 by default.Ed Schouten2010-01-021-1/+0
| | | | | | | Also add some missing $FreeBSD$ to keep svn happy. Notes: svn path=/head/; revision=201386
* 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
* Use our canonical .Dd format.Christian Brueffer2009-11-021-1/+1
| | | | | | | Submitted by: Ulrich Spoerlein Notes: svn path=/head/; revision=198788
* Change the behaviour of -F slightly; it now persists (forever) inBrian Somers2009-06-057-107/+144
| | | | | | | | | | | | | | | | | | | | | trying to open files rather than giving up when it encounters an error. ENOENT errors are not reported. As a result, files that are moved away then recreated are not at risk of being 'lost' to tail. Files that are recreated and temporarily have unreadable permissions will be shown when they are fixed. This behaviour is consistent with the GNU version of tail but without the verbiage that goes with the GNU version. This change also fixes error messages accompanying -f and -F. They no longer report problems with (null)! MFC after: 3 weeks Notes: svn path=/head/; revision=193488
* Nuking the temporary pointer once it is properly tracked in local storage.Tai-hwa Liang2007-11-221-0/+1
| | | | | | | | | | | | | | | | This should fix the double free() bug where there's no tailing newline(\n) character: current# echo -n test | tail testAssertion failed: (run->magic == ARENA_RUN_MAGIC), function arena_dalloc, file /usr/src/lib/libc/stdlib/malloc.c, line 2448. Abort (core dumped) Reviewed by: kib MFC after: 3 days Notes: svn path=/head/; revision=173838
* initialize variables, WARNS=6 compliantPhilippe Charnier2007-11-023-1/+3
| | | | Notes: svn path=/head/; revision=173285
* Fix various memory leaks.Konstantin Belousov2007-10-171-3/+13
| | | | | | | | | Submitted by: rdivacky Obtained from: OpenBSD MFC after: 1 week Notes: svn path=/head/; revision=172719