Age | Commit message (Collapse) | Author |
|
* src/tail.c (tail_forever): Close FD to avoid leak after a
failed fstat.
|
|
* src/tail.c (check_fspec): Save fstat-induced errno *before*
calling close_fd, not after. Otherwise, the close could well
clobber the global errno, making tail print an invalid diagnostic.
This could happen only with tail -f, and even then, only when
a valid file descriptor were to provoke fstat failure.
|
|
Run "make update-copyright".
|
|
Run this (twice):
git grep -E -l '`.+'\' src/*.[ch] \
|xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
|
|
Run this (twice):
git grep -E -l '`[^ ]+'\' src/*.c \
|xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
|
|
All affected lines end with \ or \n\, so run this command
until it produces no new changes (4 times):
git grep -E -l '`[^ ]+'\''.*\\' src \
|xargs perl -pi -e 's/`([^ ]+'\''.*\\)/'\''$1/'
|
|
Run this command:
perl -0777 -pi -e \
's/fprintf \(stderr, _\("Try `%s --help.*\n.*;/emit_try_help ();/m'\
src/*.c
|
|
Without this change, gcc's -Werror=format would complain that
the '%lx' format requires 'long unsigned int', not 'int'.
* src/tail.c (fremote): Use a temporary variable.
|
|
Run "make update-copyright".
|
|
* src/tail.c (start_lines): Do not form potentially-invalid address.
Use safe_read's return value as a pointer offset only after
ensuring that it is not SAFE_READ_ERROR (size_t)(-1).
Spotted by coverity.
Also, move declaration of "p" to be closer to first use.
|
|
Before, we would use inotify in that case, which would work as long
as updates were taking place locally, but not at all when remote.
Move hard-coded list of known remote FS types into a more
maintainable table in stat.c, alongside the list of FS
names and magic numbers. Generate a new is_local_fs_type function.
* src/Makefile.am (fs-is-local.h): New rule, generated file.
* src/extract-magic: Revamp to parse local/remote keyword after
each magic number in src/stat.c's case statements.
Accept new --local option.
* src/.gitignore: Ignore the generated fs-is-local.h.
* src/tail.c [HAVE_INOTIFY]: Include fs-is-local.h.
(fremote) [HAVE_INOTIFY]: Use the new function in place of
the switch stmt with hard-coded list of FS types.
Emit a warning when processing a file on a file system of unknown type.
* NEWS (Changes in behavior): Mention it.
Suggested by Sven Breuner.
|
|
* src/stat.c (human_fstype): Add a case: fhgfs, 0x19830326.
* src/tail.c (fremote): Add S_MAGIC_FHGFS.
* NEWS (Bug fixes): Update the entry for GPFS to mention FhGFS, too.
Reported by Sven Breuner.
|
|
Because tail's fremote function did not designate GPFS as
a remote file system type, tail -f would mistakenly attempt
to use inotify, which cannot work with a remote file system.
* src/tail.c (fremote): List GPFS as a remote file system type.
* NEWS (Bug fixes): Mention it.
Reported in http://bugs.debian.org/646022.
|
|
* src/tail.c (start_bytes): Increase *READ_POS (not READ_POS)
by the number of bytes read. This is a real bug that happens
to have no consequence in practice. First, this code is exercised
only when tailing-forever a non-regular file by bytes, and with a
start-relative offset, e.g., "mkfifo f; tail -f -c +3 f", but even
then, the invalid READ_POS value does not influence how tail works.
It is stored in the File_spec.size member, but that member is not
used at all in tail_forever_inotify, and in tail_forever, it is
used only when the File_spec refers to a regular file.
|
|
* src/tail.c [HAVE_INOTIFY] (inotify_wd_mask): Declare static.
|
|
* src/tail.c (tail_forever_inotify): Just as without inotify,
tail --follow=name now terminates when the last tailed-by-name file
is unlinked or moved aside. This bug was introduced on 2009-06-15
via commit ae494d4b, "tail: use inotify if it is available".
Reported by Tim Underwood in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286
* NEWS (Bug fixes): Mention this.
* tests/tail-2/follow-name: Test for this.
* tests/Makefile.am (TESTS): Add it.
|
|
* doc/coreutils.texi (tail invocation): Mention it.
* src/tail.c (usage): Likewise.
(tail_forever_inotify): Clarify comment.
|
|
* src/tail.c (fremote): Do not print a diagnostic when
fstatfs (pipe_FD, &buf) fails, as it now does on linux-2.3.38.
This avoids the spurious failure of tests/misc/tail's f-pipe-1
test, when running in input-from-pipe mode.
|
|
Run "make update-copyright".
|
|
* cfg.mk (LINE_LEN_MAX, FILTER_LONG_LINES): New macros.
(sc_long_lines): New rule.
* HACKING: Use shorter URLs to the same material.
* doc/Makefile.am, doc/coreutils.texi, m4/boottime.m4:
* man/help2man, man/stdbuf.x, src/Makefile.am, src/cat.c, src/copy.c:
* src/cp.c, src/dd.c, src/df.c, src/du.c, src/groups.c, src/install.c:
* src/ls.c, src/md5sum.c, src/mv.c, src/od.c, src/pinky.c, src/ptx.c:
* src/readlink.c, src/remove.c, src/rmdir.c, src/setuidgid.c:
* src/sort.c, src/tail.c, src/touch.c, tests/Coreutils.pm:
* tests/cp/existing-perm-race, tests/cp/perm, tests/cp/preserve-gid:
* tests/du/2g, tests/du/long-from-unreadable, tests/init.sh:
* tests/install/basic-1, tests/ls/nameless-uid:
* tests/ls/readdir-mountpoint-inode, tests/misc/chroot-credentials:
* tests/misc/cut, tests/misc/date, tests/misc/join, tests/misc/md5sum:
* tests/misc/sha1sum, tests/misc/sha224sum, tests/misc/sort:
* tests/misc/sort-continue, tests/misc/sort-files0-from:
* tests/misc/sort-rand, tests/misc/stdbuf, tests/misc/tr:
* tests/misc/uniq, tests/mv/atomic, tests/mv/part-fail:
* tests/mv/part-symlink, tests/mv/sticky-to-xpart, tests/pr/pr-tests:
* tests/rm/fail-2eperm, tests/rm/interactive-always:
Reformat to fit within 80 columns.
* doc/Makefile.am (BAD_POSIX_PERL): New macro.
* doc/coreutils.texi: Reword slightly, to make menus and
index lines shorter.
* src/md5sum.c: Redo --help output so that it fits within 79
columns, since that's a bit more portable and all the other --help
strings fit in 79 columns.
|
|
Those options are useful only on systems that lack inotify support
and in the unusual event that a system with inotify support must
resort to polling.
* src/tail.c (usage): Note that the --max-unchanged-stats=N and
--sleep-interval=N options are rarely useful on systems with
inotify support.
* doc/coreutils.texi (tail invocation): Likewise.
|
|
src/tail.c (main): As an optimization, don't bother checking
for stdin or remote files, when ---disable-inotify is specified.
To improve the fix in commit 61b77891, set the disable_inotify
flag when we fall back to polling, so that we recheck remote files.
NEWS: Mention the fix
|
|
* src/tail.c (tail_forever_inotify): Handle the case where
tail --follow=name with inotify, is not able to add a watch on
a specified directory. This may happen due to inotify resource
limits or if the directory is currently missing or inaccessible.
In all these cases, revert to polling which will try to reopen
the file later. Note inotify returns ENOSPC when it runs out
of resources, and instead we report a particular error message,
lest users think one of their file systems is full.
(main): Document another caveat with using inotify, where we
currently don't recheck directories recreated after the
initial watch is setup.
* tests/tail-2/F-vs-rename: Fix the endless loop triggered by
the above issue.
* tests/tail-2/inotify-hash-abuse: Likewise.
* tests/tail-2/wait: Don't fail in the resource exhaustion case.
* tests/tail-2/F-vs-missing: A new test for this failure mode
which was until now just triggered on older buggy linux kernels
which returned ENOSPC constantly from inotify_add_watch().
* NEWS: Mention the fix.
|
|
* src/tail.c (xlseek): Give INT_BUFSIZE_BOUND a variable name,
not a type name.
* src/ls.c (gobble_file, format_user_or_group_width): Likewise.
* src/head.c (elide_tail_bytes_pipe): Likewise.
(elide_tail_lines_seekable, main): Likewise.
[This change is not complete -- there are doubtless other uses
that can be updated in the same way.]
|
|
* src/tail.c [HAVE_INOTIFY && !HAVE_SYS_STATFS_H]: Include <sys/vfs.h>.
|
|
Use this command:
git ls-files | grep -v COPYING \
| xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \
build-aux/update-copyright
|
|
* src/tail.c (usage): Reword tail -F description, so that it no
longer mentions details specific to the non-inotify implementation.
Also, join diagnostic strings (while staying under the 509-byte limit)
to ease formatting of translations. The latter was prompted by
a report from Stéphane Raimbault.
* doc/coreutils.texi (tail invocation): Update description here, too.
|
|
This fixes a bug whereby tail -F would fail to track changes
to a file that was a target of a rename, and when the source of
the rename was another tailed file.
* src/tail.c (tail_forever_inotify): Ensure the wd is not already
present in the hash table before trying to add it. When a new watch
descriptor is added to the `wd_to_name' hash table, check that it is
not already present. If it is present then remove the previous element.
|
|
* src/tail.c (tail_forever_inotify): Avoid modifying fdspec->wd while
it is in the wd_to_name hash table. Once it is removed, it can be
added using the new `wd' as key for the hash table. This fixes the
abort-inducing bug reported by Rob Wortman in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/19372
|
|
* src/tail.c (tail_forever_inotify): s/wd_table/wd_to_name/
|
|
* src/tail.c (tail_forever_inotify): Do not use f[i] in a context
where i may be larger than the largest valid index. In the final
"if" clause in which we'd remove an inotify watch, we might have
used f[n_files]. Use fspec instead, since it is guaranteed to
be defined.
|
|
* tail.c (struct File_spec): Rearrange struct members to decrease
size by 8 bytes to 76,96 on i686,x86_64 respectively.
|
|
* src/tail.c (fremote): Add a comment.
Move definition "up" to precede first use, so we can
remove its prototype and the #if..#endif around each use.
(any_remote_file): Rename from any_remote_files.
|
|
* src/tail.c (struct File_spec): Add a flag to record if file is remote.
(recheck): If we're using inotify then check if the file has gone remote
and if so, drop it with a warning.
(any_remote_files): A new function to check for any open remote files.
(tailable_stdin): A new function to refactor the check for whether
a tailable file was specified through stdin.
(fremote): A new function to check if a file descriptor
refers to a remote file.
(tail_forever_inotify): Add some comments.
(tail_file): Record if a file is remote when initially opened.
(main): Disable inotify if any remote files specified.
Also document the caveat about remounted files not
being noticed by inotify.
* NEWS: Mention the fix.
|
|
This bug showed up via valgrind as a "Conditional jump or move
depends on uninitialized value(s)" error.
* src/tail.c (ignore_fifo_and_pipe): New function.
(main): Use it only when tailing forever.
The code to compute n_viable and mark some F[i] as ignored would call
isapipe on an uninitialized file descriptor. But n_viable and those
.ignored marks are useful/used only when tailing forever. This bug
was introduced via commit f0ff8c73 (7.6), "tail: make the new
piped-stdin test as portable as the old one".
* NEWS (Bug fixes): Mention it.
|
|
Cygwin 1.5 has a broken sleep, and the gnulib tests dragged in
rpl_sleep which then caused a link failure because it wasn't in
libcoreutils.a. We could solve it by using the gnulib sleep module.
However, sleep and usleep may interact poorly with SIGALRM, and they
have less granularity; so it is better to adopt a policy that if we
must sleep, prefer xnanosleep.
* src/sort.c (pipe_fork): Use xnanosleep, to avoid the need for
rpl_sleep on cygwin, and to reduce granularity.
(MAX_FORK_TRIES_COMPRESS, MAX_FORK_TRIES_DECOMPRESS): Increase,
to account for reduction in granularity.
* src/tail.c (tail_file): Use xnanosleep in debug code.
* cfg.mk (sc_prohibit_sleep): New rule.
|
|
Tailing forever and by-name (--follow=name, -F), tail would
sometimes fail to follow a file that had been removed via rename.
If you can't apply this patch and have tail 7.6 or newer, you can
work around the bug via the undocumented --disable-inotify option.
* src/tail.c (tail_forever_inotify): When tailing by name (-F),
do not un-watch a file upon receipt of the IN_MOVE_SELF event.
Reported by Arjan Opmeer in http://bugs.debian.org/548439.
* NEWS (Bug fixes): Mention it.
Also see http://marc.info/?l=coreutils-bug&m=125829031916515
* tests/Makefile.am (TESTS): Add tail-2/inotify-rotate.
* tests/tail-2/inotify-rotate: New test.
|
|
* NEWS (Bug fixes): Mention it.
* src/tail.c (check_fspec): New function.
(tail_forever_inotify): Ensure there is no new data before entering the
inotify events wait loop.
|
|
* src/tail.c (usage): Add missing backslash at the end of a line.
|
|
* src/tail.c (usage): Spell out -n +K.
* THANKS: Update.
Reported by Jan-Pawel Wrozstinski.
|
|
* src/tail.c (tail_forever, tail_forever_inotify): Close a race in
tail_forever_inotify where new data written after the file check by
a now dead process, but before the pid check, is not output. We use
the POSIX guarantee that read() and write() are serialized wrt each
other even in separate processes, to assume full file consistency
after exit() and so poll for new data _after_ the writer has exited.
This also allows us to not redundantly _wait_ for new data if the
process is dead.
* tests/tail-2/pid: Remove the now partially invalid sub second sleep
check as we now don't unconditionally wait, and replace it with a check
for the redundant sleep. Also clarify some of the existing comments.
* NEWS: Mention the fix.
|
|
This is because bitwise operators are:
- confusing and inconsistent in a boolean context
- non short circuiting
- brittle in C89 where bool can be an int (so > 1)
|
|
* src/system.h: Rename emit_bug_reporting_address() to
emit_ancillary_info() and update it to not print the translation
project address in en_* locales, and _do_ print it in the 'C'
(and other) locales so that it's included in the default man page.
Also mention how to invoke the texinfo documentation for each command.
Also move the "hard-locale.h" include to the 8 files that now use it.
* man/help2man: Strip the newly added texinfo reference from the
--help output as a more verbose version is already added by help2man.
Suggestion from C de-Avillez
|
|
* src/tail.c (main): Adapt piped-stdin test to use the same isapipe,
test as was used in the preceding POSIXLY_CORRECT condition.
Remove the now-subsumed POSIXLY_CORRECT test.
Reported by Pádraig Brady.
* doc/coreutils.texi (tail invocation): Document this change.
* NEWS (Changes in behavior): Reclassify, clarify.
|
|
* src/tail.c (record_open_fd): Initialize "->ignore" to false, not 0.
|
|
* src/tail.c (main): Tailing a pipe "forever" is not useful,
and POSIX specifies that tail ignore the -f when there is no
file argument and stdin is a FIFO or pipe. So we do that.
In addition, GNU tail excludes "-" arguments from the list of files
to tail forever, when the associated file descriptor is connected
to a FIFO or pipe. Before this change, ":|tail -f" would hang.
Reported by Ren Yang and Ulrich Drepper.
* tests/tail-2/pipe-f: Test for this.
* tests/tail-2/pipe-f2: Ensure tail doesn't exit early for a fifo.
* tests/Makefile.am (TESTS): Add these tests.
* NEWS (POSIX conformance): Mention it.
|
|
* src/tail.c (main): Adjust today's change to honor the
F[i].ignore flag that may have been set in tail_file.
|
|
* src/tail.c (main) [HAVE_INOTIFY]: When stdin (i.e., "-", or no args,
but not /dev/stdin) is specified on the command line, don't use inotify.
Reported by Bill Brelsford in <http://bugs.debian.org/545422>.
* tests/tail-2/follow-stdin: New file. Test for this.
* tests/Makefile.am (TESTS): Add the test.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".
|
|
* src/tail.c (main): Flush any output from tail_file,
before calling tail_forever_inotify, which can block.
* tests/tail-2/flush-initial: New file. Test for the bug.
* tests/Makefile.am (TESTS): Add tail-2/flush-initial.
* NEWS (Bug fixes): Mention it.
This bug was introduced in coreutils-7.5 via commit ae494d4b,
2009-06-02, "tail: use inotify if it is available".
|
|
* src/tail.c (usage): I read "approximately S seconds"
as "approximately 5 seconds" for approximately 5 seconds.
|