aboutsummaryrefslogtreecommitdiffstats
path: root/tests/rm (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-08-12maint: use short form bug URLsPádraig Brady1-1/+1
* cfg.mk (sc_prohibit-long-form-bug-urls): Disallow long form in code. * scripts/git-hooks/commit-msg: Disallow long form in commit messages. * NEWS: Shorten long urls. * bootstrap.conf: Likewise. * configure.ac: Likewise. * scripts/git-hooks/commit-msg: Likewise. * src/csplit.c: Likewise. * src/fmt.c: Likewise. * src/make-prime-list.c: Likewise. * src/nohup.c: Likewise. * tests/od/od-float.sh: Likewise. * tests/rm/r-root.sh: Likewise. * tests/tail/inotify-race.sh: Likewise. * tests/tail/inotify-race2.sh: Likewise.
2025-01-16tests: avoid false failure with replaced readdirPádraig Brady1-2/+2
* tests/rm/rm-readdir-fail.sh: Simulate EIO rather than ENOENT, as gnulib absorbs the latter since commit 5a2d28df.
2025-01-01maint: update all copyright year number rangesPádraig Brady50-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: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2024-01-17tests: make ulimit -v interact better with ASANPádraig Brady1-1/+1
ulimit -v is generally not supported with ASAN, giving errors like: "ReserveShadowMemoryRange failed while trying to map 0x... bytes. Perhaps you're using ulimit -v" * tests/cp/link-heap.sh: Mention ASAN as a possible reason for skipping. * tests/csplit/csplit-heap.sh: Likewise. * tests/cut/cut-huge-range.sh: Likewise. * tests/dd/no-allocate.sh: Likewise. * tests/printf/printf-surprise.sh: Likewise. * tests/rm/many-dir-entries-vs-OOM.sh: Likewise. * tests/head/head-c.sh: Only skip the part of the test needing ulimit. * tests/split/line-bytes.sh: Likewise.
2024-01-01maint: update all copyright year number rangesPádraig Brady50-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-08-28maint: spelling fixes, including author namesPaul Eggert2-2/+2
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-02-26tests: avoid hang in new testPádraig Brady1-8/+8
* tests/rm/empty-inacc.sh: Ensure we're not reading from stdin when we're relying on no prompt to proceed. Also change the file being tested so that a failure in one test doesn't impact following tests causing a framework failure.
2023-02-26tests: avoid gdb on macOSPádraig Brady1-0/+5
gdb was seen to hang intermittently on macOS 12. Also gdb requires signing on newer macOS systems: https://sourceware.org/gdb/wiki/PermissionsDarwin So restrict its use on macOS systems for now. * tests/rm/r-root.sh: Skip on darwin systems. * tests/tail-2/inotify-race.sh: Restrict the test to inotify capable systems to avoid the hang with some gdbs. * tests/tail-2/inotify-race.sh: Likewise.
2023-02-21tests: initialize a variableJim Meyering1-0/+1
* tests/rm/interactive-once.sh (write_prot_msg1): Initialize it, so an envvar setting cannot perturb the test.
2023-02-21rm: --dir (-d): fix bugs in handling of empty, inaccessible directoriesJim Meyering1-2/+25
* src/remove.c (prompt, rm_fts): In the dir-handling code of both of these functions, relax a "get_dir_status (...) == DS_EMPTY" condition to instead test only "get_dir_status (...) != 0", enabling flow control to reach the prompt function also for unreadable directories. However, that function itself also needed special handling for this case: (prompt): Handle empty, inaccessible directories properly, deleting them with -d (--dir), and prompting about whether to delete with -i (--interactive). * tests/rm/empty-inacc.sh: Add tests for the new code. Reported by наб <nabijaczleweli@nabijaczleweli.xyz> in bugs.debian.org/1015273 * NEWS (Bug fixes): Mention this.
2023-01-01maint: update all copyright year number rangesPádraig Brady50-50/+50
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-09-24rm: fix diagnostics on I/O errorPaul Eggert1-0/+1
I ran into this problem when attempting to recursively remove a directory in a filesystem on flaky hardware. Although the underlying readdir syscall failed with errno == EIO, rm issued no diagnostic about the I/O error. Without this patch I see this behavior: $ rm -fr baddir rm: cannot remove 'baddir': Directory not empty $ rm -ir baddir rm: descend into directory 'baddir'? y rm: remove directory 'baddir'? y rm: cannot remove 'baddir': Directory not empty With this patch I see the following behavior, which lets the user know about the I/O error when rm tries to read baddir's directory entries: $ rm -fr baddir rm: cannot remove 'baddir': Input/output error $ rm -ir baddir rm: cannot remove 'baddir': Input/output error * src/remove.c (Ternary): Remove. All uses removed. (get_dir_status): New static function. (prompt): Last arg is now directory status, not ternary. Return RM_USER_ACCEPTED if user explicitly accepted. All uses changed. Report any significant error in directory status right away. (prompt, rm_fts): Use get_dir_status to get directory status lazily. (excise): Treat any FTS_DNR errno as being more descriptive, not just EPERM and EACCESS. For example, EIO is more descriptive. (rm_fts): Distinguish more clearly between explicit and implied user OK. * src/remove.h (RM_USER_ACCEPTED): New constant. (VALID_STATUS): Treat it as valid. * src/system.h (is_empty_dir): Remove, replacing with ... (directory_status): ... this more-general function. All uses changed. Avoid undefined behavior of looking at a non-null readdir pointer after corresponding closedir. * tests/rm/rm-readdir-fail.sh: Adjust test of internals to match current behavior.
2022-09-24rm: fix readdir testPaul Eggert1-1/+1
* tests/rm/rm-readdir-fail.sh [_DIRENT_HAVE_D_NAMELEN]: Fix off-by-1 bug in directory entry length.
2022-01-02maint: update all copyright year number rangesPádraig Brady50-50/+50
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-07-28doc: modernize usage of “disk” and “core”Paul Eggert1-3/+3
In documentation and comments, don’t assume that secondary storage devices are disk devices. Similarly, don’t assume that main memory uses magnetic cores, which became obsolete in the 1970s. * src/du.c (usage): * src/ls.c (usage): * src/shred.c (usage): Reword to avoid “disk” in usage messages.
2021-01-01maint: update all copyright year number rangesPádraig Brady50-50/+50
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-26rm: do not skip files upon failure to remove an empty dirNishant Nayan1-0/+46
When removing a directory fails for some reason, and that directory is empty, the rm_fts code gets the return value of the excise call confused with the return value of its earlier call to prompt, causing fts_skip_tree to be called again and the next file that rm would otherwise have deleted to survive. * src/remove.c (rm_fts): Ensure we only skip a single fts entry, when processing empty dirs. I.e. only skip the entry having successfully removed it. * tests/rm/empty-immutable-skip.sh: New root-only test. * tests/local.mk: Add it. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/44883
2020-01-01maint: update all copyright year number rangesPádraig Brady49-49/+49
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.
2019-01-01maint: update all copyright year number rangesAssaf Gordon49-49/+49
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.
2018-07-21tests: avoid false failure on sparc 32 bitPádraig Brady1-3/+13
* tests/rm/rm-readdir-fail.sh: Skip the test entirely on 32 bit, so we avoid conflating the 32bit and 64 bit types, as that triggers alignment issues (SIGBUS) on Gentoo sparc. Fixes https://bugs.gnu.org/29886
2018-06-30tests: standardize perl usage in testsPádraig Brady1-1/+0
* tests/cp/fiemap-FMR.sh: Ensure perl is parameterized to $PERL, and ensure require_perl_ is used, so tests are skipped appropriately. * tests/cp/preserve-gid.sh: Likewise. * tests/du/long-from-unreadable.sh: Likewise. * tests/misc/env-S-script.sh: Likewise. * tests/misc/sort-benchmark-random.sh: Likewise. * tests/rm/deep-2.sh: Likewise.
2018-06-20tests: provide an option to relax the need for gdbPádraig Brady1-12/+24
* tests/rm/r-root.sh: gdb provides extra protection, but is not strictly necessary. So provide an option for maintainers to relax the requirements.
2018-06-20rm: add --preserve-root=all to protect mountsPádraig Brady1-3/+6
* src/remove.c (rm_fts): With the --preserve-root=all extension, reject command line arguments that are mount points. * src/remove.h (rm_options): Add preserve_all_root to store config. * src/mv.c (rm_option_init): Init preserve_all_root to false. * src/rm.c (main): Init preserve_all_root as per option. (usage): Describe the new option. * src/remove.c (rm_fts): Lookup the parent device id, and reject the cli argument if a separate file system. * tests/rm/one-file-system.sh: Add a test case. * NEWS: Mention the new feature.
2018-01-01maint: update all copyright year number rangesPádraig Brady49-49/+49
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.
2017-11-07maint: shorten https://lists.gnu.org/archive/html/... linksJim Meyering1-1/+1
Each /archive/html/ part can be replace with /r/. Run this to induce the change: git grep -l archive/html|xargs perl -pi -e 's,/archive/html/,/r/,g' * TODO: Perform that substitution. * bootstrap: Likewise. * src/sort.c (sequential_sort): Likewise. * src/tail.c (tail_file): Likewise. * tests/misc/sort-merge-fdlimit.sh: Likewise. * tests/misc/stty-row-col.sh: Likewise. * tests/misc/unexpand.pl: Likewise. * tests/rm/readdir-bug.sh: Likewise. * tests/tail-2/inotify-rotate.sh: Likewise.
2017-09-19all: prefer HTTPS in URLsPaul Eggert49-50/+50
2017-08-29tests: don't fail tests when failing to write filesPádraig Brady7-37/+35
* tests/sample-test: Use framework_error_ rather than fail=1 * tests/chown/deref.sh: Likewise. * tests/chown/preserve-root.sh: Likewise. * tests/cp/src-base-dot.sh: Likewise. * tests/dd/unblock-sync.sh: Likewise. * tests/du/2g.sh: Likewise. * tests/du/inacc-dest.sh: Likewise. * tests/du/one-file-system.sh: Likewise. * tests/fmt/goal-option.sh: Likewise. * tests/ln/hard-backup.sh: Likewise. * tests/ls/color-dtype-dir.sh: Likewise. * tests/ls/m-option.sh: Likewise. * tests/ls/stat-dtype.sh: Likewise. * tests/ls/time-style-diag.sh: Likewise. * tests/ls/x-option.sh: Likewise. * tests/misc/chcon.sh: Likewise. * tests/misc/nohup.sh: Likewise. * tests/misc/od-N.sh: Likewise. * tests/misc/sort-compress.sh: Likewise. * tests/misc/tac-continue.sh: Likewise. * tests/misc/time-style.sh: Likewise. * tests/mv/backup-dir.sh: Likewise. * tests/mv/dir2dir.sh: Likewise. * tests/rm/dir-no-w.sh: Likewise. * tests/rm/dir-nonrecur.sh: Likewise. * tests/rm/inaccessible.sh: Likewise. * tests/rm/interactive-always.sh: Likewise. * tests/rm/interactive-once.sh: Likewise. * tests/rm/rm3.sh: Likewise. * tests/rm/v-slash.sh: Likewise. * tests/touch/relative.sh: Likewise.
2017-01-01maint: update all copyright year number rangesPádraig Brady49-49/+49
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.
2016-11-29tests: fix ERRORs and false FAILs on some platformsPádraig Brady1-5/+5
* tests/misc/ls-time.sh: Skip the test rather than ERROR when `touch -m -d ...` fails (Hurd). * tests/tail-2/follow-stdin.sh: Avoid false FAILs by ignoring the variances in sterror output. * tests/rm/rm-readdir-fail.sh: Likewise. Also avoid ERRORs on systems that don't define _D_EXACT_NAMELEN.
2016-11-24tests: fix false failure with ASAN in rm-readdir-failPádraig Brady1-3/+5
* tests/rm/rm-readdir-fail.sh: ASAN correctly indicated that fts was writing to freed memory. This was because we reused a single dirent in our readdir() test wrapper. Since fts was deallocating those dirents, we now get a new dirent for each call to our readdir wrapper.
2016-11-22tests: fix false fails due to passing env vars to returns_Pádraig Brady1-1/+2
On BSD /bin/sh it was seen that unexported env vars passed to returns_() would not be propagated to the wrapped command. * cfg.mk (sc_prohibit_env_returns): Add a syntax check to disallow. * tests/misc/csplit-io-err.sh: Rearrange to export vars in a subshell. * tests/rm/rm-readdir-fail.sh: Likewise. * tests/misc/nohup.sh: Export and unset vars around returns_. * tests/misc/printenv.sh: Likewise. Reported by Assaf Gordon
2016-10-04rm: disallow --n alias for --no-preserve-rootPádraig Brady1-0/+9
* src/rm.c (main): Ensure the full --no-preserve-root option is specified, rather than allowing --n etc. * tests/rm/r-root.sh: Add a test case. * NEWS: Mention the change in behavior. Improved by Jim Meyering. Fixes http://bugs.gnu.org/24604
2016-07-06tests: avoid false failure on 32 bit in readdir() testPádraig Brady1-5/+6
* tests/rm/rm-readdir-fail.sh: Since we use the returned dirent from the readdir wrapper it must be the correct type and not just cast. Therefore setup so that we only have to define a wrapper for readdir(), which works appropriately on 32 and 64 bit. Issue reported by Bernhard Voelker, where rm was seen to invoke rmdir() on invalid file names.
2016-06-26tests: verify that fts diagnoses readdir() failuresPeter Benie1-0/+106
* tests/rm/rm-readdir-fail.sh: A new test to simulate readdir() failing immediately or after returning a few entries, and verifying that rm does the appropriate thing. This was initially reported at: http://bugzilla.opensuse.org/show_bug.cgi?id=984910 where it was mentioned that readdir() may fail when an NFS server has a poor readdir cookie implementation.
2016-01-19tests: avoid false failure due to remove() ignoring u-w on NFSPádraig Brady2-2/+2
* tests/rm/rm1.sh: Also remove the group write bit which was required on one NFS setup at least. Note u-w was enough to deny file creation, g-w was also required to deny file removal. * tests/rm/cycle.sh: Likewise. * tests/mv/perm-1.sh: Likewise.
2016-01-18tests: adjust delays to avoid false positivesPádraig Brady1-4/+4
* tests/rm/dangling-symlink.sh: The effective delay was only 1.5s. So delay before the operation, and increase the iteration count by 1 to increase the delay to 6.3s. This failure was noticed once on a FreeBSD 10.2 x86_64 virtual machine. * tests/dd/stats.sh: Remove quotes on sleep argument to ensure arguments are accumulated appropriately. * tests/du/move-dir-while-traversing.sh: sleep before operation, to increase the effective delay from 1.6s to 3.2s. * tests/tail-2/flush-initial.sh: Likewise. * tests/tail-2/pipe-f2.sh: Sleep first so that the effective delay matches the commented value.
2016-01-18test: skip test rather than fail with Solaris 10 sedPádraig Brady1-1/+1
* tests/rm/r-root.sh: This test was seen to ERROR due to sed input not having a terminating '\n'. Therefore just skip with diagnostics upon failure to adjust the error output with sed. Reported by Assaf Gordon.
2016-01-01maint: update all copyright year number rangesPádraig Brady48-48/+48
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.
2015-11-04all: avoid quoting file names when possiblePádraig Brady5-7/+7
Quote file names using the "shell-escape" or "shell-escape-always" methods, which quote as appropriate for most shells, and better support copy and paste of presented names. The "always" variant is used when the file name is embedded in an error message with surrounding spaces. * cfg.mk (sc_error_shell_quotes): A new syntax check rule to suggest quotef() where appropriate. (sc_error_shell_always_quotes): Likewise for quoteaf(). * src/system.h (quotef): A new define to apply shell quoting when needed. I.E. when shell character or ':' is present. (quoteaf): Likewise, but always quote. * src/*.c: Use quotef() and quoteaf() rather than quote() where appropriate. * tests/: Adjust accordingly.
2015-10-15tests: avoid false failure in rm/r-root.sh with gdb warningsPádraig Brady1-27/+32
* tests/rm/r-root.sh: Skip the test if there are gdb warnings that will impact further stderr checks. For example some buggy gdb versions may report "Got object file from memory but can't read symbols: File truncated". Also fix an incorrect stderr check from the previous change. Reported by Bernhard Voelker.
2015-10-15tests: avoid false failure in rm/r-root.sh under loadPádraig Brady1-26/+68
* tests/rm/r-root.sh: Use gdb rather than timeout(1) as the last resort protection against unlinkat() calls. The timeout of 2s was susceptible to false positives under load, and gdb is stronger protection in any case. We remove the "expensive" tag on this test also since it should be robust. Reported by Jim Meyering.
2015-09-22maint: use adaptive approach for `ulimit -v` based testsBernhard Voelker1-11/+19
When configured with either 'symlinks' or 'shebangs' as value for the --enable-single-binary option, tests based on `ulimit -v` are skipped. The reason is that the multicall 'coreutils' binary requires much more memory due to shared libraries being loaded, and the size of the 'date' binary (~290KiB) compared to the multicall binary (~5MiB), of course. Finally, in the case of 'shebangs', the starting shell requires more memory, too Instead of using hard-coded values for the memory limit, use an adaptive approach: first determine the amount of memory for a similar, yet more trivial invocation of the command, and then do the real test run using that limit (plus some buffer in some cases). * init.cfg (require_ulimit_v_): Remove function. (get_min_ulimit_v_): Add function to determine the minimum memory limit required for a given command in an adaptive way. * cfg.mk (sc_prohibit_test_ulimit_without_require_): Change the name of the above function in the syntax-check rule. * tests/cp/link-heap.sh: Use the above function to determine the minimum memory required to run a command simpler than in the real test run. Use that limit plus a buffer there. While at it, change to list of commands in the subshell to fail also if the beginning `ulimit -v` fails. * tests/dd/no-allocate.sh: Likewise. * tests/misc/csplit-heap.sh: Likewise. * tests/misc/cut-huge-range.sh: Likewise. * tests/misc/head-c.sh: Likewise. * tests/misc/printf-surprise.sh: Likewise. * tests/split/line-bytes.sh: Likewise. * tests/rm/many-dir-entries-vs-OOM.sh: Likewise - doing it separately for each program under test.
2015-07-03tests: avoid side effects of $SHELL environment variablePádraig Brady1-1/+0
Since non interactive shells don't generally set $SHELL, its value is propagated through the tests and may cause issues; for example if $SHELL implicitly adjusts $PATH when run. Instead we set $SHELL to that determined by the posix-shell module, and use that consistently for all test sub scripts, including those created thorugh the `split --filter` command. * tests/local.mk: Explicitly set $SHELL to $(PREFERABLY_POSIX_SHELL) which defaults to $CONFIG_SHELL and thus usually /bin/sh. * tests/envvar-check: Remove bash environment variables with side effects, in case /bin/bash was selected for $SHELL. * tests/misc/help-version.sh: Remove redundant initialization of $SHELL. * tests/install/strip-program.sh: Use $SHELL for sub script. * tests/misc/sort-compress-hang.sh: Likewise. * tests/misc/sort-compress-proc.sh: Likewise. * tests/misc/sort-compress.sh: Likewise. * tests/misc/timeout-group.sh: Likewise. * tests/rm/fail-eperm.xpl: Remove redundant elision of bash env vars. * tests/misc/pwd-long.sh: Likewise.
2015-06-25tests: avoid false failures with LD_PRELOAD=libasan.so.2Pádraig Brady1-1/+1
The LD_PRELOAD checks by -fsanitize=address are overly strict: https://groups.google.com/forum/#!topic/address-sanitizer/jEvOJgkDqQk A workaround is to first export LD_PRELOAD=libasan.so.2 The tests below are adjusted so that workaround is not discarded. * tests/cp/no-ctx.sh: Append to $LD_PRELOAD. * tests/df/no-mtab-status.sh: Likewise. * tests/df/skip-duplicates.sh: Likewise. * tests/ls/getxattr-speedup.sh: Likewise. * tests/rm/r-root.sh: Likewise. * tests/cp/nfs-removal-race.sh: Likewise. Also check that LD_PRELOAD is effective to aid future maintainability and avoid false failure if libasan.so.2 is not preloaded.
2015-05-11tests: cleanup background processes upon interruptionPádraig Brady2-6/+9
Reap background processes so that: - Stray processes aren't left on the system - Files aren't held open causing deletion issues on NFS - Partitions used to run the tests from can be unmounted * tests/tail-2/F-vs-missing.sh: Add the `kill && wait` of the background $pid(s) to cleanup_(). * tests/tail-2/F-vs-rename.sh: Likewise. * tests/tail-2/f-vs-rename.sh: Likewise. * tests/tail-2/append-only.sh: Likewise. * tests/tail-2/assert-2.sh: Likewise. * tests/tail-2/assert.sh: Likewise. * tests/tail-2/flush-initial.sh: Likewise. * tests/tail-2/inotify-hash-abuse.sh: Likewise. * tests/tail-2/inotify-hash-abuse2.sh: Likewise. * tests/tail-2/inotify-race.sh: Likewise. * tests/tail-2/inotify-rotate-resources.sh: Likewise. * tests/tail-2/inotify-rotate.sh: Likewise. * tests/tail-2/pid.sh: Likewise. * tests/tail-2/pipe-f2.sh: Likewise. * tests/tail-2/retry.sh: Likewise. * tests/tail-2/symlink.sh: Likewise. * tests/tail-2/tail-n0f.sh: Likewise. * tests/tail-2/wait.sh: Likewise. * tests/cp/existing-perm-race.sh: Likewise. * tests/cp/file-perm-race.sh: Likewise. * tests/cp/parent-perm-race.sh: Likewise. * tests/cp/sparse-to-pipe.sh: Likewise. * tests/dd/stats.sh: Likewise. * tests/du/move-dir-while-traversing.sh: Likewise. * tests/misc/cat-buf.sh: Likewise. * tests/misc/help-version.sh: Likewise. * tests/misc/printf-surprise.sh: Likewise. * tests/misc/sort-compress-proc.sh: Likewise. * tests/misc/sort-spinlock-abuse.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/misc/tac-continue.sh: Likewise. * tests/misc/timeout-group.sh: Likewise. * tests/mv/i-3.sh: Likewise. * tests/rm/dangling-symlink.sh: Likewise. * tests/rm/isatty.sh: Likewise. * cfg.mk (sc_prohibit_test_background_without_cleanup_): A new syntax-check to ensure cleanup_() is defined when background tasks are created in a test.
2015-01-31doc,maint: fix use of "i.e." in documentation and commentsBernhard Voelker1-1/+1
To align with all other places (and correct grammar), change all upper-case "I.E." to "I.e.". Furthermore, ensure that "i.e." is followed by a comma. Finally, ensure to use a double-space before "I.e.," at the beginning of a sentence. The following was used to change all offending uses (apart from old ChangeLog files): $ git grep -liF 'i.e.' \ | xargs sed -i \ -e 's/I\.E\./I.e./g' \ -e 's/\. \(I\.e\.\)/. \1/g' \ -e 's/\([Ii]\.e\.\)\( \)/\1,\2/g' \ -e 's/\([Ii]\.e\.\)$/\1,/g' * cfg.mk (sc_prohibit_uppercase_id_est): Add new rule. (sc_ensure_double_space_after_dot_before_id_est): Likewise. (sc_ensure_comma_after_id_est): Likewise. (old_NEWS_hash): Refresh hash via "make update-NEWS-hash". * NEWS: Change use of "id est" abbreviation via the above command. * README: Likewise. * README-prereq: Likewise. * doc/coreutils.texi: Likewise. * gl/lib/rand-isaac.c: Likewise. * gl/lib/tempname.c.diff: Likewise. * man/stdbuf.x: Likewise. * src/cat.c: Likewise. * src/copy.c: Likewise. * src/copy.h: Likewise. * src/cp.c: Likewise. * src/cut.c: Likewise. * src/dd.c: Likewise. * src/df.c: Likewise. * src/fiemap.h: Likewise. * src/longlong.h: Likewise. * src/ls.c: Likewise. * src/numfmt.c: Likewise. * src/pr.c: Likewise. * src/shred.c: Likewise. * src/shuf.c: Likewise. * src/split.c: Likewise. * tests/Coreutils.pm: Likewise. * tests/df/df-symlink.sh: Likewise. * tests/df/skip-rootfs.sh: Likewise. * tests/init.sh: Likewise. * tests/ls/color-norm.sh: Likewise. * tests/misc/basename.pl: Likewise. * tests/misc/ls-misc.pl: Likewise. * tests/misc/md5sum-bsd.sh: Likewise. * tests/misc/shred-exact.sh: Likewise. * tests/misc/sort.pl: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/misc/tac-continue.sh: Likewise. * tests/rm/r-root.sh: Likewise. * tests/tail-2/symlink.sh: Likewise.
2015-01-14tests: use compare-vs-/dev/null instead of 'test -s'Bernhard Voelker1-1/+1
When some program produces unexpected output, that use of compare-vs-/dev/null will ensure that the surprising output is printed in the test's output. With "test -s err" only, one would have to instrument and rerun in order to see the offending output. * cfg.mk (sc_prohibit_and_fail_1): Exempt 'compare' from this check. * tests/dd/misc.sh: Change "tests -s ... || fail=1" to "compare /dev/null ... && fail=1". * tests/misc/nice.sh: Likewise. * tests/rm/read-only.sh: Likewise. * tests/tail-2/inotify-race.sh: Likewise. * tests/touch/no-dereference.sh: Likewise. Suggested by Jim Meyering in http://lists.gnu.org/archive/html/coreutils/2015-01/msg00042.html
2015-01-14tests: add extra protection against unexpected exitsPádraig Brady6-15/+11
Many tests use `program ... && fail=1` to ensure expected error situations are indicated. However that would mask an unexpected exit (like a crash). Therefore explicitly check the expected exit code. Note where error messages are also verified, the extra protection is not added. * tests/init.sh (returns_): A new helper function to check the return code of a command, and used throughout the tests. * cfg.mk (sc_prohibit_and_fail_1): Add a syntax check to avoid new instances of this issue.
2015-01-01maint: update all copyright year number rangesPádraig Brady48-48/+48
Run "make update-copyright" and then... * tests/sample-test: Adjust to use the single most recent year. * tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message, so that year is updated automatically in future.
2014-08-01chroot: perform chdir("/") again unless new --skip-chdir is specifiedBernhard Voelker2-3/+5
Since commit v8.22-94-g99960ee, chroot(1) skips the chroot(2) syscall for "/" arguments (and synonyms). The problem is that it also skips the following chdir("/") call in that case. The latter breaks existing scripts which expect "/" to be the working directory inside the chroot. While the first part of the change - i.e., skipping chroot("/") - is okay for consistency with systems where it might succeed for a non-root user, the second part might be malicious, e.g. cd /home/user && chroot '/' bin/foo In the "best" case, chroot(1) could not execute 'bin/foo' with ENOENT, but in the worst case, chroot(1) would execute '/home/user/bin/foo' in the case that exists - instead of '/bin/foo'. Revert that second part of the patch, i.e., perform the chdir("/) in the common case again - unless the new --skip-chdir option is specified. Restrict this new option to the case of "/" arguments. * src/chroot.c (SKIP_CHDIR): Add enum. (long_opts): Add entry for the new --skip-chdir option. (usage): Add --skip-chdir option, and while at it, move the other to options into alphabetical order. (main): Accept the above new option, allowing it only in the case when NEWROOT is the old "/". Move down the chdir() call after the if-clause to ensure it is run in any case - unless --skip-chdir is specified. Add a 'newroot' variable for the new root directory as it is used in a couple of places now. * tests/misc/chroot-fail.sh: Invert the last tests which check the working directory of the execvp()ed program when a "/"-like argument was passed: now expect it to be "/" - unless --skip-chdir is given. * doc/coreutils.texi (chroot invocation): Document the new option. Document that chroot(1) usually calls chdir("/") unless the new --skip-chdir option is specified. Sort options. * NEWS (Changes in behavior): Mention the fix. (New features): Mention the new option. * init.cfg (nonroot_has_perm_): Add chroot's new --skip-chdir option. * tests/cp/preserve-gid.sh (t1): Likewise. * tests/cp/special-bits.sh: Likewise. * tests/id/setgid.sh: Likewise. * tests/misc/truncate-owned-by-other.sh: Likewise. * tests/mv/sticky-to-xpart.sh: Likewise. * tests/rm/fail-2eperm.sh: Likewise. * tests/rm/no-give-up.sh: Likewise. * tests/touch/now-owned-by-other.sh: Likewise. Reported by Andreas Schwab in http://bugs.gnu.org/18062