aboutsummaryrefslogtreecommitdiff
path: root/bin/cat
Commit message (Collapse)AuthorAgeFilesLines
* bin/cat: add test for reading data from stdinK Rin2025-06-131-0/+1
| | | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1671 Closes: https://github.com/freebsd/freebsd-src/pull/1671
* cat: report copy_file_range() errors with the read filenameKyle Evans2024-12-141-1/+1
| | | | | | | | | | | | | | | | | | The error may be due to an error while writing, but it's more helpful to report what we were trying to from rather than "stdout" for these errors. Noticed because of what happens now when `cat` gets an EISDIR for reading from a dirfd: kevans@ifrit:~$ cat /etc cat: stdout: Is a directory which, after this change, becomes: kevans@aarch64-dev:~$ cat /etc cat: /etc: Is a directory Reviewed by: allanjude, des, mm Differential Revision: https://reviews.freebsd.org/D41784
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+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
* cat: Missed a couple.Dag-Erling Smørgrav2024-05-101-3/+3
| | | | | MFC after: 3 days Sponsored by: Klara, Inc.
* cat: Check for lack of success rather than a specific failure.Dag-Erling Smørgrav2024-05-101-5/+5
| | | | | | | MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D45149
* cat: fix cap_rights_init usageEd Maste2024-02-151-1/+1
| | | | | | | | | Capability rights passed to cap_rights_* are not simple bitmaks and cannot be ORed together in general (although it will work for certain subsets of rights). PR: 277057 Reported by: asomers, markj
* cat: Use present tenseZhan-Wei2023-12-261-1/+1
| | | | | | Event: Advanced UNIX Programming Course (Fall23) at NTHU. Reviewed by: imp, lwhsu Pull Request: https://github.com/freebsd/freebsd-src/pull/923
* cat(1): Fix typoKai-Yang Chen2023-12-261-1/+1
| | | | | | | | Fix type: rebiuld -> rebuild in Makefile Event: Advanced UNIX Programming Course (Fall’23) at NTHU. Reviewed by: imp, Mina Galić Pull Request: https://github.com/freebsd/freebsd-src/pull/933
* bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-10/+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
* 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
* cat: fallback on EISDIR with copy_file_range(2)Martin Matuska2023-11-191-1/+2
| | | | | | | | The filesystem may support reading directories directly when security.bsd.allow_read_dir is set. MFC after: 1 week PR: 275099
* cat: add CAP_SEEK capabilityMariusz Zaborski2023-09-281-1/+1
| | | | | | | The copy_file_range might require that. Reviewed by: emaste, theraven, kib, markj Differential Revision: https://reviews.freebsd.org/D41967
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-164-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* cat: fallback on EBADF with copy_file_range(2)Martin Matuska2023-07-081-1/+1
| | | | When stdout is opened with O_APPEND, copy_file_range(2) fails with EBADF.
* cat: use copy_file_range(2) with fallback to previous behaviorMartin Matuska2023-07-081-0/+25
| | | | | | | | This allows to use special filesystem features like server-side copying on NFS 4.2 or block cloning on OpenZFS 2.2. Reviewed by: imp, rmacklem Differential revision: https://reviews.freebsd.org/D40882
* cat: ensure serrno is always setAlfonso Gregory2023-07-071-25/+29
| | | | | | | | Set serrno to errno before the loop begins for the edge case that res0 is immediately NULL. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/724
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+4
|
* cat: style nitsMariusz Zaborski2021-01-201-1/+1
| | | | Pointed out by: jhb
* cat: depend on Makefile to rebuild when WITH_CASPER changesEd Maste2021-01-171-0/+2
| | | | | | | We try to ensure building WITHOUT_CLEAN (or -DNO_CLEAN) works on an ongoing basis. b7ab6832cd98 changed cat to build w/o -DWITH_CASPER by default; add a cat.o dependency on the Makefile so that it gets rebuilt.
* cat: disable building it with CasperMariusz Zaborski2021-01-171-6/+7
| | | | | | | We want to measure what are the actual cost of sandboxing cat(1). Requested by: mjg, cy, Mike Karels Discussed with: rwatson, markj
* cat: style nitsMariusz Zaborski2021-01-161-2/+2
|
* cat: persistent errnoMariusz Zaborski2021-01-161-1/+10
| | | | | | | | | There is no guarantee that after close(2)/free the errno will remain persistent. The caller of the udom_open function depends on the errno for reporting errors. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D28185
* cat: Fix potential memory leakMariusz Zaborski2021-01-151-0/+1
| | | | This was introduced in aefe30c5437159a5399bdbc1974d6fbf40f2ba0f.
* cat: capsicumize itMariusz Zaborski2021-01-152-4/+92
| | | | | Reviewed by: markj, arichardson Differential Revision: https://reviews.freebsd.org/D28083
* Fix all warnings emitted in `make kernel-toolchain`Alex Richardson2021-01-071-1/+5
| | | | | | | | With this change and D27598 make kernel-toolchain no longer emits any warnings for me. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D27599
* Allow building bin/cat on non-FreeBSD systemsAlex Richardson2020-01-162-2/+26
| | | | | | | | | | | | | `cat -l` is needed during the installworld phase and other system's cat don't support that flag. To avoid portability issues when compiling on Linux/macOS (such as the the direct access to &fp->_mbstate), we disable the entire multibyte support when building as a boostrap tool. Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D13939 Notes: svn path=/head/; revision=356791
* stddef.h is not used by cat.c, remove the include.Xin LI2018-01-071-1/+0
| | | | Notes: svn path=/head/; revision=327672
* Sanity check sysconf return value to ensure it's positive before weWarner Losh2018-01-061-3/+7
| | | | | | | | | | use it. Use proper cast to convert long to size_t (instead of blksize_t) to preclude sign extension issues. CID: 1193754 Notes: svn path=/head/; revision=327618
* Fix mandoc -Tlint warnings in bin/Benjamin Kaduk2017-12-071-2/+2
| | | | | | | | | | | Many style-level issues are still reported. Submitted by: Yuri Pankov <yuripv@gmx.com> Reviewed by: jilles (previous revision) Differential Revision: https://reviews.freebsd.org/D13334 Notes: svn path=/head/; revision=326651
* 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
* Ammend bin/cat/cat.c so the output is the same asideSevan Janiyan2017-09-212-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | from blank lines being numbered or unnumbered, depending on whether cat was invoked with -ne or -be. At present, when cat is invoked with -be, there is an aditional difference that the '$' on blank lines is placed on the far left of the output. Discussed in bug 210607. While here, revert the workaround from r304035 which skipped the unit test for this issue previously. PR: 210607 Submitted by: myself Reviewed by: bdrewery Obtained from: NetBSD Relnotes: yes Differential Revision: https://reviews.freebsd.org/D12432 Notes: svn path=/head/; revision=323865
* Add supporting changes for `Add limited sandbox capability to "make check"`Enji Cooper2017-08-141-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-tests/... changes: - Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration and propagate the appropriate environment down to *.test.mk. tests/... changes: - Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner, since tests/... is a special subdirectory tree compared to the others. MFC after: 2 months MFC with: r322511 Reviewed by: arch (silence), testing (silence) Differential Revision: D12014 Notes: svn path=/head/; revision=322515
| * 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
* | cat: fix build with -DNO_UDOM_SUPPORTEd Maste2017-08-091-1/+1
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=322325
* 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
* Add testcases for `cat -b`Enji Cooper2017-06-061-0/+2
| | | | | | | | MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319637
* Add additional testcases for cat(1)Enji Cooper2017-06-061-0/+4
| | | | | | | | | | | | | | | | Verify the following additional cases: - -s (in isolation, in addition to the -se testcase obtained via the NetBSD test). - -vt Submitted by: shivansh Reviewed by: asomers (earlier diff), ngie MFC after: 1 month Sponsored by: Google, Inc (GSoC 2017) Differential Revision: D11020 Notes: svn path=/head/; revision=319634
* 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
* Implement multibyte encoding support for -v with fallbackAndrey A. Chernov2016-09-151-6/+31
| | | | | | | MFC after: 7 days Notes: svn path=/head/; revision=305841
* Hack around output differences between FreeBSD and other BSDsEnji Cooper2016-08-131-0/+6
| | | | | | | | | | | | | with cat(1) cat -be on FreeBSD doesn't align the $ with the start of the line like NetBSD, et al's cat -be does PR: 210607 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/projects/netbsd-tests-update-12/; revision=304035
* Checkpoint initial integration workEnji Cooper2016-08-121-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | - Some of the lib/libc and lib/thr tests fail - lib/msun/exp_test:exp2_values now passes with clang 3.8.0 The Makefiles in contrib/netbsd-tests were pruned as they have no value Sponsored by: EMC / Isilon Storage Division Notes: svn path=/projects/netbsd-tests-update-12/; revision=304003
| * Update ^/vendor/NetBSD/tests/dist to a more recent snapshotEnji Cooper2016-08-126-2/+26
| | | | | | | | | | | | | | Pulled on "Thu Aug 11 18:01:19 PDT 2016" Notes: svn path=/vendor/NetBSD/tests/dist/; revision=303980
| * Check in first src/tests snapshot from NetBSD anoncvsvendor/NetBSD/tests/09.30.2014_20.45Enji Cooper2014-10-014-0/+77
| | | | | | | | | | | | | | | | | | | | | Sources were obtained like so: % export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot" % cvs -z9 co -D "09/30/2014 20:45" -P src/tests % mv src/tests/* tests/dist/. '*CVS*' has been added to svn:ignore to ease updating periodically from upstream Some line ending issues had to be resolved with test outputs and scripts via dos2unix and by deleting the eol-style property set in usr.bin/sort Discussed with: rpaulo Sponsored by: EMC / Isilon Storage Division Notes: svn path=/vendor/NetBSD/tests/dist/; revision=272343 svn path=/vendor/NetBSD/tests/09.30.2014_20.45/; revision=272345; tag=vendor/NetBSD/tests/09.30.2014_20.45
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-05-041-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=299094
* MFHGlen Barber2016-03-101-0/+11
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296625
| * DIRDEPS_BUILD: Connect MK_TESTS.Bryan Drewery2016-03-091-0/+11
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296587