aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tail-2 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-06-19tests: move tests to a directory per utilitySylvestre Ledru32-2155/+0
* cfg.mk: Adjust syntax check exclusion paths. * tests/local.mk: Adjust for renamed tests.
2023-03-18tests: aix: avoid unsupported functionalityPádraig Brady1-1/+5
* tests/misc/tee.sh: AIX doesn't support detecting closed outputs either with poll() or select() so avoid testing that functionality. * tests/tail-2/pipe-f.sh: Likewise.
2023-02-26tests: avoid gdb on macOSPádraig Brady2-0/+6
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-01-01maint: update all copyright year number rangesPádraig Brady32-32/+32
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-04-13tail: detect closed stdout on SolarisPádraig Brady1-2/+2
* src/tail.c (check_output_alive): Use poll() on Solaris. Also handle POLLHUP, which Solaris returns in this case. * tests/tail-2/pipe-f.sh: Use `head -n2` rather than `sed 2q` as Solaris sed does not exit in this case. * NEWS: Mention the improvement. Reported by Bruno Haible.
2022-01-02maint: update all copyright year number rangesPádraig Brady32-32/+32
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-09-20tests: avoid rare race in tail-2/F-vs-rename.shPádraig Brady1-22/+24
* tests/tail-2/F-vs-rename.sh: Keep stdout and stderr separate, so that interspersion doesn't impact regex checks. Also wait for each file's data to be printed to avoid multiple writes to a file to be printed in a single iteration, which would impact the regex checks. Also we refactor the check function, rather than repeatedly redefining variations.
2021-09-17tests: fix rare false failure in tail-2/F-vs-renamePádraig Brady1-0/+5
This is wrong fix really, as only introducing delay I think. * tests/tail-2/F-vs-rename.sh: Avoid a rare false failure due to a race in the test. Now wait until tail has noticed that b is replaced before writing to a, so that the subsequent write of "y" to b will be displayed independently from current contents of b ("x").
2021-07-28doc: modernize usage of “disk” and “core”Paul Eggert1-1/+1
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-06-26tail: fix abuse2 test racePaul Eggert1-2/+2
* tests/tail-2/inotify-hash-abuse2.sh (fastpoll): Fix race where tailed file ‘f’ temporarily did not exist.
2021-01-01maint: update all copyright year number rangesPádraig Brady32-32/+32
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-01-01maint: update all copyright year number rangesPádraig Brady32-32/+32
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-03-06tests: tail-2/pipe-f: avoid false failure closing stdoutPádraig Brady1-2/+7
* tests/tail-2/pipe-f.sh: Check closing stdout with >&- is effective, which avoids a false failure on NetBSD 7.1 Reported by Assaf Gordon
2019-01-20tail: fix handling of broken pipes with SIGPIPE ignoredPádraig Brady1-5/+14
* init.cfg (trap_sigpipe_or_skip_): A new function refactored from... * tests/misc/printf-surprise.sh: ...here. * tests/misc/seq-epipe.sh. Likewise. * src/tail.c (die_pipe): Ensure we exit upon sending SIGPIPE. * tests/tail-2/pipe-f.sh: Ensure we exit even if SIGPIPE is ignored. * NEWS: Mention the bug fix.
2019-01-12tail: don't exit immediately with filters on AIXPádraig Brady1-1/+4
* src/tail.c: Fix the check_output_available check on AIX. Note we don't use poll for all systems as the overhead of adding the gnulib poll module wouldn't be worth it just for this single use. * tests/tail-2/pipe-f.sh: Fix the test which always passed due to only the exit code of sleep being checked. * NEWS: Mention the bug fix and rearrange alphabetically. Fixes http://bugs.gnu.org/33946
2019-01-01maint: update all copyright year number rangesAssaf Gordon32-32/+32
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-01-01maint: update all copyright year number rangesPádraig Brady32-32/+32
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-12-23tests: avoid false failure on AIX 7.2Pádraig Brady1-1/+1
* tests/tail-2/pipe-f.sh: Close stdout in a subshell to ensure the current shell isn't impacted. Subsequent piped commands like `echo foo | blah` were seen to fail due to the previous closing of stdout. Reported by Assaf Gordon.
2017-12-10tail: fix tailing non seekable files on certain systemsPádraig Brady1-4/+8
* src/tail.c (tail_bytes): On systems were blksize_t is unsigned and the same size or wider than off_t (android for example), our initialized (off_t) -1 would be promoted to unsigned before comparison, and thus fail to follow the appropriate path. * tests/tail-2/tail-c.sh: Add a test case. * NEWS: Mention the fix. This issue was introduced in commit v8.23-47-g2662702 Reported at https://github.com/termux/termux-app/issues/233
2017-11-18tail: seek to the end of block devicesPádraig Brady1-0/+48
* src/tail.c (tail_bytes): Try lseek(..., SEEK_END) when we can't determine the file size. * tests/tail-2/end-of-device.sh: Add a new root only test. * tests/local.mk: Reference the new test. * NEWS: Mention the improvement. Paul Eggert suggested using lseek() (rather than ioctl(BLKGETSIZE64)). Fixes https://bugs.gnu.org/29259
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 Eggert31-32/+32
2017-08-24tail: reinstate inotify use with FIFOsPádraig Brady1-1/+1
commit v8.27-44-g18f6b22 was too aggressive in only allowing inotify use with regular files. This will support responsive processing of `tail -f fifo | ...` * src/tail.c (any_non_regular): Adjust to allow FIFOs since inotify supports these well. * tests/tail-2/inotify-only-regular.sh: Adjust comment.
2017-06-17tail: only use inotify with regular filesPádraig Brady1-0/+32
* src/tail.c (any_non_regular): A new function to check passed files. (main): Use the above to skip inotify if any non regular files passed like /dev/tty or /dev/ttyUSB0 etc. * tests/tail-2/inotify-only-regular.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/21265 and http://bugs.gnu.org/27368
2017-06-17tail: with -f don't warn if doing a blocking read of a ttyPádraig Brady1-1/+20
* src/tail.c: (main): Only issue the warning about -f being ineffective when we're not going into simple blocking mode. * tests/tail-2/follow-stdin.sh: Ensure the warning is output correctly. Fixes http://bugs.gnu.org/27368
2017-06-11tail: exit promptly when output no longer writablePádraig Brady1-4/+17
This will support use cases like: tail -f file.log | grep -q trigger && process_immediately * src/tail.c (check_output_alive): A new function that uses select on fifos or pipes to detect if they're broken. (tail_forever): Call check_output_alive() periodically. (tail_forever_inotify): Merge the select() call from check_output_alive() into the select() originally present for the --pid case, and adjust accordingly. * tests/tail-2/pipe-f.sh: Add test cases. * NEWS: Mention the improvement.
2017-06-07tail: with --pid, ensure all inotify events are processedPádraig Brady1-1/+1
* NEWS: Mention the bug fix. * src/tail.c (tail_forever_inotify): With --pid, avoid waiting for new events if there are still events to process. * tests/tail-2/inotify-dir-recreate.sh: Adjust to trigger.
2017-06-07tests: fix issues with recently added tail testPádraig Brady1-2/+8
* tests/tail-2/inotify-dir-recreate.sh: Skip when inotify is not usable. Also remove a bash specific &> construct.
2017-04-05tail: revert to polling if a followed directory is replacedSebastian Kisela1-0/+82
* src/tail.c (tail_forever_inotify): Add the IN_DELETE_SELF flag when creating watch for the parent directory. After the parent directory is removed, an event is caught and then we switch from inotify to polling mode. Till now, inotify has always frozen because it waited for an event from a watched dir, which has been already deleted and was not added again. * tests/tail-2/inotify-dir-recreate.sh: Add a test case. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/26363 Reported at https://bugzilla.redhat.com/1283760
2017-02-08tail: fix output of redundant headers when resumingJanne Snabb1-0/+81
* src/tail.c (check_fspec): Only enable printing of the file header if we've actually read some data and this is a new file. Also move printing of the file header to... (dump_remainder): ...here, to allow printing only when data read. * tests/tail-2/overlay-headers.sh: A new test for suspension and resumption of tail. * tests/local.mk: Reference the new test. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/23539
2017-02-08tests: fix tail test race causing false failurePádraig Brady1-2/+3
* tests/tail-2/retry.sh: The replacement of the "missing" directory is not atomic, and therefore tail(1) can take a different path, especially if there is a delay between the rmdir(2) and creat(2). This is noticeable for example with `make coverage` because in that case the coverage files written by rmdir(1) on exit, induce a significant delay thus triggering the issue.
2017-02-08tail: fix erroneous status about 'giving up' on filePádraig Brady1-1/+2
* src/tail.c (recheck): Set f->ignore before we use it to show the appropriate error. * tests/tail-2/retry.sh: Ensure the "giving up" message is not presented.
2017-01-01maint: update all copyright year number rangesPádraig Brady28-28/+28
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-12-28tests: avoid false fails on NFS due to EPERMPádraig Brady1-3/+3
* tests/chgrp/basic.sh: On some NFS setups a user is not allowed to set a group on a file even if a member of that group. Therefore skip this test on remote file systems. * tests/chgrp/default-no-deref.sh: Likewise. * tests/chgrp/no-x.sh: Likewise. * tests/chgrp/posix-H.sh: Likewise. * tests/chgrp/recurse.sh: Likewise. * tests/tail-2/inotify-rotate-resources.sh: Change to skipping on remote file systems in the standard way.
2016-11-29tests: fix ERRORs and false FAILs on some platformsPádraig Brady1-4/+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-27tail: fix uninitialized memory read when failing to read filePádraig Brady1-0/+12
Reproduced under UBSAN with `tail -f <&-` giving: tail.c:2220:18: runtime error: load of value 190, which is not a valid value for type ‘_Bool' * src/tail.c (tail_file): Ensure f->ignore is initialized in all cases where we can't tail the specified file. * tests/tail-2/follow-stdin.sh: Add a test case which checks stderr has no UBSAN warnings. Fixes http://bugs.gnu.org/25041
2016-11-22tests: fix recent tail-2 test regressionsPádraig Brady2-5/+6
* tests/tail-2/pipe-f.sh: Avoid issue with readable directories on BSD systems. * tests/tail-2/retry.sh: Likewise. Reported by Assaf Gordon
2016-11-13tests: use "returns_" rather than explicit comparison with "$?"Jim Meyering2-16/+8
The previous "returns_"-using change failed to convert many uses of "$?". Convert all but two of the remaining ones. * tests/ls/stat-vs-dirent.sh: Likewise. * tests/misc/head-write-error.sh: Likewise. * tests/misc/nice.sh: Likewise. * tests/misc/nohup.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/misc/sync.sh: Likewise. * tests/tail-2/pid.sh: Likewise. * tests/tail-2/wait.sh: Likewise. Thanks to Bernhard Volker for spotting this.
2016-11-13tests: use "returns_" rather than explicit comparison with "$?"Jim Meyering1-2/+1
* tests/chmod/no-x.sh: Likewise. * tests/cp/no-deref-link1.sh: Likewise. * tests/cp/no-deref-link2.sh: Likewise. * tests/cp/no-deref-link3.sh: Likewise. * tests/du/move-dir-while-traversing.sh: Likewise. * tests/ls/infloop.sh: Likewise. * tests/ls/stat-failed.sh: Likewise. * tests/ls/time-style-diag.sh: Likewise. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/env-null.sh: Likewise. * tests/misc/env.sh: Likewise. * tests/misc/nice-fail.sh: Likewise. * tests/misc/printenv.sh: Likewise. * tests/misc/timeout.sh: Likewise. * tests/tail-2/follow-name.sh: Likewise.
2016-11-10tail: only retry file open if --retry specifedPádraig Brady2-4/+22
* src/tail.c (tail_file): On failure to open a file, set ignore=true when --retry is not specified. * tests/tail-2/assert-2.sh: Adjust to the new behavior. * tests/tail-2/retry.sh: Add a test case. Also change from `tail ... && fail=1` to the more robust `returns_ 1 ...` construct which detects segfaults etc. * NEWS: Document the fix.
2016-11-09tail: ensure -f --retry 'missing' handles truncationPádraig Brady1-4/+9
* src/tail.c (tail_forever): The BLOCKING optimization is only enabled for non regular files (which can't be truncated), so ensure we don't enable that unless we've a valid file descriptor. * tests/tail-2/retry.sh: Add a test case. * NEWS: Mention the bug fix.
2016-11-08tail: terminate when following pipes and untailable non pipesPádraig Brady1-1/+10
* src/tail.c (ignore_pipe_or_fifo): Mark the descriptor as -1 for pipes so that any_live_files() detects correctly that the entry is no longer live. * tests/tail-2/pipe-f.sh: Add a test case. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/24903 which was detected using Symbolic Execution techniques developed in the course of the SYMBIOSYS research project at COMSYS, RWTH Aachen University.
2016-11-07maint: misc tweaks to recent changesPádraig Brady1-1/+1
* doc/coreutils.texi(cut invocation): Give a more accurate description of cut field handling limitations. * tests/misc/stat-fmt.sh: Fix the test header to be more general. * tests/tail-2/retry.sh: Spellings.
2016-09-28tail: -F now always processes initially untailable filesPádraig Brady1-5/+29
which was not the case when inotify was not available. * src/tail.c (any_live_files): Simplify, since the IGNORE flag is now only set when a file should be ignored indefinitely. (recheck): Only output the "giving up on name" message when that's actually the case. Only set the IGNORE flag when ignoring a file indefinitely. (tail_file): Likewise. * tests/tail-2/retry.sh: Add a test case. Also run all existing test cases with and without inotify. NEWS: Mention the fix. THANKS.in: Add the reporter. Fixes http://bugs.gnu.org/24495 which was detected using Symbolic Execution techniques developed in the course of the SYMBIOSYS research project at COMSYS, RWTH Aachen University.
2016-01-19tests: avoid false failure in tail inotify testPádraig Brady1-1/+1
* tests/tail-2/wait.sh: Restrict inotify specific test portion to local file systems and also not with ---disable-inotify specified. Failure noticed on NFS.
2016-01-18tests: adjust delays to avoid false positivesPádraig Brady2-8/+3
* 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-10tests: fix races wrt output files of background processesBernhard Voelker2-2/+3
At least the false positive in tail-2/follow-stdin.sh could be seen on a 4-core i5 system with -j8. Fix similar cases. too. * tests/tail-2/follow-stdin.sh: Empty the 'out' file in each iteration. Otherwise, under heavy system load, 'check_tail_output' would see the expected output from the previous round before tail would have the chance to come up in the background. While at it, move the creation of the 'exp' file out of the loop. * tests/dd/stats.sh: Empty the output file of the background process here, too. * tests/misc/cat-buf.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/tail-2/wait.sh: Likewise.
2016-01-01maint: update all copyright year number rangesPádraig Brady28-28/+28
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-10tests: ensure programs are built before testingPádraig Brady2-2/+2
programs may not be built due to missing system dependencies, or any program can be excluded at configure time with --enable-no-install-program. So ensure we're not testing the system versions in these cases. * init.cfg (print_ver_): Call require_built_ first. * tests/misc/tty-eof.pl: Skip programs not built. * tests/Coreutils.pm (run_tests): Likewise. * tests/misc/ls-misc.pl: Use 'env test' rather than abs path. * tests/misc/test-diag.pl: Likewise. * tests/local.mk: Adjust include order for dependencies. * tests/misc/arch.sh: Remove redundant calls to require_built_. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/groups-dash.sh: Likewise. * tests/misc/groups-version.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/cp/acl.sh: Remove problematic call to print_ver_ [gs]etfacl. * tests/mv/acl.sh: Likewise. * cfg.mk (sc_env_test_dependencies): A new syntax check to enforce specifying dependencies with print_ver_ for programs specified through the env command. * du/bigtime.sh: Add new print_ver_ dependencies. * du/max-depth.sh: Likewise. * dd/ascii.sh: Likewise. * tests/ls/capability.sh: Likewise. * tests/ls/root-rel-symlink-color.sh: Likewise. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/readlink-fp-loop.sh: Likewise. * tests/misc/sort-debug-keys.sh: Likewise. * tests/readlink/can-e.sh: Likewise. * tests/readlink/can-f.sh: Likewise. * tests/readlink/can-m.sh: Likewise. * tests/tail-2/inotify-race.sh: Likewise. * tests/tail-2/inotify-race2.sh: Likewise. * tests/touch/no-create-missing.sh: Likewise. * tests/touch/no-dereference.sh: Likewise. * tests/misc/printenv.sh: Tweak to avoid syntax check trigger. * tests/misc/help-version.sh: Likewise. * tests/misc/yes.sh: Likewise. * tests/misc/printf-quote.sh: Use previously unused $prog. * configure.ac (EXTRA_MANS): Add $gl_no_install_prog to the list so that check-x-vs-1 syntax check is satisfied.
2015-10-15tests: avoid false failure in a tail test under loadPádraig Brady1-8/+24
* tests/tail-2/follow-stdin.sh: Use the standard tail testing framework to avoid the race seen under very high load, and also test the non inotify case. Reported by Jim Meyering