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
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
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.
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
* 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
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
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
after allocating a new buffer. This bug caused `tail -r < /dev/null'
to core dump when the `J' malloc option is set, and also affected
any other input that was an exact multiple of 128k.
long -> off_t
strtol -> strtoll
fseek -> fseeko
NOTE: that fseek not works for >long offsets files per POSIX:
[EOVERFLOW] For fseek( ), the resulting file offset would be a value which
cannot be represented correctly in an object of type long.
- Use MAP_FAILED instead of the constant -1 to indicate
failure (required by POSIX).
- Removed flag arguments of '0' (required by POSIX).
- Fixed code which expected an error return of 0.
- Fixed code which thought any address with the high bit set
was an error.
- Check for failure where no checks were present.
Discussed with: bde