summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-09-03base64: use stricter validation on wrap columnPádraig Brady
* src/base64.c (main): Use the higher level xnumtoumax() rather than xstrtoumax(), which is simpler and improves validation of input. Also pass the _empty_ rather than NULL string as the suffixes parameter so that invalid trailing characters are not allowed. For example -w08 is now flagged as an error, rather than being interpreted as 0. A subsequent commit will further improve verification of numbers with leading zeros by dropping backwards compatibility wrt auto parsing oct and hex numbers. * tests/misc/base64.pl: Add tests for invalid wrap values.
2015-09-03base32: A new program similar to base64Pádraig Brady
Suggested in https://bugzilla.redhat.com/1250113 * AUTHORS: Add base32. * THANKS.in: Add suggester. * README: Reference the new program. * NEWS: Mention the new program. * src/.gitignore: Ignore the new binary. * bootstrap.conf: Reference the gnulib base32 module. * build-aux/gen-lists-of-programs.sh: Add base32. * man/base32.x: A new template. * man/.gitignore: Ignore the new man page. * man/local.mk: Reference the new man page. * doc/coreutils.texi (base32 invocation): Document the new command. * src/local.mk: Adjust to build base32 based on base64.c. * src/base64.c: Parameterize to use the correct headers, functions and buffer sizes, depending on which binary is being built. * tests/misc/base64.pl: Adjust to test both base32 and base64. * tests/misc/tty-eof.pl: Add base32 as a program that accepts input on stdin without any options specified. * scripts/git-hooks/commit-msg: Add base32 to the template.
2015-09-01build: update gnulib submodule to latestPádraig Brady
This includes a tweak to support building the gnulib base32 module with -Wsuggest-attribute=const
2015-08-31doc: clarify in --help/man where short options take no paramPádraig Brady
* src/shred.c (usage): For -u, separate the decscription of the short and long option, to clarify that the short option takes no parameter. * src/split.c (usage): Likewise for -d. * src/tee.c (usage): Likewise for -p. * src/uniq.c (usage): Likewise for -D. Suggested by Stephane Chazelas
2015-08-30tests: avoid FP of ls/stat-free-color.sh with newer glibcBernhard Voelker
Since glibc-2.22, specifically commit [0], the opendir() implementation implicitly makes an additional stat call thus leading to a FP. Seen on openSUSE:Tumbleweed since snapshot 20150821. [0] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=46f894d8c60a * tests/ls/stat-free-color.sh: Change the test to verify that ls(1) needs the same number of stat-like calls for a single, empty directory argument as for one with a few directory entries (sub-directory, regular file, symlink, etc.).
2015-08-27doc: clarify where ambiguous if short options take no paramPádraig Brady
* doc/coreutils.texi (split invocation): Clarify that -d takes no param. (uniq invocation): Likewise for -D. (shred invocation): Likewise for -u. (tee invocation): Likewise for -p.
2015-08-22ls: allow -w18446744073709551616Paul Eggert
Problem reported by Beco in: http://bugs.gnu.org/21325 * src/ls.c (set_line_length): New function. (decode_switches): Use it to decode COLUMNS and -w.
2015-08-18maint: add syntax check to ensure larger man/*.x files have a CopyrightBernhard Voelker
* cfg.mk (sc_man_check_x_copyright): Add rule to ensure that non-trivial .x files in the 'man/' subdirectory, i.e., files exceeding a line count of 20 or a byte count of 1000, contain a proper Copyright notice.
2015-07-23build: fprintftime/nstrftime API changesPaul Eggert
* bootstrap.conf (gnulib_modules): Add time_rz, since the main source code now uses timezone_t. * src/date.c (batch_convert, main, show_date): * src/ls.c (align_nstrftime, long_time_expected_width) (print_long_format): * src/stat.c (human_time): Use timezone_t rather than boolean to specify which time zone is wanted. * src/ls.c (localtz): New static var. (main): Initialize it.
2015-07-23build: update gnulib submodule to latestPaul Eggert
2015-07-22doc: discourage use of uname -i and -p optionsPádraig Brady
* src/uname.c (usage): State that the non POSIX -i and -p options are non-portable. * doc/coreutils.texi (uname invocation): Mention the discrepancies even across GNU/Linux distros, and that the results should be used as informational only, rather than impacting any logic decisions. Fixes http://bugs.gnu.org/13001
2015-07-15doc: improve man page for realpath -mPádraig Brady
* src/realpath.c (usage): Mention 'directory' in the --help output, so that ENOTDIR errors may be more easily investigated, by inspecting the man page. Reported at http://pad.lv/1474519
2015-07-15tests: avoid test warning with perl >= 5.22Peter Bray
* doc/local.mk (sc-lower-case-var): Escape a literal left curly bracket, needed with perl >= 5.22 Fixes http://bugs.gnu.org/21060
2015-07-15sync: fix build with separate $(LIB_FDATASYNC)Peter Bray
* src/local.mk: Link with $(LIB_FDATASYNC) needed on some Solaris 10 systems for example. Fixes http://bugs.gnu.org/21059
2015-07-09dircolors: add tmux entriesPádraig Brady
* src/dircolors.hin: tmux entries were added to ncurses in: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff;\ f=misc/terminfo.src;h=ce9bdc3b;hp=7e576ef1;hb=be512fa0;hpb=ee1bcda2
2015-07-07shred: fix pattern selection for certain iteration countsPádraig Brady
This was detected in about 25% of runs with gcc -fsanitize=address ERROR: AddressSanitizer: global-buffer-overflow on address ... READ of size 4 at 0x000000416628 thread T0 #0 0x40479f in genpattern src/shred.c:782 #1 0x4050d9 in do_wipefd src/shred.c:921 #2 0x406203 in wipefile src/shred.c:1175 #3 0x406b84 in main src/shred.c:1316 #4 0x7f3454a1ef9f in __libc_start_main (/lib64/libc.so.6+0x1ff9f) #5 0x4025d8 (/tmp/coreutils-8.23/src/shred+0x4025d8) 0x000000416628 is located 56 bytes to the left of global variable '*.LC49' from 'src/shred.c' (0x416660) of size 17 0x000000416628 is located 12 bytes to the right of global variable 'patterns' from 'src/shred.c' (0x416540) of size 220 SUMMARY: AddressSanitizer: global-buffer-overflow src/shred.c:782 * src/shred.c (gen_patterns): Restrict pattern selection to the K available, which regressed due to v5.92-1462-g65533e1. * tests/misc/shred-passes.sh: Add a deterministic test case. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/20998
2015-07-03maint: post-release administriviaPádraig Brady
* NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update.
2015-07-03version 8.24Pádraig Brady
* NEWS: Record release date.
2015-07-03maint: fix distclean-check failure due to THANKSPádraig Brady
* Makefile.am: Remove our dependence on src/sort which induces awkward dependencies for `make dist` since THANKS will be rebuilt once src/sort is newer. Instead we remove the problematic -f option to sort which actually doesn't change the order given our current input.
2015-07-03maint: avoid false syntax-check failure in distcheckPádraig Brady
* cfk.mk (sc_tests_executable): Restrict the check to git files, so we don't flag any gnulib files added to test/ during `make distcheck`.
2015-07-03tests: update gnulib submodule and tests/init.sh to latestPádraig Brady
* gnulib: Update to latest, with fixes to tests edge cases. * tests/init.sh: Update from gnulib.
2015-07-03tests: avoid side effects of $SHELL environment variablePádraig Brady
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-07-02tests: avoid false failures on OpenBSD 5.7Pádraig Brady
* tests/du/threshold.sh: Homogenize getopt error messages. * tests/misc/numfmt.pl: Likewise. * tests/mv/i-3.sh: Skip on *BSD not just FreeBSD.
2015-07-02wc: fix reading of /proc files on aarch64Pádraig Brady
tests/misc/wc-proc.sh fails when the page size is 64K * src/wc.c (wc): The lseek adjustment should be based on st_blksize, rather than on the internal buffer size. This is significant on aarch64 where st_blksize in /proc is the 64K (the page size) and thus larger than the internal buffer. * src/split.c (main): Even though the similar processing is done on the internal buffer size, that's based on st_blksize and so fine in this regard. Add an assert to enforce this. Avoid this path for the undocumented ---io-blksize option.
2015-07-01build: update gnulib submodule to latestPádraig Brady
Mainly with build fixes for FreeBSD and OS X.
2015-07-01numfmt: increase precision on 32 bit FreeBSDPádraig Brady
* m4/jm-macros.m4 (HAVE_FPSETPREC): Define if needed. * src/numfmt.c (main): Call fpsetprec() if needed. Fixes large-15 and large-16 test failures on 32 bit FreeBSD.
2015-07-01tests: avoid false failure on FreeBSD systemsPádraig Brady
* tests/misc/stty.sh: FreeBSD returns ENOTTY for the TIOCEXT ioctl, so just avoid this option for now.
2015-07-01factor: ensure atomic output through pipesPádraig Brady
The new tests/misc/factor-parallel.sh test was seen to fail on FreeBSD (derived) systems, which was due to split(1) --filter reading partial lines through pipes, as factor(1) was writing a little over PIPE_BUF each time. * src/factor.c (lbuf): A new structure to internally buffer lines. (lbuf_alloc): A new function to allocate enough at program start. (lbuf_putint): A new function to buffer a uintmax_t. (lbuf_flush): A new function to write directly to standard output. (lbuf_putc): A new function to buffer a character and if enough lines are buffered, then output complete lines <= PIPE_BUF, and continue to buffer the rest. (main): Call the internal buffer allocator, and register the final flush from the internal buffer at program exit.
2015-07-01tests: fix false failure on slower systemsPádraig Brady
* tests/dd/stats.sh: Wait 20s for dd to write 250MB through a fifo, rather than 10s for 500MB. The failure was seen often on a lightly loaded SPARC-Enterprise-T5220 running Solaris 10.
2015-06-29maint: stdbuf.c: avoid the OS X putenv functionJim Meyering
* bootstrap.conf (gnulib_modules): Add setenv, to make this module dependency explicit; setenv is also used by split. * src/stdbuf.c (set_LD_PRELOAD) [__APPLE__]: Use the OS X setenv function, rather than putenv, per that documentation: https://developer.apple.com/\ library/mac/documentation/Darwin/Reference/ManPages/man3/putenv.3.html
2015-06-29build: numfmt.c: avoid a shadowing warningJim Meyering
* src/numfmt.c (parse_field_arg): Rename parameter s/optarg/arg/, to avoid shadowing getopt's global variable. Otherwise, building on OS X, with --enable-gcc-warnings, I saw this: In file included from src/numfmt.c:19:0: src/numfmt.c: In function 'parse_field_arg': ./lib/config.h:3109:25: error: declaration of 'rpl_optarg' shadows\ a global declaration [-Werror=shadow]
2015-06-29numfmt: fix printf argument orderAssaf Gordon
* src/numfmt.c (double_to_human): Fix the argument order passed to snprintf, which happened to work on amd64 with its separate va_arg storage area for floats¹, but would fail tests for example on i686. ¹ https://blog.nelhage.com/2010/10/amd64-and-va_arg/
2015-06-28maint: clarify df's use of device IDs from /proc/self/mountinfoPádraig Brady
* src/df.c (filter_mount_list): Clarify why we still stat even though devices IDs may already be available. Note using /proc/self/mountinfo is still an advantage to get filtered items with accurate device patchs in chroots and with bind mounts. I.E. on older setups with static /etc/mtab, df will now bypass that to get the more accuracte and dynamic info.
2015-06-26chroot: quote argument in error diagnosticPádraig Brady
* src/chroot.c (main): Quote the passed argument, to avoid confusing error messages.
2015-06-25maint: clarify integer operations in recent commitPádraig Brady
* src/factor.c (print_uintmaxes): Comment that the value of n_out doesn't matter on error, and add an explicit cast to avoid any future warnings. Suggested by Jim Meyering RE commit v8.23-229-g4d2d6c5
2015-06-25tests: avoid false failure when running as rootPádraig Brady
* tests/misc/sync.sh: Ensure dir is unreadable before including the permission check.
2015-06-25tests: avoid false failures with LD_PRELOAD=libasan.so.2Pádraig Brady
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-06-25build: update to latest gnulibPádraig Brady
Mainly for -fsanitize=address and -fsanitize=undefined fixes
2015-06-25build: allow build to complete with -fsanitize=addressPádraig Brady
* src/make-prime-list.c (main): When building with the above option, avoid this build stopping error: "LeakSanitizer: detected memory leaks"
2015-06-24maint: avoid undefined behavior in qsort callPádraig Brady
GCC 5.1.1 -fsanitize=undefined with glibc 2.21 is returning: "runtime error: null pointer passed as argument 1, which is declared to never be null" * src/ptx.c (sort_found_occurs): Avoid the call with no entries.
2015-06-24factor: avoid interspersed lines for parallel runsPádraig Brady
* src/factor.c (n_out): A new global variable to track how much data has been written to stdout. (print_factors_single): Use n_out to determine whether to flush the current (and previous) lines. * tests/misc/factor-parallel.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix.
2015-06-24seq: handle exponents more consistentlyPádraig Brady
src/seq.c (scan_arg): Set precision and width _after_ exponentiation. For example, this will make '1.1e1 12' and '11 1.2e1' equivalent. One can still set the precision by specifying extra precision on the start value, or more naturally with a precision on a step value. * tests/misc/seq-precision.sh: Add new cases.
2015-06-24seq: use consistent output format with hex integersPádraig Brady
* src/seq.c (scan_arg): Set precision to 0 for hex constants (while avoiding hex floats). This will use then use the fast path for these arguments. Note we also set the precision of inf to 0 here, which ensures we use consistent precision on output where possible. * tests/misc/seq-precision.sh: Add corresponding test cases.
2015-06-24seq: support inf last item more generally/efficientlyPádraig Brady
* src/seq.c (main): Call seq_fast for infinite last value. This implicitly avoids format conversion on the 999999 -> 1000000 transition. * src/seq.c (seq_fast): Generalize the buffer handling, and adjust to handle the "inf" last value specifics. * tests/misc/seq-precision.sh: A new test. * tests/local.mk: Reference the new test.
2015-06-22doc: list numfmt in the main menu with "Numeric operations"Pádraig Brady
* doc/coreutils.texi (main menu): Add numfmt.
2015-06-22numfmt: don't hardcode floating point limitsPádraig Brady
* src/numfmt.c (MAX_UNSCALED_DIGITS): Set this to LDBL_DIG rather than hardcoding at 18 for better portability. * tests/misc/numfmt.pl: Restrict limit tests to supported platforms.
2015-06-22numfmt: handle leading zeros correctlyPádraig Brady
* src/numfmt.c (simple_strtod_int): Don't count leading zeros as significant digits. Also have leading zeros as optional for floating point numbers. * tests/misc/numfmt.pl: Add test cases. * NEWS: Mention the fix.
2015-06-22numfmt: avoid integer overflow when roundingPádraig Brady
Due to existing limits this is usually triggered with an increased precision. We also add further restrictions to the output of increased precision numbers. * src/numfmt.c (simple_round): Avoid intmax_t overflow. (simple_strtod_int): Count digits consistently for precision loss and overflow detection. (prepare_padded_number): Include the precision when excluding numbers to output, since the precision determines the ultimate values used in the rounding scheme in double_to_human(). * tests/misc/numfmt.pl: Add previously failing test cases. * NEWS: Mention the fix.
2015-06-21numfmt: support user specified output precisionPádraig Brady
* src/numfmt.c (usage): Update the --format description to indicate precision is allowed. (parse_format_string): Parse a precision specification like the standard printf does. (double_to_human): Honor the precision in --to mode. * tests/misc/numfmt.pl: New tests. * doc/coreutils.texi (numfmt invocation): Mention the new feature. * NEWS: Likewise.
2015-06-19numfmt: implement support for field rangesDylan Cali
* src/numfmt.c: Replace field handling code with logic that understands field range specifiers. Instead of processing a single field and printing line prefix/suffix around it, process each field in the line checking whether it has been included for conversion. If so convert and print, otherwise just print the unaltered field. (extract_fields): Removed. (skip_fields): Removed. (process_line): Gutted and heavily reworked. (process_suffixed_number): FIELD is now passed as an arg instead of using a global. (parse_field_arg): New function that parses field range specifiers. (next_field): New function that returns pointers to the next field in a line. (process_field): New function that wraps the field conversion logic (include_field): New function that checks whether a field should be converted (compare_field): New function used for field value comparisons in a gl_list. (free_field): New function used for freeing field values in a gl_list. Global variable FIELD removed. New global variable all_fields indicates whether all fields should be processed. New global variable all_fields_after stores the first field of a N- style range. New global variable all_fields_before stores the last field of a -M style range. New global variable field_list stores explicitly specified fields to process (N N,M or N-M style specifiers). (usage): Document newly supported field range specifiers. * bootstrap.conf: Include xlist and linked-list modules. numfmt now uses the gl_linked_list implementation to store the field ranges. * tests/misc/numfmt.pl: Add tests for 'cut style' field ranges. Adjust existing tests as partial output can occur before an error Remove test for the 'invalid' field -5.. this is now a valid range. * gnulib: update to avoid compiler warnings in linked-list. * NEWS: Mention the new feature.