mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-02-16 12:22:01 +02:00
b5c421a78431e707a3713df2de9e08e00f63feff
When a program's output becomes a broken pipe, future attempts to write to that ouput will fail (SIGPIPE/EPIPE). Once it is known that all future write attepts will fail (due to broken pipes), in many cases it becomes pointless to wait for further input for slow devices like ttys. Ideally, a program could use this information to exit early once it is known that future writes will fail. Introduce iopoll() to wait on a pair of fds (input & output) for input to become ready or output to become a broken pipe. This is relevant when input is intermittent (a tty, pipe, or socket); but if input is always ready (a regular file or block device), then a read() will not block, and write failures for a broken pipe will happen normally. Introduce iopoll_input_ok() to check whether an input fd is relevant for iopoll(). Experimentally, broken pipes are only detectable immediately for pipes, but not sockets. Errors for other file types will be detected in the usual way, on write failure. Introduce iopoll_output_ok() to check whether an output fd is suitable for iopoll() -- namely, whether it is a pipe. iopoll() is best implemented with a native poll(2) where possible, but fall back to a select(2)-based implementation platforms where there are portability issues. See also discussion in tail.c. In general, adding a call to iopoll() before a read() in filter programs also allows broken pipes to "propagate" backwards in a shell pipeline. * src/iopoll.c, src/iopoll.h (iopoll): New function implementing broken pipe detection on output while waiting for input. (IOPOLL_BROKEN_OUTPUT, IOPOLL_ERROR): Return codes for iopoll(). (IOPOLL_USES_POLL): Macro for poll() vs select() implementation. (iopoll_input_ok): New function to check whether an input fd is relevant for iopoll(). (iopoll_output_ok): New function to check whether an input fd is suitable for iopoll(). * src/local.mk (noinst_HEADERS): add src/iopoll.h.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
These are the GNU core utilities. This package is the union of the GNU fileutils, sh-utils, and textutils packages. Most of these programs have significant advantages over their Unix counterparts, such as greater speed, additional options, and fewer arbitrary limits. The programs that can be built with this package are: [ arch b2sum base32 base64 basename basenc cat chcon chgrp chmod chown chroot cksum comm coreutils cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold groups head hostid hostname id install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test timeout touch tr true truncate tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes See the file NEWS for a list of major changes in the current release. If you obtained this file as part of a "git clone", then see the README-hacking file. If this file came to you as part of a tar archive, then see the file INSTALL for general compilation and installation instructions, or README-install for system and coreutils specific instructions. Like the rest of the GNU system, these programs mostly conform to POSIX, with BSD and other extensions. For closer conformance, or conformance to a particular POSIX version, set the POSIXLY_CORRECT and the _POSIX2_VERSION environment variables, as described in the documentation under "Standards conformance". The ls, dir, and vdir commands are all separate executables instead of one program that checks argv[0] because people often rename these programs to things like gls, gnuls, l, etc. Renaming a program file shouldn't affect how it operates, so that people can get the behavior they want with whatever name they want. Special thanks to Paul Eggert, Brian Matthews, Bruce Evans, Karl Berry, Kaveh Ghazi, and François Pinard for help with debugging and porting these programs. Many thanks to all of the people who have taken the time to submit problem reports and fixes. All contributed changes are attributed in the commit logs. And thanks to the following people who have provided accounts for portability testing on many different types of systems: Bob Proulx, Christian Robert, François Pinard, Greg McGary, Harlan Stenn, Joel N. Weber, Mark D. Roth, Matt Schalit, Nelson H. F. Beebe, Réjean Payette, Sam Tardieu. Thanks to Michael Stone for inflicting test releases of this package on Debian's unstable distribution, and to all the kind folks who used that distribution and found and reported bugs. Note that each man page is now automatically generated from a template and from the corresponding --help usage message. Patches to the template files (man/*.x) are welcome. However, the authoritative documentation is in texinfo form in the doc directory. *************** Feature requests: --------------- If you would like to add a new feature, please try to get some sort of consensus that it is a worthwhile change. One way to do that is to send mail to coreutils@gnu.org including as much description and justification as you can. Based on the feedback that generates, you may be able to convince us that it's worth adding. Please also consult the list of previously discussed but ultimately rejected feature requests at: https://www.gnu.org/software/coreutils/rejected_requests.html *************** Reporting bugs: --------------- Send bug reports, questions, comments, etc. to bug-coreutils@gnu.org. To suggest a patch, see the files README-hacking and HACKING for tips. All of these programs except 'test' recognize the '--version' option. When reporting bugs, please include in the subject line both the package name/version and the name of the program for which you found a problem. If you have a problem with 'sort', try running 'sort --debug', as it can often help find and fix problems without having to wait for an answer to a bug report. If the debug output does not suffice to fix the problem on your own, please compress and attach it to the rest of your bug report. IMPORTANT: if you take the time to report a test failure, please be sure to include the output of running 'make check' in verbose mode for each failing test. For example, if the test that fails is tests/df/df-P.sh, then you would run this command: make check TESTS=tests/df/df-P.sh VERBOSE=yes SUBDIRS=. >> log 2>&1 For some tests, you can get even more detail by adding DEBUG=yes. Then include the contents of the file 'log' in your bug report. *************************************** There are many tests, but nowhere near as many as we need. Additions and corrections are very welcome. If you see a problem that you've already reported, feel free to re-report it -- it won't bother us to get a reminder. Besides, the more messages we get regarding a particular problem the sooner it'll be fixed -- usually. If you sent a complete patch and, after a couple weeks you haven't received any acknowledgement, please ping us. A complete patch includes a well-written ChangeLog entry, unified (diff -u format) diffs relative to the most recent test release (or, better, relative to the latest sources in the public repository), an explanation for why the patch is necessary or useful, and if at all possible, enough information to reproduce whatever problem prompted it. Plus, you'll earn lots of karma if you include a test case to exercise any bug(s) you fix. Here are instructions for checking out the latest development sources: https://savannah.gnu.org/git/?group=coreutils For general documentation on the coding and usage standards this distribution follows, see the GNU Coding Standards at: https://www.gnu.org/prep/standards/ For any copyright year range specified as YYYY-ZZZZ in this package note that the range specifies every single year in that closed interval. ======================================================================== Copyright (C) 1998-2023 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the "GNU Free Documentation License" file as part of this distribution.
Description
These are the GNU core utilities. This package is the union of
the GNU fileutils, sh-utils, and textutils packages.
Languages
C
57.4%
Shell
26.6%
Perl
11.5%
Makefile
2.3%
M4
1%
Other
1.2%