summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2012-09-01maint: update gitignore entriesStefano Lattarini
* src/.gitignore: Here, adding the '.dirstamp' file generated by the C compilation rules.
2012-09-01maint: fix and simplify maintainer checksStefano Lattarini
Some of them can be simplified after the previous changes, some of them have been downright broken by them, and need fixing. * src/local.mk: Adjust some comments. (EXTRA_DIST): Avoid SPACE-TAB sequences. (src/dircolors.h, src/fs.h src/fs-is-local.h): Avoid 8-SPACES indentation. (_sc_check-AUTHORS): Move ... * cfg.mk (sc_check-AUTHORS): ... here (superseding the old rule with the same name, that was just a recursive invocation to it). Adjust the paths of the invoked coreutils programs, to account for the fact that this rule now runs in the top-level build dir, not in the 'src/' subdir. Other minor cosmetic adjustments. (ALL_RECURSIVE_TARGETS): Remove 'sc_option_desc_uppercase' and 'sc_man_file_correlation', since they no longer entail any recursive make invocation. (sc_option_desc_uppercase): Remove dependency from $(all_programs): it isn't actually needed. (check-programs-vs-x): Likewise. Also, fix heading comments to truly reflect what this check does. (all-progs-but-lbracket): Strip the 'src/' prefix from each entry in the list of programs; this avoids a spurious failure in the 'check-programs-vs-x' recipe. (.PHONY): No need to list targets 'sc_man_file_correlation' and 'sc_option_desc_uppercase': they are automatically declared phony by 'maint.mk', being recognized as syntax checks.
2012-09-01build: fix generation of manpages for programs not built by defaultStefano Lattarini
* src/local.mk (dist-hook): Don't use this to ensure all the programs, even the ones disabled by default or by the user, are built (doing so is required to ensure the distributed manpages are properly built). This would build those programs too late anyway, causing errors like: $ make dist make dist-xz am__post_remove_distdir='@:' make[1]: Entering directory `~/src/coreutils' GEN man/arch.1 help2man: can't get '--help' info from man/arch.td/arch make[1]: *** [man/arch.1] Error 127 make[1]: Leaving directory `~/src/coreutils' make: *** [dist] Error 2 Instead, ... * man/local.mk (extra_man_x, extra_man_1): define these ... ($(extra_man_1)): ... and make this depend on $(all_programs). (EXTRA_DIST): Adjust. Adjust some comments as well.
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-09-01build: refactor how lists of coreutils programs are definedStefano Lattarini
This is in preparation of future changes. Still, this patch leaves the build system in a better shape; true, with more indirections, but also with less convoluted and brittle hacks. Unfortunately, this commit also makes some rebuild rules incomplete; that will son be fixed by follow-up patches. * build-aux/gen-lists-of-programs.sh: New, generates autoconf and automake input fragments that define "lists" of all coreutils programs, with further distinctions about how and when these programs should be built (by default; if the system is capable enough; only if the user asks for them explicitly). This is useful to avoid duplicating the definitions of these lists among several files (at least 'configure.ac' 'src/Makefile.am'); such duplication had proved a source of inconsistencies and bugs in the past. And the pre-existing way to avoid such duplication, as implemented in 'configure.ac' before this patch, was overly complex and brittle. * Makefile.am (EXTRA_DIST): Distribute the new script. * bootstrap.conf (bootstrap_post_import_hook): Run the new script to generate 'm4/cu-progs.m4' and 'src/cu-progs.mk'. * .gitignore: Ignore those files. * configure.ac: Include 'm4/cu-progs.m4', and decidedly simplify most of the program lists definition and processing accordingly. * src/Makefile.am: Similarly include 'src/cu-progs.mk', containing definition of variables $(default__progs), $(no_install__progs) and $(build_if_possible__progs). Accordingly ... (no_install__progs, build_if_possible__progs): ... remove. (EXTRA_DIST): Adjust definition. Adjust a comment.
2012-08-31build: don't use '$<' in non-suffix rulesStefano Lattarini
* src/Makefile.am (fs-def): Here: it's not portable to some non-GNU make implementations.
2012-08-31maint: more uses of $(ASSORT)Stefano Lattarini
* src/Makefile.am (fs-kernel-magic, fs-magic): Here, instead of inlining its expansion "LC_ALL=C sort".
2012-08-31maint: remove unused variable in src/Makefile.amStefano Lattarini
* src/Makefile.am (editpl): This.
2012-08-31build: don't use foo_LDADD if there's no foo programStefano Lattarini
For example, instead of factoring out the extra linker flags needed by 'cp', 'mv' ind 'install' into a '$(copy_LDADD)' variable, factor them out in a '$(copy_ldadd)' variable. Partly a minor cleanup, partly a preparation for future changes. * src/Makefile.am (copy_LDADD): Rename ... (copy_ldadd): ... like this. (remove_LDADD): Rename ... (remove_ldadd): ... like this. All uses adjusted. Some comments updated.
2012-08-29tail,stat: improve support for ZFSJim Meyering
This change enables tail -f to use inotify and lets stat -f --format=%T report the file system type name, "zfs". * src/stat.c (human_fstype): Add a case: zfs, 0x2fc12fc1. * NEWS (Improvements): Mention it. * THANKS.in: Update. Reported by Raimonds Miltins in http://bugs.gnu.org/12301.
2012-08-26df: allow translators to reorder "1K-blocks" headerNguyễn Thái Ngọc Duy
* src/df.c (get_header): Mark two "%s-%s" strings for translation and give translators a hint what each is for.
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-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-18sort: simpler fix for sort -u data-loss bug, and for a FMR bugPaul Eggert
This also fixes a free-memory-read (FMR) bug: when fillbuf's realloc of buf->buf frees the buffer into which saved_line.text points, the processing of that just-read longer line includes comparison against the saved line in freed memory. * src/sort.c (overlap): Remove. (fillbuf): Do not try to copy saved lines, as that is too risky in the presence of parallelism, reallocated buffers, etc. (sort): Invalidate any saved line before sorting a new batch.
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-16maint: correct a stale comment in sort.cJim Meyering
* src/sort.c (fillbuf): Fix comment typo. x2nrealloc no longer doubles the size of its input buffer.
2012-08-16maint: fix comment grammar to placate make syntax-checkJim Meyering
* src/remove.c (rm_fts): s/can not/cannot/
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-05build: avoid sort link failure on Solaris 10Jim Meyering
* src/Makefile.am (sort_LDADD): Sort uses euidaccess, which may require whatever library configure deemed necessary to resolve the eaccess function, but no one told sort to link with that library. (sort_LDADD): Add $(LIB_EACCESS).
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-04truncate: don't leak a file descriptor with --ref=PIPEJim Meyering
* src/truncate.c (main): For a user who makes the mistake of using a non-seekable file as a reference for the desired length, truncate would open that file, attempt to seek to its end, but upon seek failure would neglect to close the file descriptor. Close the file descriptor even when lseek fails. In addition, ignore failure to close that reference FD, since as long as the lseek succeeds, a close failure doesn't matter. Coverity spotted the potential FD leak. Improved-by: Pádraig Brady.
2012-08-04split: plug nominal leaksJim Meyering
* src/split.c (lines_rr) [IF_LINT]: Plug a harmless leak. (main) [IF_LINT]: Free a usually-small (~70KB) buffer just before exit, mainly to take this off the radar of leak-detecting tools. Improved-by: Pádraig Brady.
2012-08-03tail: avoid rare error-path FD leakJim Meyering
* src/tail.c (tail_forever): Close FD to avoid leak after a failed fstat.
2012-07-25tail: avoid misleading diagnostic upon fstat failureJim Meyering
* 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.
2012-07-21maint: stzncpy: restrict pointer parametersJim Meyering
* src/system.h (stzncpy): Add "restrict" attribute to each pointer parameter and note in the comment that the buffers must not overlap.
2012-07-20maint: rm: remove two more unused static inline functionsJoachim Schmitz
* src/remove.c (cache_stat_ok, is_nondir_lstat): Remove unused functions.
2012-07-20maint: rm: remove unused static-inlined functionsJoachim Schmitz
* src/remove.c (cache_statted, is_dir_lstat): Remove unused static-inlined functions. * THANKS.in: Remove my name from this list, now that (with this commit) it is included automatically. Copyright-paperwork-exempt: Yes
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-15pinky,who: fix bug in latest changeJim Meyering
* src/system.h (stzncpy): New function. * src/pinky.c (print_entry): Use stzncpy, not stpncpy. The latter does not NUL-terminate. I assumed that strncpy was the only function with such a horrible API. Today I learned that stpncpy also may not NUL-terminate its result. The bugs were introduced in commit v8.17-48-gf79263d. * src/who.c (print_user): Likewise. Thanks to Erik Auerswald for spotting my error.
2012-07-15maint: remove unwarranted uses of strncpyJim Meyering
* src/pinky.c (print_entry): Remove unwarranted uses of strncpy. Instead, use stpcpy and stpncpy. * src/who.c (print_user): Likewise. * cfg.mk: Remove strncpy exemptions.
2012-07-15build: shred.c: avoid i686-specific gcc -Wstrict-overflow warningJim Meyering
* src/shred.c: Avoid gcc -Wstrict-overflow warning. Addresses http://bugs.gnu.org/11927
2012-07-13doc: clarify meaning of '-parodd' in stty helpBruno Haible
* src/stty.c (usage): Disambiguate explanation of -parodd. * THANKS.in: Add reporter. Reported by Michael Stummvoll
2012-07-11df: warn if soon-to-be-removed --megabyte option is usedBernhard Voelker
* src/df.c (MEGABYTES_OPTION): Add enum and mark it for removal in August 2013. (long_options): Use MEGABYTES_OPTION for --megabytes option. (main): Add a case for it and issue a deprecation warning if the long form is used. Document the short -m option to exist only for BSD compatibility.
2012-07-10sort: by default, do not exceed 3/4 of physical memoryPaul Eggert
* src/sort.c (default_sort_size): Do not exceed 3/4 of total memory. See Jeff Janes's bug report in <http://lists.gnu.org/archive/html/coreutils/2012-06/msg00018.html>.
2012-07-03maint: fix minor bugs in helper program, setuidgidJim Meyering
* src/setuidgid.c (main): Fix two error-before-usage calls not to exit. Exit with status SETUIDGID_FAILURE (not EXIT_FAILURE) consistently.
2012-07-02sort: fix exit-status typoPaul Eggert
* src/sort.c (stream_open): EXIT_FAILURE -> SORT_FAILURE. Suggested by Pádraig Brady in <http://bugs.gnu.org/11816#34>.
2012-07-02sort: simplify -o handling to avoid fdopen, assertPaul Eggert
* src/sort.c (outfd): Remove. All uses replaced by STDOUT_FILENO. (stream_open): When writing, use stdout rather than fdopen. (move_fd_or_die): Renamed from dup2_or_die, with the added functionality of closing its first argument. All uses changed. (avoid_trashing_input): Special case for !outfile no longer needed. (check_output): Arrange for standard output to go to the file, rather than storing the fd in outfd.
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-07-02maint: avoid a -Wunsed-but-set warning on some systemsPádraig Brady
* src/stty.c (main): Mark speed_was_set as possibly unused, as is the case when CIBAUD is undefined (on ppc64 GNU/Linux for example). Reported-by: Stefano Lattarini
2012-06-30stat,tail: recognize new file system type: aufsJim Meyering
* src/stat.c (human_fstype) [__linux__]: Add a 'case' for the new remote file system type: aufs (0x61756673). * NEWS (New features): Mention stat -f. (Bug fixes): Mention it for tail -f. Reported by Michael Mol in http://bugs.gnu.org/11823
2012-06-26maint: avoid a static analysis warning in csplitPádraig Brady
The Canalyze static code analyzer correctly surmised that there is a use-after-free bug in free_buffer() at the line "struct line *n = l->next", if that function is called multiple times. This is not a runtime issue since a list of lines will not be present in the !lines_found case. * src/csplit.c (free_buffer): Set list head to NULL so that this function can be called multiple times. (load_buffer): Remove a redundant call to free_buffer(). Reported-by: Xu Zhongxing
2012-06-22doc: document multiplier for dd number options like count=NBernhard Voelker
* src/dd.c (usage): Add "N" to the description of multipliers. * doc/coreutils.texi (dd invocation): Likewise.
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-22maint: refactor common mode bits used to create filesPádraig Brady
* src/system.h (MODE_RW_UGO): The new refactored define (666). * src/mkfifo.c: Use the new define. * src/mknod.c: Likewise. * src/split.c: Likewise. * src/system.h: Likewise. * src/touch.c: Likewise. * src/truncate.c: Likewise. Suggested-by: Jim Meyering
2012-06-20maint: sort: style adjustment to help clarify size determinationBernhard Voelker
* src/sort.c (default_sort_size): Move physmem code "down" to first use.
2012-06-12stty: portability: accommodate CILJim Meyering
* src/stty.c (main): Declare locals "mode" and "new_mode" to be static to ensure that each is initialized to zero, *including* all padding. While gcc clears padding of a local automatic initialized to "{ 0, }", CIL does not, and the C99 standard is not clear on this issue. Reported by Edward Schwartz. See http://bugs.gnu.org/11675 for details.
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-05maint: mark new diagnostic for translationJim Meyering
* src/head.c (elide_tail_lines_seekable): Mark new diagnostic. I will look at the results of "make syntax-check", I will look...