aboutsummaryrefslogtreecommitdiff
path: root/bin/ls
Commit message (Collapse)AuthorAgeFilesLines
* Simplify LS_COLWIDTHS processingStefan Eßer2020-12-271-72/+43
| | | | | | | | | | | | | | The previous version normalized the width list (replaced empty fields with "0") just to be able to use sscanf() on the string. It is much simpler to just parse the string as-is. The clearing of f_notabs is preserved for the case that less than 9 width values have been defined, but I do not understand the rationale for this particular condition. E.g., LS_COLWIDTHS="::::::::" will be counted as 9 defined fields (may clear f_notabs) but is no different fron LS_COLWIDTHS="" with regard to the field width (and that does not clear f_notabs, since there are less than 9 fields).
* fts_read: Handle error from a NULL return better.Bryan Drewery2020-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | This is addressing cases such as fts_read(3) encountering an [EIO] from fchdir(2) when FTS_NOCHDIR is not set. That would otherwise be seen as a successful traversal in some of these cases while silently discarding expected work. As noted in r264201, fts_read() does not set errno to 0 on a successful EOF so it needs to be set before calling it. Otherwise we might see a random error from one of the iterations. gzip is ignoring most errors and could be improved separately. Reviewed by: vangyzen Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27184 Notes: svn path=/head/; revision=368467
* ls(1): Use \& as an escape character for the ',' optionGordon Bergling2020-10-101-1/+1
| | | | | | | | Reported by: karels@, xtouqh at hotmail dot com MFC after: 1 day Notes: svn path=/head/; revision=366613
* ls(1): Bugfix for an issue reported by mandocGordon Bergling2020-10-031-1/+1
| | | | | | | | | - no blank before trailing delimiter MFC after: 1 week Notes: svn path=/head/; revision=366403
* ls(1): Update all POSIX references and correct the STANDARDS sectionGordon Bergling2020-08-311-9/+10
| | | | | | | | | | | | | | | - Update the POSIX references for non-standard ls(1) options - Simplify the STANDARDS section by mention both supported POSIX versions Reported by: hrs Reviewed by: hrs, bcr Approved by: hrs, bcr MFC after: 3 days X-MFC-With: r364449 Differential Revision: https://reviews.freebsd.org/D26210 Notes: svn path=/head/; revision=365004
* ls(1): Update POSIX conformance from 2001 to 2008Gordon Bergling2020-08-211-10/+10
| | | | | | | | | | | | | | | | | | | - Update the options that are non-existing in POSIX from 2001 to 2008 - Update POSIX conformance in the STANDARDS section from 2001 to 2008 Verified by checking [1]. [1] https://pubs.opengroup.org/onlinepubs/9699919799.2016edition/toc.htm PR: 140435 Submitted by: Dan Lukes <dan at obluda dot cz> Reviewed by: bcr Approved by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26096 Notes: svn path=/head/; revision=364449
* ls: fix WITHOUT_LS_COLORS buildKyle Evans2020-05-211-0/+4
| | | | | | | | | | | *sigh* references to colorflags should be gated by COLORLS. Pointy hat to: kevans Reported by: jenkins (rescue build) X-MFC-With: r361318 Notes: svn path=/head/; revision=361332
* ls(1): actually restore proper behaviorKyle Evans2020-05-212-2/+16
| | | | | | | | | | | | | | | | | Highlights: - CLICOLOR in the environment should imply --color=auto to maintain compatibility with historical behavior - -G should set CLICOLOR and imply --color=auto The manpage has been updated to draw the connection between -G and --color; the former is in-fact a sort of compromise between --color=always and --color=auto, where we'll output color regardless of the environment lacking CLICOLOR/COLORTERM assuming stdout is a tty. X-MFC-With: r361318 Notes: svn path=/head/; revision=361331
* ls: fix a --color regression from r337956Kyle Evans2020-05-212-4/+10
| | | | | | | | | | | | | | | | | | The regression is in-fact that I flipped the default from never to auto. The incorrect impression was based on an alias that I failed to notice, installed by the Linux distribution that I used for testing compatibility here. Users that want the old default should be doing so with a shell alias as is done elsewhere, rather than making this decision in ls(1). Many thanks to rgrimes for pointing out the alias that I clearly overlooked that resulted in this; if you despised colors in your terminal from this, consider buying him a beer at the next venue that you see him at. MFC after: 1 week Relnotes: yes Notes: svn path=/head/; revision=361318
* ls(1): Fix trivial SEGV due to NULL deref in OOM pathConrad Meyer2020-05-051-0/+14
| | | | | | | | Reported by: Anton Rang <rang AT acm.org> Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=360665
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-2/+0
| | | | | | | | | | | | | 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
* Now that we have MK_LS_COLORS, we don't need RELEASE_CRUNCH check here.Warner Losh2019-07-151-2/+1
| | | | | | | | | The RELEASE_CRUNCH check is redundant here. We don't need it for releases anymore, and picobsd can control this more directly without making it a special case. Notes: svn path=/head/; revision=349990
* ls(1): Gate the do_color_* definitions behind COLORLSKyle Evans2018-08-181-0/+2
| | | | | | | Pointy hat to: me Notes: svn path=/head/; revision=338028
* ls(1): Support other aliases for --color arguments used by GNU ls(1)Kyle Evans2018-08-182-4/+48
| | | | | | | | | | | These aliases are supported and documented in the man page. For now, they will not be mentioned in the error when an invalid argument is encountered, instead keeping that list to the shorter 'preferred' names of each argument. Reported by: rgrimes Notes: svn path=/head/; revision=338027
* ls(1): Add --color=whenKyle Evans2018-08-175-13/+163
| | | | | | | | | | | | | | | | | | | --color may be set to one of: 'auto', 'always', and 'never'. 'auto' is the default behavior- output colors only if -G or COLORTERM are set, and only if stdout is a tty. 'always' is a new behavior- output colors always. termcap(5) will be consulted unless TERM is unset or not a recognized terminal, in which case ls(1) will fall back to explicitly outputting ANSI escape sequences. 'never' to turn off any environment variable and -G usage. Reviewed by: cem, 0mp (both modulo last-minute manpage changes Differential Revision: https://reviews.freebsd.org/D16741 Notes: svn path=/head/; revision=337956
* ls(1): Fix color env var checkingKyle Evans2018-08-161-2/+25
| | | | | | | | | | | | CLICOLOR will behavior as always- if present at all in the environment, allow colors. COLORTERM, recently enforced, will have to be both present and not empty. Submitted by: imp Notes: svn path=/head/; revision=337885
* ls(1): Enable colors with COLORTERM is set in the environmentKyle Evans2018-08-082-3/+13
| | | | | | | | | | | | | COLORTERM is the de facto standard, while CLICOLOR is generally specific to FreeBSD and ls(1). PR: 230101 Submitted by: D Green <dfrg@xsmail.com> (with manpage additions by myself) Reviewed by: cem ("LGTM" in PR; pre-manpage changes) MFC after: 1 week Notes: svn path=/head/; revision=337506
* Convert ls(1) to not use libxo(3)Conrad Meyer2018-01-178-235/+108
| | | | | | | | | | | | | | | | | | | | libxo imposes a large burden on system utilities. In the case of ls, that burden is difficult to justify -- any language that can interact with json output can use readdir(3) and stat(2). Logically, this reverts r291607, r285857, r285803, r285734, r285425, r284494, r284489, r284252, and r284198. Kyua tests continue to pass (libxo integration was entirely untested). Reported by: many Reviewed by: imp Discussed with: manu, bdrewery Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D13959 Notes: svn path=/head/; revision=328100
* 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
* 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
* Use uintmax_t to print st_nlink.Konstantin Belousov2017-02-161-4/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=313798
* Fix ls_tests:o_flag with ZFS TMPDIRAlan Somers2016-12-151-1/+1
| | | | | | | | | | | | | | Unlike UFS or TMPFS, ZFS sets uarch automatically whenever a file is updated. The test must explicitly clear uarch to be portable across filesystems. Also, it doesn't need to run as root. PR: 215179 MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8741 Notes: svn path=/head/; revision=310118
* Skip ls tests that use sparse files if these are not supported.Julio Merino2016-08-241-0/+8
| | | | | | | | | | | | | | | | | Some of the ls(1) tests create really large sparse files to validate the number formatting features of ls(1). Unfortunately, those tests fail if the underlying test file system does not support sparse files, as is the case when /tmp is mounted on tmpfs. Before running these tests, check if the test file system supports sparse files by using getconf(1) and skip them if not. Note that the support for this query was just added to getconf(1) in r304694. Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D7609 Notes: svn path=/head/; revision=304741
* Use require.progs with bc instead of require.files with /usr/bin/bcEnji Cooper2016-05-291-1/+1
| | | | | | | | | | | This will make things more flexible if the program path changes in the future, and the test in and of itself doesn't call /usr/bin/bc -- it just calls bc MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300939
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-05-041-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Explicitly add unmarked bin/ binaries to the runtime package.Glen Barber2016-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | Note: tcsh(1) has a MK_TCSH=no test, so this should be a separate package, which requires pre-install/post-install scripts, to be added later. Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295439
* | First pass to fix the 'tests' packages.Glen Barber2016-02-021-0/+4
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295171
* Fix ls -l alignement with new localesBaptiste Daroussin2015-12-071-1/+95
| | | | | | | | | | | | | | | | Latest update of locales introduced abbreviated month that follows the regionale rules meaning that they can be of variable length instead of being arbitrary truncated to top 3 characters. To fix alignement, ls now computes the visible length of the abbreviated month, pads the shorter month with spaces in order to make sure everything is properly aligned Reviewed by: ache, ed, jilles Differential Revision: https://reviews.freebsd.org/D4239 Notes: svn path=/head/; revision=291959
* Enable bin/ls testcases disabled previously because of issues with howEnji Cooper2015-12-071-6/+0
| | | | | | | | | | | | | | kyua 0.11's version of report-junit was rendering non-printable characters Upgrade to kyua 0.12 to obtain a fixed version of the command Output verified with python 2.7.10's xml.dom.minidom module MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291919
* Add more text to explain --libxo flag.Craig Rodrigues2015-12-011-1/+8
| | | | Notes: svn path=/head/; revision=291607
* Update ls -l tests to use mtime, not birthtimeEd Maste2015-10-301-6/+6
| | | | | | | | | | PR: 204155 Reviewed by: ngie, rodrigc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4040 Notes: svn path=/head/; revision=290205
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andEnji Cooper2015-10-121-2/+0
| | | | | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison Notes: svn path=/head/; revision=289172
* Remove all of the syncsEnji Cooper2015-10-101-10/+0
| | | | | | | | | They're unnecessary as shown by further testing on my VM Requested by: jhb Notes: svn path=/head/; revision=289102
* Call sync consistently using atf_checkEnji Cooper2015-10-061-6/+6
| | | | | | | Remove superfluous sync's Notes: svn path=/head/; revision=288907
* Explicitly set BLOCKSIZE to 512 in the environmentEnji Cooper2015-10-061-0/+1
| | | | Notes: svn path=/head/; revision=288906
* Add some more syncs to quiesce the filesystem after creating theEnji Cooper2015-10-061-0/+4
| | | | | | | files to see if this fixes deterministic Jenkin failures Notes: svn path=/head/; revision=288905
* Merge additional testcases and improvements to bin/ls/ls_tests fromEnji Cooper2015-10-052-64/+674
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ^/user/ngie/more-tests. - Additional testcases added: -- ls -D -- ls -F -- ls -H -- ls -L -- ls -R -- ls -S -- ls -T -- ls -b -- ls -d -- ls -f -- ls -g -- ls -h -- ls -i -- ls -k -- ls -l -- ls -m -- ls -n -- ls -o -- ls -p -- ls -q/ls -w -- ls -r -- ls -s -- ls -t -- ls -u -- ls -y - Socket file creation is limited to the ls -F testcase, greatly speeding up the test process - The ls -C testcase was made more robust by limiting the number of columns via COLUMNS and by dynamically formulating the columns/lines. - Add `atf_test_case` before all testcase `head` functions. X-MFC with: r284388, r288330, r288423 MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=288678
* Skip the B_flag testcase to stop blowing up freebsd-current@ withEnji Cooper2015-09-301-0/+1
| | | | | | | | "test failure emails" because kyua report-jenkins doesn't properly escape non-printable chars Notes: svn path=/head/; revision=288423
* Add initial testcases for bin/lsEnji Cooper2015-09-283-0/+373
| | | | | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=288330
* Fix whitespace error in ls(1) detected by igorAllan Jude2015-09-271-3/+3
| | | | | | | | Approved by: bcr (mentor) Sponsored by: EuroBSDCon DevSummit Notes: svn path=/head/; revision=288313
* Use one fewer made up words in the ls(1) man pageAllan Jude2015-09-271-2/+2
| | | | | | | | | | PR: 203337 Submitted by: Mike Dame <damemi@gmail.com> Approved by: bcr (mentor) Sponsored by: EuroBSDCon DevSummit Notes: svn path=/head/; revision=288312
* Upgrade libxo to 0.4.5.Marcel Moolenaar2015-08-241-1/+1
| | | | | | | | | | Local changes incorporated by 0.4.5: r284340 Local changes retained: r276260, r282117 Obtained from: https://github.com/Juniper/libxo Notes: svn path=/head/; revision=287111
* Cast uid and gid to the correct type for display to solve segfault in ls(1) ↵Allan Jude2015-07-241-2/+2
| | | | | | | | | | | | | | | | on 32bit arches Correctly escape literal % for display This fixes segfaults in 32bit arches caused by r285734 Reviewed by: ngie Approved by: dim Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3191 Notes: svn path=/head/; revision=285857
* Remove an excess space accidently introduced in the output in ls(1) by r285734Allan Jude2015-07-221-1/+1
| | | | | | | | | | Spotted by: dim Approved by: eadler (mentor) Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3152 Notes: svn path=/head/; revision=285803