summaryrefslogtreecommitdiff
path: root/src/local.mk
Commit message (Collapse)AuthorAgeFilesLines
* maint: refactor tail.c to use iopollPádraig Brady2023-03-011-0/+2
| | | | | | | | | | * src/tail.c (check_output_alive): Reuse iopoll() rather than directly calling poll() or select(). * src/iopoll.c (iopoll): Refactor to support non blocking operation, or ignoring descriptors by passing a negative value. * src/iopoll.h (iopoll): Adjust to support a BLOCK parameter. * src/tee.c (tee_files): Adjust iopoll() call to explicitly block. * src/local.mk: Have tail depend on iopoll.c.
* tee: enhance -p mode using iopoll() to detect broken pipe outputsCarl Edquist2023-02-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If input is intermittent (a tty, pipe, or socket), and all remaining outputs are pipes (eg, >(cmd) process substitutions), exit early when they have all become broken pipes (and thus future writes will fail), without waiting for more input to become available, as future write attempts to these outputs will fail (SIGPIPE/EPIPE). Only provide this enhancement when pipe errors are ignored (-p mode). Note that only one output needs to be monitored at a time with iopoll(), as we only want to exit early if _all_ outputs have been removed. * src/tee.c (pipe_check): New global for iopoll mode. (main): enable pipe_check for -p, as long as output_error ignores EPIPE, and input is suitable for iopoll(). (get_next_out): Helper function for finding next valid output. (fail_output, tee_files): Break out write failure/output removal logic to helper function. (tee_files): Add out_pollable array to track which outputs are suitable for iopoll() (ie, that are pipes); track first output index that is still valid; add iopoll() broken pipe detection before calling read(), removing an output that becomes a broken pipe. * src/local.mk (src_tee_SOURCES): include src/iopoll.c. * NEWS: Mention tee -p enhancement in Improvements. * doc/coreutils.texi: Mention the new early exit behavior in the nopipe modes for the tee -p option. Suggested-by: Arsen Arsenović <arsen@aarsen.me>
* all: add broken pipe detection while waiting for inputCarl Edquist2023-02-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* maint: adjust to Gnulib macro renamingPaul Eggert2023-01-071-20/+20
| | | | | | | | | * src/local.mk (LDADD, copy_ldadd, remove_ldadd, src_sort_LDADD) (src_test_LDADD, copy_ldadd, src_date_LDADD, src_ginstall_LDADD) (src_ln_LDADD, src_ls_LDADD, src_mktemp_LDADD, src_pr_LDADD) (src_tac_LDADD, src_touch_LDADD, src_dd_LDADD, src_sleep_LDADD) (src_sort_LDADD, src_tail_LDADD, src_sort_LDADD, LDADD): Adjust to recent Gnulib changes.
* ls: adjust to Gnulib renamingPaul Eggert2023-01-051-1/+1
| | | | | * src/local.mk (src_ls_LDADD): In Gnulib, LIB_HAS_ACL was renamed to FILE_HAS_ACL_LIB.
* maint: update all copyright year number rangesPádraig Brady2023-01-011-1/+1
| | | | | | | | | | 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.
* maint: update all copyright year number rangesPádraig Brady2022-01-021-1/+1
| | | | | | | | | 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.
* build: port to AIX 7.1Paul Eggert2021-12-311-3/+8
| | | | | | | | | | This fixes a porting bug introduced in 2019-08-12T03:29:00Z!bruno@clisp.org. Problem discovered on AIX 7.1. * src/local.mk (LDADD): Add $(LIB_MBRTOWC), since pretty much every command uses quotearg or mbrtowc or whatever. (src_sort_LDADD): Add $(LIBPMULTITHREAD) and $(LIB_PTHREAD_SIGMASK) instead of $(LIBTHREAD).
* cksum: add --algorithm option to select digest modePádraig Brady2021-09-151-12/+15
| | | | | | | | | | | | | | | | | | * src/digest.c: Organize HASH_ALGO_CKSUM to be table driven, and amalgamate all digest algorithms. (main): Parse all options if HASH_ALGO_CKSUM, and disallow --tag, --zero, and --check with the traditional bsd, sysv, and crc checksums for now. * src/local.mk: Reorganize to include all digest modules in cksum. * tests/misc/cksum-a.sh: Add a new test. * tests/misc/b2sum.sh: Update to default to checking with cksum, as b2sum's implementation diverges a bit from the others. * tests/local.mk: Reference the new test. * doc/coreutils.texi (cksum invocation): Adjust the summary to identify the new mode, and document the new --algorithm option. * man/cksum.x: Adjust description to be more general. * man/*sum.x: Add [See Also] section referencing cksum(1). * NEWS: Mention the new feature.
* digest: refactor cksum(1) into digest.cPádraig Brady2021-09-151-1/+2
| | | | | | | | | | | | | | | | * cfg.mk: Adjust cksum.c to not require config.h and support a main (for crctab) without calling bindtextdomain(). * po/POTFILES.in: Remove cksum_pclmul.c since it no longer concerns itself with diagnostics. * src/cksum.c: Refactor to just providing stream digest, and digest printing functionality. * src/cksum.h: Adjust to the new interface. * src/cksum_pclmul.c: Remove diagnostics, and determine errors internally. * src/crctab.c: Separate from cksum.h since that's now included multiple times. * src/digest.c: Provide cksum(1) functionality if -DHASH_ALGO_CKSUM * src/local.mk: Adjust to new crctab.c and HASH_ALGO_CKSUM define.
* digest: refactor sum(1) into digest.cPádraig Brady2021-09-151-0/+3
| | | | | | | | | | | Since digest will be providing all digest functionality, refactor sum.c into it. * po/POTFILES.in: sum.c no longer has translatable strings so remove. * src/digest.c: Call out to new stream interfaces in sum.c * src/local.mk: Adjust sources for the sum binary. * src/sum.c: Provide a stream interface for BSD and SYSV digests. * src/sum.h: A new file to declare the exported functions in sum.c
* maint: rename md5sum.c to more general digest.cPádraig Brady2021-09-151-6/+7
| | | | | | | | | | | md5sum.c will be the base for all digest functions, so rename accordingly. * src/md5sum.c: Rename to ... * src/digest.c: ... renamed from md5sum.c * scripts/git-hooks/commit-msg: Allow digest: commit prefix. * po.POTFILES.in: Adjust to new name. * src/local.mk: Likewise.
* copy: remove fiemap logicPádraig Brady2021-05-151-3/+0
| | | | | | | | | | | | This is now only used on 10 year old linux kernels, and performs a sync before each copy. * src/copy.c (extent_copy): Remove function and all callers. * src/extent-scan.c: Remove. * src/extent-scan.h: Remove. * src/fiemap.h: Remove. * src/local.mk: Adjust for removed files. * NEWS: Adjust to say fiemap is removed.
* wc: use avx2 optimization when counting only linesKristoffer Brånemyr2021-05-021-0/+9
| | | | | | | | | | | | | | | | | Use cpuid to detect CPU support for avx2 instructions. Performance was seen to improve by 5x for a file with only newlines, while the performance for a file with no such characters is unchanged. * configure.ac [USE_AVX2_WC_LINECOUNT]: A new conditional, set when __get_cpuid_count() and avx2 compiler intrinsics are supported. * src/wc.c (avx2_supported): A new function using __get_cpuid_count() to determine if avx2 instructions are supported. (wc_lines): A new function refactored from wc(), which implements the standard line counting logic, and provides the fallback implementation for when avx2 is not supported. * src/wc_avx2.c: A new module to implement using avx2 intrinsics. * src/local.mk: Reference the new module. Note we build as a separate lib so that it can be portably built with separate -mavx2 etc. flags.
* cksum: use pclmul hardware instruction for CRC32 calculationKristoffer Brånemyr2021-03-151-0/+7
| | | | | | | | | | | | | | | | | | | | Use cpuid to detect CPU support for hardware instruction. Fall back to slice by 8 algorithm if not supported. A 500MiB file improves from 1.40s to 0.67s on an i3-2310M * configure.ac [USE_PCLMUL_CRC32]: A new conditional, set when __get_cpuid() and clmul compiler intrinsics are supported. * src/cksum.c (pclmul_supported): A new function using __get_cpuid() to determine if pclmul instructions are supported. (cksum): A new function refactored from cksum_slice8(), which calls pclmul_supported() and then cksum_slice8() or cksum_pclmul() as appropriate. * src/cksum.h: Export the crctab array for use in the new module. * src/cksum_pclmul.c: A new module to implement using pclmul intrinsics. * po/POTFILES.in: Reference the new cksum_pclmul module. * src/local.mk: Likewise. Note we build it as a separate library so that it can be portably built with separate -mavx etc. flags. * tests/misc/cksum.sh: Add new test modes for pertinent buffer sizes.
* maint: update all copyright year number rangesPádraig Brady2021-01-011-1/+1
| | | | | | | | | 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.
* cksum: use more efficient slice by 8 algorithmKristoffer Brånemyr2020-12-281-0/+1
| | | | | | | | | | | | | A 100MB file improves from 2.50s to 1.80s on a Sparc T5220 A 100MB file improves from 0.54s to 0.13s on an i3-2310M * bootstrap.conf: Explicitly depend on byteswap, since now used directly by coreutils. * src/cksum.c (cksum): Process in multiples of 8 bytes. (main): Adjust for generation of expanded crctab. * src/cksum.h: Split now larger crctab to separate header. * src/local.mk: Reference the new header. * NEWS: Mention the improvement.
* maint: port from matchpathcon to selabel_lookupPaul Eggert2020-11-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ubuntu 20.10 is using a newer version of libselinux that complains that matchpathcon is obsolete. Rewrite the code that it uses the recommended selabel_lookup instead. * m4/jm-macros.m4 (coreutils_MACROS): Do not check for matchpathcon_init_prefix, as it is no longer used. * src/copy.c (set_file_security_ctx): Omit process_local arg, as it is equivalent to !x->set_security_context. All callers changed. * src/copy.h (struct cp_options): set_security_context is now of type struct selabel_handle *, not bool. All uses changed. * src/cp.c, src/install.c, src/mkdir.c, src/mkfifo.c, src/mknod.c: * src/mv.c: Include selinux/label.h. (main): Use selabel_open for set_security context. * src/install.c (matchpathcon_init_prefix): Remove; now unused. (get_labeling_handle): New static function. (setdefaultfilecon, main): Use it. (setdefaultfilecon): Do something regardless of ENABLE_MATCHPATHCON, which seems to be a revenant macro. (setdefaultfilecon): Use selabel_lookup instead of the obsolescent matchpathcon. Report an error unless it fails due to ENOENT. * src/local.mk (src_ginstall_CPPFLAGS): Remove. * src/selinux.c: Include selinux/label.h Do not include die.h, error.h, canonicalize.h. (defaultcon, restorecon_private, restorecon): New arg HANDLE. All callers changed. Use selabel_lookup rather than matchpathcon. (restorecon_private, restorecon): Don’t lose track of errno. * src/selinux.c, src/selinux.h: (restorecon): Don’t call ‘error’; that’s the caller’s job. Use HAVE_SELINUX_LABEL_H, not HAVE_SELINUX_SELINUX_H, in case there is some weird system with the former but not the latter. * src/selinux.h (struct selinux_handle): Add forward decl.
* build: port to Solaris 10Paul Eggert2020-11-211-1/+4
| | | | | | | * src/local.mk (src_ln_LDADD, src_mktemp_LDADD, src_tac_LDADD): Add $(LIB_CLOCK_GETTIME), since these use tempname which uses clock_gettime if getrandom fails. On platforms like Solaris 10, clock_gettime is not in the standard C library.
* maint: cleanup operation of fs-magic-comparePádraig Brady2020-10-281-1/+2
| | | | | | * src/local.mk: Ensure we map 2 hex digits to 4, so that we don't output already handled Z3FOLD file system (0x33). Also hide the generation command for src/fs.h.
* build: update gnulib submodule to latestPaul Eggert2020-07-281-2/+2
| | | | | * src/local.mk (src_expr_LDADD, src_factor_LDADD): Adjust to Gnulib renaming of LIB_GMP to LIBGMP.
* maint: update all copyright year number rangesPádraig Brady2020-01-011-1/+1
| | | | | | | | | 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.
* ls: use statx instead of stat when availableJeff Layton2019-10-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | statx allows ls to indicate interest in only certain inode metadata. This is potentially a win on networked/clustered/distributed file systems. In cases where we'd have to do a full, heavyweight stat() call we can now do a much lighter statx() call. As a real-world example, consider a file system like CephFS where one client is actively writing to a file and another client does an ls --color in the same directory. --color means that we need to fetch the mode of the file. Doing that with a stat() call means that we have to fetch the size and mtime in addition to the mode. The MDS in that situation will have to revoke caps in order to ensure that it has up-to-date values to report, which disrupts the writer. This has a measurable affect on performance. I ran a fio sequential write test on one cephfs client and had a second client do "ls --color" in a tight loop on the directory that held the file: Baseline -- no activity on the second client: WRITE: bw=76.7MiB/s (80.4MB/s), 76.7MiB/s-76.7MiB/s (80.4MB/s-80.4MB/s), io=4600MiB (4824MB), run=60016-60016msec Without this patch series, we see a noticable performance hit: WRITE: bw=70.4MiB/s (73.9MB/s), 70.4MiB/s-70.4MiB/s (73.9MB/s-73.9MB/s), io=4228MiB (4433MB), run=60012-60012msec With this patch series, we gain most of that ground back: WRITE: bw=75.9MiB/s (79.6MB/s), 75.9MiB/s-75.9MiB/s (79.6MB/s-79.6MB/s), io=4555MiB (4776MB), run=60019-60019msec * src/stat.c: move statx to stat struct conversion to new header... * src/statx.h: ...here. * src/ls.c: Add wrapper functions for stat/lstat/fstat calls, and add variants for when we are only interested in specific info. Add statx-enabled functions and set the request mask based on the output format and what values are needed. * NEWS: Mention the Improvement.
* b2sum: port to HP-UX aCCPaul Eggert2019-05-151-8/+1
| | | | | | | | | | | | | | Its support for the -include option is flaky. Problem reported by Michael Osipov (Bug#35650). Plus, we could run into other compilers that don’t support any option like -include. Change the code so that -include is not needed. Although this causes us to depart from the upstream version, we’re already doing that for other reasons. * configure.ac (USE_XLC_INCLUDE): Remove, as there’s no guarantee a compiler will support something like -include. * src/blake2/b2sum.c [HAVE_CONFIG_H]: Include <config.h>. * src/local.mk (src_b2sum_CPPFLAGS): Add -DHAVE_CONFIG_H. Do not use -include or a substitute.
* env: new options --{default,ignore,block}-signal[=SIG]Assaf Gordon2019-03-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New options to set signal handlers for the command being executed. --block-signal suggested by Paul Eggert in http://bugs.gnu.org/34488#71 --default-signal is useful to overcome the POSIX limitation that shell must not override inherited signal state, e.g. the second 'trap' here is a no-op: trap '' PIPE && sh -c 'trap - PIPE ; seq inf | head -n1' Instead use: trap '' PIPE && sh -c 'env --default-signal=PIPE seq inf | head -n1' Similarly, the following will prevent CTRL-C from terminating the program: env --ignore-signal=INT seq inf > /dev/null See https://bugs.gnu.org/34488#8 * NEWS: Mention new options. * doc/coreutils.texi (env invocation): Document new options. * man/env.x: Add example of --default-signal=SIG usage. (SEE ALSO): Mention sigprocmask. * src/env.c (signals): New global variable. (longopts): Add new options. (usage): Print new options. (parse_signal_params): Parse comma-separated list of signals, store in signals variable. (reset_signal_handlers): Set each signal to SIG_DFL/SIG_IGN. (parse_block_signal_params): Parse command-line options. (set_signal_proc_mask): Call sigprocmask to block/unblock signals. (main): Process new options. * src/local.mk (src_env_SOURCES): Add operand2sig.c. * tests/misc/env-signal-handler.sh: New test. * tests/local.mk (all_tests): Add new test.
* maint: update all copyright year number rangesAssaf Gordon2019-01-011-1/+1
| | | | | | | | | 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.
* basenc: A new program complementary to base64/base32Assaf Gordon2018-12-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Encodes/decodes data in various common formats: base64,base64url,base32,base32,base16,base2,z85. Discussed here: https://lists.gnu.org/r/coreutils/2018-11/msg00014.html https://lists.gnu.org/r/coreutils/2018-12/msg00019.html * AUTHORS: Add basenc. * README: Reference the new program. * NEWS: Mention the new program. * build-aux/gen-lists-of-programs.sh: Add basenc. * doc/coreutils.texi: (basenc invocation): Document the new command. * man/.gitignore: Ignore the generated man page. * man/basenc.x: A new template, with few examples. * man/local.mk: Reference the new man page. * scripts/git-hooks/commit-msg: Allow basenc as program prefix. * src/.gitignore: Ignore the new binary. * src/basenc.c: (usage): Mention new options. (main): Handle new options. (isbase*, base*_length, base*_encode, base*_decode_ctx): Implement new encoding/decoding formats. * src/local.mk: Add new program. * tests/local.mk: Add new test. * tests/misc/basenc.pl: New tests. * tests/misc/help-version.sh (basenc_setup): use '--version' for default invocation (basenc errors with no parameters).
* maint: rename base64.c to basenc.cAssaf Gordon2018-12-211-1/+2
| | | | | | | | | In preparation for adding 'basenc' program. Suggested in https://lists.gnu.org/r/coreutils/2018-11/msg00019.html . * src/base64.c: Rename to src/basenc.c. * src/local.mk: Update base*_SOURCES definitions. * po/POTFILEs.in: Rename base64 to basenc.
* maint: avoid false positive in src/fs-magic-comparePádraig Brady2018-06-241-0/+1
| | | | | | | * src/local.mk (fs_normalize_perl_subst): `make src/fs-magic-compare` was reporting incorrectly that AFS was not being handled. Add a mapping to our KAFS identifier. * .gitignore: Add intermediate files from `make src/fs-magic-compare`
* maint: update all copyright year number rangesPádraig Brady2018-01-011-1/+1
| | | | | | | | | 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.
* copy: revert recent patch for vulnerable dirsPaul Eggert2017-09-241-8/+5
| | | | | | | | | | | | | | | | I plan to propose a better patch to catch vulnerable parent directories. * NEWS, doc/coreutils.texi (Target directory): Document this. * src/cp.c, src/install.c, src/ln.c, src/mv.c: Do not include targetdir.h. (target_directory_operand): Remove test for vulnerable parents. * src/cp.c (stat_target_operand): Remove. All uses removed. * src/local.mk (noinst_HEADERS): Remove src/targetdir.h. (src_ginstall_SOURCES, src_cp_SOURCES, src_ln_SOURCES) (src_mv_SOURCES): Remove src/targetdir.c. * src/targetdir.c, src/targetdir.h: Remove. * tests/mv/vulnerable-target.sh: Remove. * tests/local.mk (all_root_tests): Remove it.
* all: prefer HTTPS in URLsPaul Eggert2017-09-191-1/+1
|
* copy: check for vulnerable target dirsPaul Eggert2017-09-191-5/+8
| | | | | | | | | | | | | | | * NEWS, doc/coreutils.texi (Target directory): Document this. * src/cp.c, src/install.c, src/ln.c, src/mv.c: Include targetdir.h. (target_directory_operand): Use the new targetdir_operand_type function to check for vulnerable target directories. * src/cp.c (stat_target_operand): New function. (target_directory_operand, do_copy): Use it. * src/local.mk (noinst_HEADERS): Add src/targetdir.h. (src_ginstall_SOURCES, src_cp_SOURCES, src_ln_SOURCES) (src_mv_SOURCES): Add src/targetdir.c. * src/targetdir.c, src/targetdir.h: New files. * tests/mv/vulnerable-target.sh: New test. * tests/local.mk (all_root_tests): Add it.
* runcon: revert "disable use of the TIOCSTI ioctl"Pádraig Brady2017-08-301-1/+0
| | | | | | | | | | | | This reverts commit v8.27-97-g8cb06d4 because the setsid() fallback was not implemented correctly and disabling the ioctl was not a complete solution to the security issue of the child being passed the tty of the parent. Given runcon is not really a sandbox command, the advice is to use `runcon ... setsid ...` to avoid this particular issue.
* runcon: disable use of the TIOCSTI ioctlPádraig Brady2017-08-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | Similar to the issue with SELinux sandbox (CVE-2016-7545), children of runcon can inject arbitrary input to the terminal that would be run at the originating terminal privileges. The new libseccomp dependency is widely available and used on modern SELinux systems, but is not available by default on older systems like RHEL6 etc. * m4/jm-macros.m4: Check for libseccomp and warn if unavailable on selinux supporting systems. * src/local.mk: Link runcon with -lseccomp. * src/runcon.c (disable_tty_inject): A new function to disable use of the TIOCSTI using libseccomp, or with setsid() where libseccomp is unavailable. * tests/misc/runcon-no-inject.sh: A new test that uses python to make the TIOCSTI call, and ensure that doesn't succeed. * tests/local.mk: Reference the new test * NEWS: Mention the fix. Addresses http://bugs.gnu.org/24541
* build: use the appropriate single file include option with xlcPádraig Brady2017-08-131-2/+8
| | | | | | * configure.ac: Set USE_XLC_INCLUDE when __xlc__ is defined. * src/local.mk: Use it to select the appropriate include option. Reported by Michael Felt.
* build: avoid redundant build of tr with --enable-single-binaryBernhard Voelker2017-03-071-1/+1
| | | | | | | * src/local.mk [check-duplicate-no-install]: Depend on the single-binary tr, or the system tr, as the edge case where these are not available only result in the sanity check being effectively ignored.
* ln: replace destination links more atomicallyPaul Eggert2017-02-111-2/+6
| | | | | | | | | | | | | | | | | | | | | | | If the file B already exists, commands like 'ln -f A B' and 'cp -fl A B' no longer remove B before creating the new link. Instead, they arrange for the new link to replace B atomically. This should fix a race condition reported by Mike Crowe (Bug#25680). * NEWS, doc/coreutils.texi (cp invocation, ln invocation): Document this. * bootstrap.conf (gnulib_modules): Add symlinkat. * src/copy.c, src/ln.c: Include force-link.h. * src/copy.c (same_file_ok): It's also OK to remove a destination symlink when creating symbolic links, or when the source and destination are on the same file system and when creating hard links. * src/copy.c (create_hard_link, copy_internal): * src/ln.c (do_link): Rewrite using force_linkat and force_symlinkat, to close a window where the destination temporarily does not exist. * src/cp.c (main): Do not set x.unlink_dest_before_opening merely because we are in link-creation mode. * src/force-link.c, src/force-link.h: New files. * src/local.mk (copy_sources, src_ln_SOURCES): Add them. * tests/cp/same-file.sh: Adjust test case to match fixed behavior.
* build: Properly expand cu_install_program when cross-compilingManolis Ragkousis2017-01-251-1/+1
| | | | | | | * src/local.mk (cu_install_program): Replace @INSTALL_PROGRAM@ with @INSTALL@ when cross-compiling; missed in commit 477a1e8e. Message-Id: <20170125163329.5690-1-manolis837@gmail.com> Copyright-paperwork-exempt: Yes
* maint: update all copyright year number rangesPádraig Brady2017-01-011-1/+1
| | | | | | | | | 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.
* build: avoid racy failure of "make -jN install"Jim Meyering2016-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | Installing with -j2 or greater could result in a failure like /bin/sh: line 29: /P/bin/install: Permission denied when /P/bin/install specifies your PATH-selected install program. This would arise because we're using "install" to install all man/*.1 files, and that command would run concurrently with the one that installs "/P/bin/install" itself. We would run this command: "src/ginstall src/ginstall /P/bin/install", and it would result in intervals during which the destination file does not exist, is empty or incomplete and not executable. We addressed this problem long ago for installation of actual binaries by telling the installation rules to use our just-built bin/ginstall (only when not cross-compiling) rather than the PATH-resolved "install" program. This change is to do the same for those .1 files. * src/local.mk (INSTALL): Override automake's default of something like "INSTALL = /P/bin/install -c". (INSTALL_PROGRAM): Now that we set INSTALL, there is no longer any need to set this derived variable. Its default definition, "INSTALL_PROGRAM = ${INSTALL}" does what we require. Improved by Eric Blake.
* b2sum: a new checksum utility with md5sum like interfacePádraig Brady2016-11-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note we don't support the --algorithm option of the b2sum command in the external BLAKE2 project, as that was deemed too confusing for users. "BLAKE2b" was chosen as the default algorithm to use, which is single threaded but performs well on 64 bit. * src/blake2: CC0 source copied from external project. * cfg.mk[VC_LIST_ALWAYS_EXCLUDE_REGEX]: Exclude blake2/ from syntax checks, make update-copyright, etc. * src/local.mk: Reference the sources for b2sum, and set the compilation flags. * doc/coreutils.texi (b2sum invocation): Reference the md5sum invocation node, and add descriptions of -l. * tests/misc/b2sum.sh: Add new test. * tests/local.mk: Reference new test. * AUTHORS: Add new binary. * README: Likewise. * build-aux/gen-lists-of-programs.sh: Likewise. * man/.gitignore: Likewise. * scripts/git-hooks/commit-msg: Likewise. * man/b2sum.x: New man page template. * man/local.mk: Reference new template. * src/.gitignore: Ignore new binaries. * src/blake2/.gitignore: Ignore new build atrifacts. * src/md5sum.c (usage): Describe the new -l option. * NEWS: Mention the new program.
* all: reduce usage of proper_name_utf8()Pádraig Brady2016-11-141-10/+0
| | | | | | | | | | | | | | | | | | This reduces a standard coreutils install size by about 160K. * src/cat.c: Change to proper_name() which removes about 18K text. * src/cp.c: Likewise. * src/df.c: Likewise. * src/du.c: Likewise. * src/getlimits.c: Likewise. * src/realpath.c: Likewise. * src/split.c: Likewise. * src/stdbuf.c: Likewise. * src/timeout.c: Likewise. * src/truncate.c: Likewise. * src/local.mk: Remove -llibiconv from the above programs. * cfg.mk (sc_check-AUTHORS): Adjust to use factor(1). * AUTHORS: Adjust to use ASCII to satisfy sc_check-AUTHORS.
* build: also distribute new file, src/die.hJim Meyering2016-10-151-0/+1
| | | | * src/local.mk (noinst_HEADERS): Add die.h.
* maint: refactor common expand(1) and unexpand(1) codeAssaf Gordon2016-08-091-0/+4
| | | | | | | | | | | | | | | | | * src/expand.c, src/unexpand.c: Move global variables from here... * src/expand-common.h, src/expand-common.c: ... to here. * src/expand.c, src/unexpand.c: (parse_tab_stops, validate_tab_stops, next_file): Move identical functions to new module. (add_tab_stop): Move to new module, including additional code from 'unexpand' (keeping max_column_width) which will have no effect in when used in 'expand'. Refactor common next-column calculation code into a new function 'get_next_tab_column'. * src/local.mk: (src_expand_SOURCES, src_unexpand_SOURCES): Add 'expand-common.c'; (noinst_HEADERS): Add 'expand-common.h'. * po/POTFILES.in: Add 'expand-common.c'. * tests/misc/expand.pl: Add more tests. * tests/misc/unexpand.pl: Likewise. * TODO: Move conclusions to above test after investigation.
* maint: update all copyright year number rangesPádraig Brady2016-01-011-1/+1
| | | | | | | | | 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.
* build: fix VPATH build with --disable-dependency-trackingPádraig Brady2015-11-191-0/+9
| | | | | | * src/local.mk: Run `mkdir -p src` in all our explicit rules, as in a VPATH build the src/ dir is only created at configure time as a side effect of dependency tracking generation.
* maint: remove unmaintained file, c99-to-c89.diffJim Meyering2015-11-171-2/+1
| | | | | | * src/c99-to-c89.diff: Remove file. * src/local.mk (EXTRA_DIST): Remove it from this list. * README (Pre-C99 build failure): Update section.
* numfmt: use new set-fields module to parse --fieldAssaf Gordon2015-09-121-0/+1
| | | | | | | | | | | numfmt --field=LIST can accept the same options as cut. * bootstrap.conf: remove xlist, linked-list * src/local.mk: link numfmt with set-fields * src/numfmt.c: use set-fields.c instead of custom field parsing code. (include_field): adapt to new code. * tests/misc/numfmt.pl: add new tests, adapt current tests to new error message wording from set-fields.c
* cut: refactor into set-fields moduleAssaf Gordon2015-09-121-0/+3
| | | | | | | | | | | | | | Extract the functionality of parsing --field=LIST into a separate module, to be used by other programs. * src/cut.c: move field parsing code from here ... * src/set-fields.{c,h}: ... to here. (set_fields): generalize by supporting multiple parsing/reporting options. (struct range_pair): rename to field_range_pair. * src/local.mk: link cut with set-field. * po/POTFILES.in: add set-field.c * tests/misc/cut.pl: update wording of error messages