summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2012-09-05build: don't use recursive make for tests/ subdirectoryStefano Lattarini
* Makefile.am (SUBDIRS): Remove 'tests'. (include): The '$(top_srcdir)/tests/local.mk' file. (check-root): Remove this convenience target, it's no longer needed now that the "real" check-root target once in 'tests/Makefile' will land in the top-level makefile. * configure.ac (AC_CONFIG_FILES): Remove 'tests/Makefile'. * tests/Makefile.am: Rename ... * tests/local.mk: ... like this, with a lot of adjustments. * tests/init.cfg: Move ... * init.cfg: ... here. This is necessary, for a limitation of the gnulib-provided 'tests/init.sh', which unconditionally look for 'init.cfg' in the $(srcdir) directory. * tests/*/*.sh: Adjust: expect init.sh to be in '$srcdir/tests', not in '$srcdir', and extend $PATH with './src', not with '../src'. * tests/Coreutils.pm: Adjust similarly. * tests/pr/pr-tests.pl ($pfx): Likewise.
2012-09-05maint: list of names of built programs available in the MakefilesStefano Lattarini
This is just a preparatory refactoring in view of future changes. * configure.ac (AC_SUBST): New 'built_programs'. * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Simply define the exported variable 'built_programs' to the expansion of the '$(built_programs)' AC_SUBST'd make variable. (.built-programs): Remove this now-unneeded convenience target. (CLEANFILES, check_DATA): Delete, no longer needed.
2012-09-05tests: remove the unused 'root-hint' targetStefano Lattarini
* tests/Makefile.am (root-hint): Here. The interested user can see the reasons why some tests are skipped by looking at the messages they display on the console; here's an excerpt: ... PASS: misc/id-groups.sh id-setgid.sh: skipped test: must be run as root SKIP: misc/id-setgid.sh PASS: misc/md5sum.pl ... PASS: df/total-verify.sh 2g.sh: skipped test: very expensive: disabled by default SKIP: du/2g.sh ... Clear enough, and more specific and precise that a generic "some tests might need to be run as root" message. And if that user is interested in making those tests run anyway, he'll just take a look to the README files to look for info. So there's no reason to pollute the stdout with another "hint" that is subsumed by those messages, and that might go unnoticed anyway. Moreover, and possibly more importantly, that hint wasn't being displayed anyway, even before this change! That's because the 'root-hint' target was listed as prerequisite for the 'check-recursive' target, which however was not a dependency of the 'check' target in 'tests/Makefile.am', because that file contains no $(SUBDIRS) definition.
2012-09-05tests: use suffix, not exec-bit, to tell which files are testsStefano Lattarini
* tests/Makefile.am (vc_exe_in_TESTS): Adjust to look, in the 'tests/' subdirectory, for files that have one of the extensions listed in $(TEST_EXTENSIONS), rather than for executable files.
2012-09-05maint: make vc_exe_in_TESTS also work in VPATH buildsStefano Lattarini
* tests/Makefile.am (vc_exe_in_TESTS): It is easy to adjust this recipe to also work in VPATH setups, also thanks to modifications done by previous changes.
2012-09-05maint: remove useless dependency for vc_exe_in_TESTSStefano Lattarini
* tests/Makefile.am (vc_exe_in_TESTS): No need to depend on Makefile: this target is .PHONY, so it is always run anyway.
2012-09-05maint: avoid parsing of Makefile.am from vc_exe_in_TESTSStefano Lattarini
* tests/Makefile.am (TESTS): Rename ... (all_tests): ... like this, so that we'll still be able to know the complete list of our tests even if the user overrides TESTS from the command line (which he's allowed to do by the test harness API). (root_tests): Rename ... (all_root_tests): ... like this, for similar reasons. (TESTS, root_tests): Redefine their defaults to to $(all_tests) and $(all_root_tests) respectively. (vc_exe_in_TESTS): It can now safely use $(all_tests) to get the complete list of test cases according to the Makefile, instead of having to resort to "parsing" of Makefile.am. (EXTRA_DIST): Use $(all_tests), not $(TESTS). (v_, w_): Delete, no longer needed.
2012-09-05build: use 'check-local' to extend the 'check' targetStefano Lattarini
* tests/Makefile.am (check-local): Here, by making this depend on 'vc_exe_in_TESTS' ... (check): ... rather than making this depend on them. While the old usage worked, it relied on an implementation detail rather than on documented behavior. * src/local.mk (check-local): Similarly, make this depend on 'check-README' and 'check-duplicate-no-install' ... (check): ... rather than on this.
2012-09-01build: don't use recursive make to build the 'src' subdirectoryStefano Lattarini
* Makefile.am (SUBDIRS): Remove 'src'. Ensure '.' is listed before 'tests' and 'gnulib-tests'. (dist-hook): Adjust: we must now tweak the top-level Makefile.in in $(distdir), not the one in the 'src/' subdir (which is gone). (include): The '$(top_srcdir)/src/local.mk' file. * build-aux/gen-lists-of-programs.sh: Adjust the generation of the automake input fragment. * tests/Makefile.am (.built-programs): Adjust. * cfg.mk (all_programs): Remove this convenience rule; it's no longer needed, now that we can rely directly on the contents of $(all_programs). (sc_option_desc_uppercase, check-programs-vs-x:): Adjust lists of prerequisites accordingly. (all-progs-but-lbracket): Simplify definition accordingly. * configure.ac ($OPTIONAL_BIN_PROGS): Adjust definition. ($OPTIONAL_PKGLIB_PROGS): Likewise. ($NO_INSTALL_PROGS_DEFAULT): Tweak definition, for consistency. (AC_CONFIG_FILES): Remove 'src/Makefile'. * src/Makefile.am: Rename ... * src/local.mk: ... like this, with a lot of adjustments. In addition ... (all_programs): ... remove this now-unneeded convenience target.
2012-08-31maint: fixup: don't try to distribute a now-removed fileStefano Lattarini
* tests/Makefile.am (EXTRA_DIST): Drop 'check.mk', which has been removed (being merged into 'tests/Makefile.am') by recent changes.
2012-08-30tests: get rid of the 'shell-or-perl' auxiliary scriptStefano Lattarini
It's now easier and faster to simply run the perl ans shell test scripts directly with the appropriate interpreter and options. * tests/shell-or-perl: Delete. * tests/Makefile.am (EXTRA_DIST): Remove it. (SH_LOG_COMPILER): Re-define to invoke the correct shell. (PL_LOG_COMPILER): Re-define to invoke the correct perl interpreter ... (TESTSUITE_PERL_OPTIONS): ... with the correct options. (XPL_LOG_COMPILER): Use those options instead of inlining their expansion. (LOG_COMPILER): Delete, no longer needed.
2012-08-30tests: add .sh and .pl suffixes to shell and perl tests, respectivelyStefano Lattarini
Not only this shrinks the size of the generated Makefile (from > 6300 lines to ~3000), but will allow further simplifications in future changes. * tests/Makefile.am (TEST_EXTENSIONS): Add '.sh' and '.pl'. (PL_LOG_COMPILER, SH_LOG_COMPILER): New, still defined simply to $(LOG_COMPILER) for the time being. (TESTS, root_tests): Adjust as described. * All tests: Rename as described.
2012-08-30tests: detect missing perl at configure runtimeStefano Lattarini
* configure.ac (AM_CONDITIONAL): Set the conditional 'HAVE_PERL' to true if the configure-time checks (as run by gl_PERL) have been able to find a working perl. * tests/no-perl: New script, report a diagnostic about "missing perl" and exit with status 77. * tests/Makefile.am (EXTRA_DIST): Distribute it. (TESTSUITE_PERL): New, define to '$(PERL)' if a perl interpreter has been found at configure time (i.e., if the 'HAVE_PERL' automake conditional is true), and to '$(srcdir)/no-perl' otherwise. (LOG_COMPILER): Use $(TESTSUITE_PERL) instead of $(PERL). (XPL_LOG_COMPILER): Likewise. * tests/shell-or-perl: Simplify: no need to actually check whether perl is working.
2012-08-30tests: avoid use of '-T' in shebang line to enable perl taint modeStefano Lattarini
* tests/rm/fail-eperm: Rename ... * tests/rm/fail-eperm.xpl: ... like this * tests/Makefile.am (TESTS): Adjust. (TEST_EXTENSIONS): New, list '.xpl'. (XPL_TEST_LOGS): New, run a perl test in tainted mode. * tests/shell-or-perl: Simplify this script: we no longer need to parse the shebang line and adjust the flags in the perl invocation accordingly.
2012-08-30tests: prefer AM_TESTS_ENVIRONMENT over TESTS_ENVIRONMENTStefano Lattarini
The latter should be reserved for user overrides. * tests/Makefile.am (TESTS_ENVIRONMENT): Rename ... (AM_TESTS_ENVIRONMENT): ... like this.
2012-08-30tests: merge tests/check.mk into tests/Makefile.amStefano Lattarini
The separation has become unnecessary after all the ancient 'tests/*/Makefile.am' makefiles have been merged into the "more-top-level" one 'tests/Makefile.am'. * tests/check.mk: Merge ... * tests/Makefile.am: ... in here. Some comments tweaking while at it.
2012-08-30build: don't abuse Automake internals (with its 'check-am' rule)Stefano Lattarini
* tests/check.mk (check-am): Remove; obtain the same effect by moving its dependency '.built-programs' ... (check_DATA): ... to this variable.
2012-08-30tests: remove useless defn of REPLACE_GETCWD from TESTS_ENVIRONMENTStefano Lattarini
It's last use had been removed in commit v8.12-3-g3ed91fc of 2011-04-28, "tests: remove useless test: misc/pwd-unreadable-parent". * tests/check.mk (TESTS_ENVIRONMENT): Adjust. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2012-08-30tests: fix misc/sort-exit-early to skip if rootNick Alcock
* tests/misc/sort-exit-early: skip_if_root_ as this test requires an unwritable input and an unreadable output.
2012-08-24md5sum, sha*sum: add --tag to output a format indicating the algorithmOndrej Oprala
The format used is the BSD traditional format which looks like: MD5 (/dev/null) = d41d8cd98f00b204e9800998ecf8427e * NEWS: Add new feature info. * doc/coreutils.texi (md5sum invocation): Add detailed information about the new --tag option. * src/md5sum.c: Add the new --tag option for BSD-style output. (bsd_split_3): Add ESCAPED_FILENAME parameter. (print_filename): New function refactored from main(). (filename_unescape): New function refactored from split_3(). * tests/misc/md5sum-bsd: Add tests for the new feature.
2012-08-23rm: fix the new --dir (-d) option to work with -iRob Day
* src/remove.c (prompt): Hoist the computation of is_empty, since we'll need it slightly earlier. Before, this function would arrange to fail with EISDIR when processing a directory without --recursive (-r). Adjust the condition to exempt an empty directory when --dir has been specified. Improve comments. * tests/rm/d-3: New file, to ensure that rm -d -i dir works. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. * THANKS.in: Update. Reported by Michael Price in http://bugs.gnu.org/12260
2012-08-22tests: correct print_ver_ arguments and add a rule to enforce thisBernhard Voelker
We use print_ver_ to run "PROG --version" for each program under test. Some tests have been derived from others, while the argument(s) to print_ver_ have not been adapted. Add a new cfg.mk rule to prohibit this. * cfg.mk (sc_prohibit_test_calls_print_ver_with_irrelevant_argument): New rule, to prohibit a test script from calling print_env_ for a program not actually used by that test. * tests/chown/basic: s/\(print_ver_\) chgrp/\1 chown/ * tests/cp/acl: s/\(print_ver_\) mv/\1 cp/ * tests/cp/capability: s/\(print_ver_\) ls/\1 cp/ * tests/cp/cp-parents: s/(print_ver_\) mv/\1 cp/ * tests/du/bind-mount-dir-cycle: s/(print_ver_\) rm/\1 du/ * tests/misc/wc-parallel: s/(print_ver_\) md5sum/\1 wc/
2012-08-21du: handle bind-mounted directory cycles gracefullyOndrej Oprala
Before this change, a directory cycle induced by a bind mount would be treated as a fatal error, i.e., probable disk corruption. However, such cycles are relatively common, and can be detected efficiently, so now du emits a descriptive warning and arranges to exit nonzero. * NEWS (Bug fixes): Mention it. * src/du.c: Include "mountlist.h". (di_mnt): New global set. (di_files): Rename global from di_set, now that there are two. (fill_mount_table): New function. (hash_ins): Add DI_SET parameter. (process_file): Look up each dir dev/ino pair in the new set. (main): Allocate, initialize, and free the new set. * tests/du/bind-mount-dir-cycle: Add a test for the fix. * tests/Makefile.am (TESTS): Add it. * THANKS.in: Update. This implements the proposal in http://bugs.gnu.org/11844. Originally reported in http://bugs.debian.org/563254 by Alan Jenkins and more recently as http://bugzilla.redhat.com/836557 Improved by: Jim Meyering
2012-08-19tests: port df/no-mtab-status to SolarisPaul Eggert
* tests/df/no-mtab-status: Include <mntent.h> in test program, so that the getmntent hack compilation fails on Solaris, as it should, since it's not compatible with Solaris. Reported by Stefano Lattarini in <http://bugs.gnu.org/12225>.
2012-08-19tests: avoid split/filter test failure on very low-mem systemJim Meyering
* tests/split/filter: Use xz -1 when compressing, to minimize memory usage. Otherwise, xz could fail due to insufficient virtual memory on a system with very little free memory.
2012-08-18tests: trigger the sort -u free-memory-read bugJim Meyering
* tests/misc/sort-u-FMR: New file. * tests/Makefile.am (TESTS): Add it. * tests/misc/sort: Add the test here, too. * NEWS (Bug fixes): Mention it.
2012-08-18tests: wrap the valgrind-requiring assertion in a functionJim Meyering
* tests/init.cfg (require_valgrind_): New function... * tests/misc/sort-stale-thread-mem: ...extracted from here.
2012-08-17sort: sort --unique (-u) could cause data lossJim Meyering
sort -u could omit one or more lines of expected output. This bug arose because sort recorded the most recently printed line via reference, and if you were unlucky, the storage for that line would be reused (overwritten) as additional input was read into memory. If you were doubly unlucky, the new value of the "saved" line would not only match the very next line, but if that next line were also the first in a series of identical, not-yet-printed lines, then the corrupted "saved" line value would result in the omission of all matching lines. * src/sort.c (saved_line): New static/global, renamed and moved from... (write_unique): ...here. Old name was "saved", which was too generic for its new role as file-scoped global. (fillbuf): With --unique, when we're about to read into a buffer that overlaps the saved "preceding" line (saved_line), copy the line's .text member to a realloc'd-as-needed temporary buffer and adjust the line's key-defining members if they're set. (overlap): New function. * tests/misc/sort: New tests. * NEWS (Bug fixes): Mention it. * THANKS.in: Update. Bug introduced via commit v8.5-89-g9face83. Reported by Rasmus Borup Hansen in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/23173/focus=24647
2012-08-16tests: reverse args in Coreutils.pm-invoked diff, for consistencyJim Meyering
* tests/Coreutils.pm (_compare_files): Reverse diff arguments so that we invoke diff -c $expected $actual, which is consistent with how init.sh-using tests invoke "compare exp out".
2012-08-14rm: new option --dir (-d) to remove empty directoriesKrzysztof Goj
Add new option to rm (-d/--dir), which allows removal of empty directories, while still safely disallowing removal of non-empty ones. This improves compatibility with Mac OS X and BSD systems, which honor the -d option. * src/remove.c (rm_fts): Remove empty directories when requested. * src/remove.h (rm_options) [remove_empty_directories]: New member. * src/rm.c (long_opts, usage, main): Update usage and option parsing. (rm_option_init): Initialize the new member. * src/mv.c (rm_option_init): Initialize the new member. * tests/rm/d-1: New test case - successfully delete empty dir. * tests/rm/d-2: New test case - refuse to delete nonempty dir. * tests/Makefile.am (TESTS): Add them.
2012-08-14df: fail when the mount list is required but cannot be readBernhard Voelker
* src/df.c (main): Add conditions to fail when the mount list cannot be read: this includes the cases when a file name argument is given and any of -a, -l, -t or -x is used. * doc/coreutils.texi: Document the additional error conditions. * tests/df/no-mtab-status: Add a new test. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fix.
2012-08-08tests: fix validation of local file systemsPádraig Brady
* tests/init.cfg (require_mount_list_): A new function to ensure we can read the list of file systems. (require_local_dir_): Call the above function, as otherwise the check is invalid. * tests/df/total-unprocessed: Ensure df can read the list of mounted file systems so that --local can be honored.
2012-08-06tests: printf-surprise: avoid unwarranted failure on FreeBSD 9.0Jim Meyering
* tests/misc/printf-surprise: A VM size of 10,000KiB was too little in which to run "env printf ..." on FreeBSD 9.0-p3. Increase it to 15,000.
2012-08-04df: fix exit code and error messages with --totalBernhard Voelker
When the combination of the file system options with given files or devices does not lead to output, "df --total" would exit successfully although it should not. Examples: $ df --total --type=xfs / # when / is not an XFS file system $ df --total --local -t nfs DIR # nfs is remote per se ... $ df --total -t qwerty /dev/sdb5 # typo in file system type Furthermore, "df --total" would not print the error message "no file systems processed" when the file argument does not exist or is otherwise not accessible. Example: $ df --total __not_exist__ These 2 bugs are present since --total was added by commit v6.12-166-gea2887b. * src/df.c (get_dev): Do not set file_systems_processed to true when force_fsu is true, i.e. when the row for the "total" line is processed. (main): Don't print totals unless we've processed a file system. Also only print the "no FS processed" message if there was no preceding diagnostic. * tests/df/total-unprocessed: Add a new test. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fix. Improved-by: Jim Meyering
2012-08-04tests: avoid FP ulimit failure with valgrind-wrapped toolsJim Meyering
* tests/init.cfg (require_ulimit_): Raise VM limit from 10MiB to 20MiB, to accommodate overhead of a valgrind-wrapped date program. Also declare this function's local variables "local".
2012-07-23tests: add a test for a previously fixed output format bug in joinPádraig Brady
Add a test and NEWS entry for a bug inadvertently fixed in a refactoring in commit v8.9-32-gd4db0cb * tests/misc/join (v2-format): Add a new test. * THANKS.in: Add the reporter. * NEWS: Mention the old bug. * cfg.mk (old_NEWS_hash): Update. Reported-by: Jean-Pierre Tosoni
2012-07-18tests: fiemap-perf: avoid a false failure on ext2Andrew D Warshall
* tests/cp/fiemap-perf: Skip the test on ext2 file systems, as we do for ext3. Also skip the test if we can't create a 1TiB file, which might not be supported on certain file systems. Signed-off-by: Pádraig Brady <P@draigBrady.com>
2012-07-16maint: move two df tests from tests/misc to tests/dfPádraig Brady
* test/Makefile.am: Reference the moved tests.
2012-07-16df: don't output control characters in a mount point namePádraig Brady
It's awkward to read and problematic for scripts when control characters like '\n' are output. Note other fields are already handled with mbsalign, which converts non printable chars to the replacement char. A caveat to note with that, is the replacement char takes a place in the field and so possibly truncates the field if it was the widest field in the records. Note a more general replacement function, that handles all printable, or non white space characters, would require more sophisticated support for various encodings, and the complexity vs benefit was not deemed beneficial enough at present. Perhaps in future a more general replacement function could be shared between the various utilities. Note <space> is unaffected in any field, which could impact scripts processing the output. However any of the number fields at least could have spaces considering `LANG=fr_FR df -B\'1`, so it's probably best to leave spaces, which also allows scripts to handle mount points with spaces without change. * src/df.c (hide_problematic_chars): Replace control chars with '?'. * tests/df/problematic-chars: Add a new root only test. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fix.
2012-07-06tests: sort-merge-fdlimit: reduce the limit by onePádraig Brady
* tests/misc/sort-merge-fdlimit: As a consequence of commit v8.17-34-g59daf05, we can reduce the descriptor limit by one.
2012-07-04date: fails to diagnose invalid inputJim Meyering
date -d "$(printf '\xb0')" would print 00:00:00 with today's date rather than diagnosing the invalid input. Now it reports this: date: invalid date '\260' * gnulib: Update submodule to latest for fixed parse-datetime.y. * tests/misc/date [invalid-high-bit-set]: New test. * NEWS (Bug fixes): Mention it. * bootstrap, tests/init.sh: Also update to latest. Reported by Peter Evans in http://bugs.gnu.org/11843
2012-07-02sort: avoid redundant processing with inaccessible inputs or outputPádraig Brady
* src/sort.c (check_inputs): A new function to verify all inputs are accessible before further processing. (check_output): A new function to open or create a specified output file, before futher processing. (stream_open): Adjust to truncating the previously opened output file rather than opening directly. (avoid_trashing_input): Optimize to stat the output file descriptor, rather than the file name. (main): Call the new functions to check accessibility of inputs and output, before processing starts. * tests/misc/sort: Adjust to the changed error message. * tests/misc/sort-merge-fdlimit: Account for the earlier opened file descriptor of the specified output file. * tests/misc/sort-exit-early: A new test to exercise the improvements. * tests/Makefile.am: Reference the new test. * NEWS: Mention the improvement. Suggested-by: Bernhard Voelker
2012-06-22split: ensure output doesn't overwrite inputPádraig Brady
* src/split.c (create): Check if output file is the same inode as the input file. * tests/split/guard-input: New test case. * tests/Makefile.am: Reference new test case. * NEWS: Mention the fix. Improved-by: Jim Meyering Reported-by: François Pinard
2012-06-10maint: remove su testing artifactSami Kerola
* tests/misc/help-version: Remove expected su exit code.
2012-06-10build: update gnulib to latest; correct comment grammarJim Meyering
* tests/misc/help-version: Fix comment grammar: s/all these/all of these/ * gl/lib/tempname.c.diff: Likewise.
2012-06-06su: remove program (util-linux is now the best source for it)Jim Meyering
* README: Omit "su" from list of programs. * src/su.c: Remove file. * src/Makefile.am: Remove su-related rules and variables. * tests/misc/su-fail: Remove test. * tests/Makefile.am (TESTS): Remove misc/su-fail. * tests/misc/invalid-opt: Remove su-related code. * src/.gitignore: Remove su. * man/su.x: Remove file. * man/Makefile.am (su.1): Remove rule. * po/POTFILES.in: Remove su.c from the list. * TODO: Remove ancient entry. * NEWS (Changes in behavior): Mention it. * doc/coreutils.texi: Remove su-related description. * AUTHORS: Remove su. * m4/lib-check.m4 (cu_LIB_CHECK): Remove file/macro. * configure.ac: Remove su-related code and sole use of cu_LIB_CHECK. * scripts/git-hooks/commit-msg: Remove su from this list, too.
2012-06-05head: with --lines=-N (-n-N) reset file pointer on seekable inputJim Meyering
* src/head.c (elide_tail_lines_seekable): Reset file pointer after printing up to an end-relative line-counted offset. Anoop Sharma reported the problem and suggested the fix. * tests/misc/head-pos: Add coverage via a very similar, existing test. Also add coverage for a previously untested block of code. * tests/misc/head-elide-tail ($READ_BUFSIZE): Update to 8192, to match the value of BUFSIZ I see today on Fedora 17/x86_64 (unrelated to this fix). * NEWS (Bug fixes): Mention it. Improved-by: Pádraig Brady
2012-05-31maint: fix typos in test comments and old ChangeLog filesJim Meyering
Culprits identified and fixed automatically using these commands: git ls-files|misspellings -f -|perl -nl \ -e '/^(.*?)\[(\d+)\]: (\w+) -> "(.*?)"$/ or next;' \ -e '($file,$n,$l,$r)=($1,$2,$3,$4); $q="'\''"; $r=~s/$q/$q\\$q$q/g;'\ -e 'print "sed -i $q${n}s!$l!$r!$q $file"' | bash using http://github.com/lyda/misspell-check * old/fileutils/ChangeLog: Fix typos. * old/textutils/ChangeLog: Likewise. * tests/misc/truncate-fail-diag: Likewise.
2012-05-16tests: use $AWK, not awkJim Meyering
* tests/cp/sparse-fiemap: Don't hard-code "awk". Use $AWK. * tests/init.cfg: Likewise. * tests/misc/sort-rand: Likewise.
2012-05-12ls: color each symlink-to-relative-name in / properlyJim Meyering
In order for ls --color to color each symlink, it must form the name of each referent and then stat it to see if the link is dangling, to a directory, to a file, etc. When the symlink is to a relative name, ls must concatenate the starting directory name and that relative name. When, in addition, the starting directory was "/" or "/some-name", the result was ill-formed, and the subsequent stat would usually fail, making the caller color it as a dangling symlink. * src/ls.c (make_link_name): Don't botch the case in which dir_name(NAME) == "/" and LINKNAME is relative. * tests/ls/root-rel-symlink-color: New file. Test for the above. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. Reported by Mike Frysinger in http://bugs.gnu.org/11453 Bug introduced by commit v8.16-23-gbcb9078.