summaryrefslogtreecommitdiffstats
path: root/tests/ls
AgeCommit message (Collapse)AuthorLines
2026-02-28tests: ls: treat invalid UTF-8 paths starting with a dot as hiddenSylvestre Ledru-0/+60
* tests/ls/non-utf8-hidden.sh: Add the test case. https://github.com/uutils/coreutils/pull/11135 https://github.com/coreutils/coreutils/pull/202
2026-01-24tests: avoid failures if 'ulimit -n' cannot set file descriptor limitsCollin Funk-1/+1
This fixes test failures seen on Haiku. * tests/ls/recursive.sh: Run 'ls' even if ulimit fails. * tests/split/r-chunk.sh: Run 'split' even if ulimit fails. * tests/sort/sort-merge-fdlimit.sh: Skip test if 'ulimit -n' cannot set file descriptor limits. Reported by Bruno Haible.
2026-01-21ls: --hyperlink: switch to more standard delimitersPádraig Brady-2/+2
* src/ls.c (quote_name): Use ST (ESC \) rather than BEL, as that's the only terminator mentioned in at least ECMA-48, DEC STD 070, and EK-VT520-RM. * NEWS: Mention the change in behavior. * tests/ls/hyperlink.sh: Adjust accordingly. Suggested by Egmont Koblinger.
2026-01-01maint: run 'make update-copyright'Collin Funk-52/+52
2025-12-13tests: ls: use a larger file descriptor limitCollin Funk-34/+4
OpenBSD and Alpine Linux /bin/sh cannot handle a file descriptor limit of 7. * tests/ls/recursive.sh: Create 30 directories and use a file descriptor limit of 20. Don't check the output since we have coverage for that elsewhere. Reported by Bruno Haible.
2025-12-08tests: fix non-portable use of printf '\x..'Pádraig Brady-1/+1
* tests/dd/conv-case.sh: Use octal instead. * tests/ls/hyperlink.sh: Likewise. * tests/sort/sort-locale.sh: Likewise.
2025-12-04tests: ls: check that 'ls -R' doesn't run out of file descriptorsCollin Funk-0/+37
* tests/ls/recursive.sh: Add a test where the file descriptor limit is less than the number of directories we visit recursively.
2025-12-02tests: ls --hyperlink: add more escaping test casesPádraig Brady-1/+3
* tests/ls/hyperlink.sh: Add tests for anchors, colons, utf8, and invalid utf8 characters.
2025-09-22tests: ls: avoid alignment check with non printable charactersPádraig Brady-0/+6
* tests/ls/block-size.sh: Skip the case where there are non-printable characters in ls' output, which is the case with NBSP thousands separators on FreeBSD 11 and 12. We may drop the MBSW_REJECT_UNPRINTABLE in future from ls and numfmt, but for now avoid these characters in the test. Reported by Bruno Haible.
2025-08-31ls: fix alignment with locale formatted --sizePádraig Brady-2/+19
Fix allocated size alignment in locales with multi-byte grouping chars. Tested with: LC_ALL=sv_SE.utf8 ls --size --block-size=\'k * src/ls.c (print_file_name_and_frills): Don't rely on printf("%*s", width, string) to pad multi-byte strings appropriately. Instead work out the padding required and use: printf("%*s%s", padding, "", string) to pad multi-byte appropriately. * tests/ls/block-size.sh: Add a test case. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/79347
2025-04-21tests: fix false failure with constrained setfaclPádraig Brady-1/+1
* tests/ls/acl.sh: In constrained environments, like with setxattr() disabled for example, require_acl_ does not check for the required functionality, so use the more stringent require_setfacl_ instead. Reported at https://github.com/NixOS/nixpkgs/issues/394953
2025-01-20tests: remove use of unprotected 'set'Pádraig Brady-9/+9
* cfg.mk (sc_prohibit_bare_set): A new syntax check to ensure we protect use of set with '--', so that args beginning with '-' are not interpreted as options, and if no args are present, all existing args are cleared. * tests/cp/symlink-slash.sh: Add -- to unprotected use of set. * tests/ls/ls-time.sh: Likewise. * tests/ls/symlink-slash.sh: Likewise. * tests/mkdir/perm.sh: Likewise. * tests/mkdir/selinux.sh: Likewise. * tests/mkdir/smack-no-root.sh: Likewise. * tests/mkdir/smack-root.sh: Likewise. * tests/mv/part-hardlink.sh: Likewise. * tests/nice/nice.sh: Likewise. * tests/stty/stty-row-col.sh: Likewise.
2025-01-19tests: fix typo in tests/ls/ls-time.shDaniel Hofstetter-1/+1
* tests/ls/ls-time.sh: s/--sort-name -t/-t --sort=name/.
2025-01-18ls: fix crash with --contextPádraig Brady-0/+3
* src/ls.c (main): Flag that we need to stat() if we're going to get security context (call file_has_aclinfo_cache). (file_has_aclinfo_cache): Be defensive and only lookup the device for the file if the stat has been performed. (has_capability_cache): Likewise. * tests/ls/selinux-segfault.sh: Add a test case. * NEWS: Mention the bug fix. Reported by Bruno Haible.
2025-01-15tests: avoid false failure with many mountpointsPádraig Brady-1/+1
* tests/ls/readdir-mountpoint-inode.sh: Only take the first 64.
2025-01-01maint: update all copyright year number rangesPádraig Brady-52/+52
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2024-11-24tests: avoid false failure with unicode decomposed file systemsPádraig Brady-2/+2
* tests/ls/dired.sh: macOS normalizes unicode characters to decomposed (NFD) form when storing names in the file system, which breaks the round-trip comparison employed by the test. So instead use a character which does not decompose; verified with: echo æ | uconv -f utf8 -t utf8 -x nfd | od -Ax -tx1z
2024-11-12tests: ls: also test security context output for symlinksPádraig Brady-12/+17
* tests/ls/selinux.sh: Test symlinks as well as files.
2024-11-12tests: avoid false failure with --disable-selinuxPádraig Brady-15/+40
* tests/ls/selinux-segfault.sh: Move recent addition to ... * tests/ls/selinux.sh: ... this new test that uses require_selinux_ to skip appropriately when we've built without selinux support. Also add a non root test that checks we output '.' along with the mode for files, to indicate a security context is present. * tests/local.mk (Reference the new test).
2024-11-09ls: add test case for ls -Z bugPaul Eggert-0/+15
Problem reported by Pádraig Brady <https://bugs.gnu.org/73418#35>. This bug was fixed by the recent gnulib update. * tests/ls/selinux-segfault.sh: Also test for ls -Z on broken symlinks.
2024-10-20tests: improve ls --dired with symlink testingSylvestre Ledru-1/+9
* tests/ls/dired.sh: Verify ls --dired with symlink.
2024-10-03tests: ls: don't always skip a capability testPádraig Brady-2/+6
* tests/ls/no-cap.sh: Move to being a root only test, since commit v9.5-132-g2a6bed933 we now need to call setcap to make the test effective. Otherwise we would have always just skipped the test.
2024-08-11ls: add support for explicit file name sortingPádraig Brady-2/+4
Support overriding previous sorting options with an explicit --sort=name option. * doc/coreutils.texi (ls invocation): Document the new option. * src/ls.c (usage): Likewise. (sort_args): Add the "name" entry, and sort to be consistent with the ordering presented in --help. * tests/ls/ls-time.sh: Add test cases. * NEWS: Mention the new feature. Suggested by: Tzvetelin Katchov
2024-06-27ls: treat --time=mtime consistently with other time selectorsPádraig Brady-10/+20
* src/ls.c: Track if --time=mtime is explicitly specified, so that we can apply the GNU extension of sorting by the specified time, when not displaying (-l not specified), and not explicitly sorting (-t not specified). * tests/ls/ls-time.sh: Add / Update test cases. Fixes https://bugs.gnu.org/71803
2024-03-25tests: avoid triggering obsolete tail option processingPádraig Brady-1/+1
* tests/ls/dired.sh: With 2 options, the latter is taken as a file name on some systems. This avoids a false failure on Solaris and FreeBSD at least.
2024-03-25tests: remove debugging from a testPádraig Brady-1/+1
* tests/ls/dired.sh: Remove temp debugging output.
2024-01-10tests: ls: add a test to verify that '+' is addedSylvestre Ledru-0/+40
* tests/ls/acl.sh: Add a new test. * tests/local.mk: Reference the new test.
2024-01-01maint: update all copyright year number rangesPádraig Brady-50/+50
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2023-11-03ls: fix recent regression in size alignmentPádraig Brady-0/+32
* src/ls.c (print_long_format): Use correct column width, introduced due to a copy/paste error in commit v9.4-2-gcbb6dfec5 * tests/ls/size-align.sh: Add a test. * tests/local.mk: Reference the new test. Fixes https://bugs.gnu.org/66919
2023-09-17ls: --dired now implies long format with hyperlinks disabledSylvestre Ledru-3/+5
Currently --dired is silently ignored with conflicting output formats * src/ls.c (decode_switches): Set default format and hyperlink mode when the --dired option is specified. * tests/ls/dired.sh: Check that formats are implied / overridden. * NEWS: Mention the change in behavior. * doc/coreutils.texi (ls invocation): Adjust --dired description.
2023-09-15tests: improve ls --dired testingSylvestre Ledru-1/+36
* tests/ls/dired.sh: Verify ls --dired output against varying offsets.
2023-08-28maint: spelling fixes, including author namesPaul Eggert-3/+3
Most of this just affects commentary and documentations. The only significant behavior change is translating author names via proper_name_lite rather than proper_name_utf8, or not translating them at all. proper_name_lite is good enough for coreutils and avoids the bloat that had coreutils not using Gnulib proper_name. * bootstrap.conf (gnulib_modules): Use propername-lite instead of propername. (XGETTEXT_OPTIONS): Look for proper_name_lite instead of for proper_name_utf8. * cfg.mk (local-checks-to-skip): Remove sc_proper_name_utf8_requires_ICONV, since we no longer use proper_name_utf8. (old_NEWS_hash): Update. (sc_check-I18N-AUTHORS): Remove; no longer needed.
2023-06-19tests: move tests to a directory per utilitySylvestre Ledru-0/+520
* cfg.mk: Adjust syntax check exclusion paths. * tests/local.mk: Adjust for renamed tests.
2023-06-07ls: display command line symlinks that return ELOOPPádraig Brady-0/+35
* src/ls.c (gobble_file): Ensure we lstat() a symlink specified on the command line, if we receive ELOOP from stat(). * tests/ls/symlink-loop.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/63931
2023-03-19tests: avoid false failure on systems without statxPádraig Brady-4/+6
* tests/ls/stat-free-symlinks.sh: Filter out syscalls that return ENOSYS, as that was seen with statx() on Debian 10.13 on mips64, and resulted in overcounting of stat calls.
2023-03-13ls: --color: honor separate sequences for extension casesPádraig Brady-1/+45
Following on from commit v8.29-45-g24053fbd8 which unconditionally used case insensitive extension matching, support selective case sensitive matching when there are separate extension cases defined with different display sequences. * src/dircolors.hin: Document how file name suffixes are matched. Note this is displayed with `dircolors --print-database` which the texi info recommends to use for details. * src/ls.c (parse_ls_color): Postprocess the list to mark entries for case sensitive matching, and also adjust so that unmatchable entries are more quickly ignored. (get_color_indicator): Use exact matching rather than case insensitive matching if so marked. * tests/ls/color-ext.sh: Add test cases. * NEWS: Mention the change in behavior. Addresses https://bugs.gnu.org/33123
2023-01-01maint: update all copyright year number rangesPádraig Brady-46/+46
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2022-11-15maint: avoid new grep -q syntax-check failuresPádraig Brady-2/+2
* cfg.mk: Exclude NEWS from the check. * init.cfg: s/grep -q/grep >/dev/null/. * tests/ls/hyperlink.sh: Likewise. * tests/ls/symlink-quote.sh: Likewise.
2022-01-02maint: update all copyright year number rangesPádraig Brady-46/+46
Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2021-12-24doc: colorize -> colorPaul Eggert-5/+5
Living so close to Hollywood I know that "colorize" means adding color to something that was already monochrome, whereas "color" means to give color to something. Coreutils apps color text instead of colorizing it.
2021-09-17tests: port removed-directory test to FreeBSDPádraig Brady-1/+1
* tests/ls/removed-directory.sh: On FreeBSD 9.1 at least, one gets ENOENT when trying to traverse the current removed dir with ../, so instead reference the parent dir directly.
2021-09-12tests: stat-vs-dirent.sh: avoid a false failurePádraig Brady-1/+2
* tests/ls/stat-vs-dirent.sh: Skip the test if we can't stat(1), as the file may have been removed, or have a malformed name due to '\n' etc. in the file name.
2021-07-28tests: augment new ls --zero test casesPádraig Brady-1/+9
* tests/ls/zero-option.sh: Check for the disabled, disallowed, and allowed option combinations.
2021-07-27ls: rename --null to --zero (Bug#49716)Paul Eggert-2/+2
* NEWS, doc/coreutils.texi (General output formatting): * src/ls.c (usage): Document this. * src/ls.c (ZERO_OPTION): Rename from NULL_OPTION. All uses changed. (long_options): Rename --null to --zero. (dired_dump_obstack, main, print_dir): Use '\n' instead of eolbyte where eolbyte must equal '\n'. (decode_switches): Decode --zero instead of --null. --zero also implies -1, -N, --color=none, --show-control-chars. Use easier-to-decipher code to set ‘format’ and ‘dired’. Reject attempts to combine --dired and --zero. * tests/local.mk: Adjust to test script renaming. * tests/ls/zero-option.sh: Rename from tests/ls/null-option.sh, and test --zero instead of --null.
2021-07-26ls: add --null option (Bug#49716)Paul Eggert-0/+33
* NEWS, doc/coreutils.texi (General output formatting): * src/ls.c (usage): Document this. * src/ls.c (NULL_OPTION): New constant. (long_options): Add --null. (eolbyte): New static var. (dired_dump_obstack, main, print_dir, print_current_files) (print_many_per_line, print_horizontal, print_with_separator): Output eolbyte instead of '\n'. (decode_switches): Decode --null. * tests/ls/null-option.sh: New file. * tests/local.mk (all_tests): Add it.
2021-04-22tests: fix FP in ls/stat-free-color.shBernhard Voelker-4/+6
On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls newfstatat(STDOUT_FILENO, ...), but only when there is something to output. * tests/ls/stat-free-color.sh: Add -a option to the reference invocation of ls, thus enforcing something gets output.
2021-04-11ls: add --sort=width option to sort by file name widthCarl Edquist-0/+41
This helps identify the outliers for long filenames, and also produces a more compact display of columns when listing a directory with many entries of various widths. * src/ls.c (sort_type, sort_types, sort_width): New sort_width sort type. (sort_args): Add "width" sort arg. (cmp_width, fileinfo_width): New sort function and helper for file name width. (quote_name_width): Add function prototype declaration. (usage): Document --sort=width option. * doc/coreutils.texi: Document --sort=width option. * tests/ls/sort-width-option.sh: New test for --sort=width option. * tests/local.mk: Reference new test. * NEWS: Mention the new feature.
2021-01-01maint: update all copyright year number rangesPádraig Brady-44/+44
Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2020-11-11ls: fix crash printing SELinux context for unstatable filesPádraig Brady-2/+8
This crash was identified by Cyber Independent Testing Lab: https://cyber-itl.org/2020/10/28/citl-7000-defects.html and was introduced with commit v6.9.90-11-g4245876e2 * src/ls.c (gobble_file): Ensure scontext is initialized in the case where files are not statable. * tests/ls/selinux-segfault.sh: Renamed from proc-selinux-segfault.sh, and added test case for broken symlinks. * tests/local.mk: Adjust for the renamed test. * NEWS: Mention the bug fix.
2020-05-23tests: fix removed-directory testBernhard Voelker-10/+9
The previous attempt to skip that test on NFS (commit 4181fc518362) made the test fail; it introduced two problems: a) In the good case, i.e., when the subshell returns with exit status 0, the test ran into framework_failure_. b) As the subshell also runs with 'set -x', the later comparison of /dev/null with 'err' would fail. * tests/ls/removed-directory.sh: Revert to the style without subshell, and add 'test -d .' to verify that 'ls' can read the removed dir.