summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* maint: update copyright year number rangesBernhard Voelker2023-01-0130-31/+31
| | | | | | | | Run 'make update-copyright'. * lib/regexprops.c (copying): Update the year number manually. * tests/sample-test: Adjust to use the single most recent year. * All other files: Update copyright years via the above make run.
* maint: avoid warnings from sparse toolBernhard Voelker2022-01-062-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://sparse.docs.kernel.org/ Running the tool against unviled the following warnings: find/parser.c:328:7: warning: Using plain integer as NULL pointer find/parser.c:328:10: warning: Using plain integer as NULL pointer find/parser.c:328:13: warning: Using plain integer as NULL pointer find/parser.c:466:49: warning: Using plain integer as NULL pointer find/parser.c:656:45: warning: Using plain integer as NULL pointer find/print.c:1024:30: warning: Using plain integer as NULL pointer lib/regexprops.c:531:7: warning: symbol 'options' shadows an earlier one lib/regextype.c:48:24: warning: symbol 'regex_map' was not declared. Should it be static? locate/locate.c:131:25: warning: symbol 'check_existence' was not declared. Should it be static? locate/locate.c:207:12: warning: symbol 'metacharacters' was not declared. Should it be static? xargs/xargs.c:902:24: warning: symbol 'state' shadows an earlier one xargs/xargs.c:542:23: warning: Using plain integer as NULL pointer The fixes for these findings are all trivial, so let's apply them. * find/parser.c (parse_table): Initialize pointer-type members of the last element with NULL instead of 0. (get_noop): Compare to NULL as end condition of for-loop. (find_parser): Likewise. * find/print.c (do_fprintf): Initialize linkname with NULL instead of 0. * lib/regexprops.c (describe_all): Rename local variable options to regopts to avoid name shadowing. * lib/regextype.c (regex_map): Declare static. * locate/locate.c (check_existence): Likewise. (metacharacters): Likewise. * xargs/xargs.c (main): Set eof_str to NULL instead of 0.
* maint: fix GPLv3 texts to use a comma instead of semicolonBernhard Voelker2022-01-051-1/+1
| | | | | | | | | | | See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * bootstrap.conf: Adjust GPLv3 header via the above command. * build-aux/gen-changelog.sh: Likewise. * lib/die.h: Likewise.
* maint: update copyright year number rangesBernhard Voelker2022-01-0230-31/+31
| | | | | | | | | | Run 'make update-copyright'. * lib/regexprops.c (copying): Update the year number manually. The format of the copyright year number range in Texinfo files is "YEAR1--YEAR2" now, i.e., with 2x '-'. * tests/sample-test: Adjust to use the single most recent year. * All other files: Update copyright years via the above make run.
* build: fix linking on AIX7.2v4.8.0Bernhard Voelker2021-01-091-0/+1
| | | | | | | | | | | | | | | | | | Linking on AIX7.2 fails: ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock Bruno Haible noticed that $(LIB_MBRTOWC) and $(LIB_SETLOCALE_NULL) expand to -lpthread on that platform, so let's add them to LDADD. Maybe we should better depend on a 'gnulib.mk' file generated by 'gnulib-import' in the long run, but let's fix this issue with the simpler solution for now. * find/Makefile.am (LDADD): Add $(LIB_SETLOCALE_NULL) and $(LIB_MBRTOWC). * locate/Makefile.am (LDADD): Likewise. * xargs/Makefile.am (LDADD): Likewise. * lib/Makefile.am (regexprops_LDADD): Add definition.
* maint: update copyright year number rangesBernhard Voelker2021-01-0230-31/+32
| | | | | | | | | | Run 'make update-copyright'. * lib/regexprops.c (copying): Update the year number manually. The format of the copyright year number range in Texinfo files is "YEAR1--YEAR2" now, i.e., with 2x '-'. * tests/sample-test: Likewise, here to avoid starting a year number range. * All other files: Update copyright years via the above make run.
* maint: use gnulib *_safer functions consistentlyBernhard Voelker2020-12-021-2/+2
| | | | | | | | | | | | | | | | Avoid using fopen_safer and opendir_safer directly in favor of letting gnulib transparently doing the work via "dirent--.h" and "stdio--.h". * find/oldfind.c (dirent-safer.h): Replace include ... (dirent--.h): ... by this. (process_dir): Change opendir_safer to the regular opendir call. * find/sharefile.c (stdio-safer.h): Replace include ... (stdio--.h): ... by this. (sharefile_fopen): Change fopen_safer to regular fopen call. * lib/fdleak.c (dirent-safer.h): Replace include ... (dirent--.h): ... by this. (get_proc_max_fd): Change opendir_safer to regular opendir call.
* maint: ensure .deps/ in the project root is ignored by gitBernhard Voelker2020-03-151-1/+0
| | | | | | | | * .gitignore (.deps/): Add entry. * find/.gitignore (/.deps/): Remove here. * lib/.gitignore: Likewise. * locate/.gitignore: Likewise. * xargs/.gitignore: Likewise.
* doc: prefer https:// over http:// in more placesBernhard Voelker2020-03-151-1/+1
| | | | | | | | | Use HTTPS for GNU, FSF, OpenGroup and Google URLs. * build-aux/update-online-manual.sh: Switch to HTTPS. * doc/find.texi (node Further Reading on Security): Likewise. * lib/buildcmd.c: Likewise in a comment. * NEWS: Likewise, and shorten a debbugs URL.
* maint: update copyright year number rangesBernhard Voelker2020-01-0130-31/+31
| | | | | | | | Run 'make update-copyright'. * lib/regexprops.c (copying): Update the year number manually. * tests/sample-test: Likewise, here to avoid starting a year number range. * All other files: Update copyright years via the above make run.
* xargs: use GNU_FINDUTILS_FD_LEAK_CHECK as for findPavel Modilaynen2019-05-052-0/+14
| | | | | | | | | | | | | | | | | | | Utilize GNU_FINDUTILS_FD_LEAK_CHECK environment variable to enable/disable fd leak check for xargs the same way as for find. * find/defs.h: Remove prototype for fd_leak_check_is_enabled(). * find/util.c: Remove implementation of fd_leak_check_is_enabled(). * lib/fdleak.c: Add implementation of fd_leak_check_is_enabled(). * lib/fdleak.h: Add prototype for fd_leak_check_is_enabled(). * xargs/testsuite/config/unix.exp: Enable GNU_FINDUTILS_FD_LEAK_CHECK for all tests. * xargs/xargs.c: Execute complain_about_leaky_fds when fd_leak_check_is_enabled returns true. * NEWS (Improvements): Document support of GNU_FINDUTILS_FD_LEAK_CHECK by xargs. Copyright-paperwork-exempt: Yes
* maint: update copyright year number rangesBernhard Voelker2019-01-0430-31/+31
| | | | | | | Run 'make update-copyright'. * lib/regexprops.c (copying): Update the year number manually. * All other files: Update copyright years via the above make run.
* maint: avoid continued stringsBernhard Voelker2018-12-021-6/+6
| | | | | | * lib/bugreports.c (explain_how_to_report_bugs): Avoid continued strings by using multi-part strings, one per line. * cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): Add SC rule.
* maint: adjust preprocessor indentation via cppiBernhard Voelker2018-12-0212-42/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Run 'cppi -a' for all *.[ch] files, and add a syntax-check rule for it. * cfg.mk (sc_preprocessor_indentation): Add rule. * find/defs.h: Run 'cppi -a' on this file. * find/fstype.c: Likewise. * find/oldfind.c: Likewise. * find/parser.c: Likewise. * find/pred.c: Likewise. * find/print.h: Likewise. * find/sharefile.h: Likewise. * gnulib-local/lib/gcc-function-attributes.h: Likewise. * lib/bugreports.h: Likewise. * lib/buildcmd.c: Likewise. * lib/buildcmd.h: Likewise. * lib/extendbuf.h: Likewise. * lib/fdleak.h: Likewise. * lib/findutils-version.h: Likewise. * lib/listfile.c: Likewise. * lib/printquoted.h: Likewise. * lib/regextype.h: Likewise. * lib/safe-atoi.h: Likewise. * lib/splitstring.h: Likewise. * lib/system.h: Likewise. * locate/locatedb.h: Likewise. * xargs/xargs.c: Likewise.
* maint: fix typo in comment in safe-atoi.cBernhard Voelker2018-11-101-1/+1
| | | | * lib/safe-atoi.c (safe_atoi): s/chack/check/
* fdleak.c: avoid compiler error on platforms lacking getrlimitAron Barath2018-08-081-8/+10
| | | | | | | | * lib/fdleak.c (get_max_fd): Move definition of the fd_limit variable into the HAVE_GETRLIMIT block giving it a better scope: platforms lacking getrlimit probably also lack struct rlimit, too. Copyright-paperwork-exempt: Yes
* Shorten output of qmark_chars after replacing a multibyte characer.James Youngman2018-07-061-0/+1
| | | | | | | | When qmark_chars() replaces a multibyte character with a single character, this reduces the length of the string. When this happens, terminate the now-shorter string at the new length. This is simple workaround for bug http://savannah.gnu.org/bugs/?54236.
* maint: prevent multiple inclusion of header filesBernhard Voelker2018-03-144-1/+16
| | | | | | | | | * find/print.h: Add #ifndef / #define / #endif guard to prevent multiple inclusion of this header file. * lib/fdleak.h: Likewise. * lib/findutils-version.h: Likewise. * lib/regextype.h: Likewise. * lib/splitstring.h: Likewise.
* build: avoid use of $(RM)Bernhard Voelker2018-03-141-1/+1
| | | | | | | | | | | Some make implementations, e.g. on NetBSD 7.1, lack it; therefore avoid it in order to prevent error messages during 'make clean'. * Makefile.am (coverage-clean): Replace $(RM) by 'rm -f'. * find/Makefile.am: Likewise. * lib/Makefile.am: Likewise. * locate/Makefile.am: Likewise. * xargs/Makefile.am: Likewise.
* maint: move NLS-related macros to a central placeBernhard Voelker2018-03-149-57/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add definition like in coreutils, thus also silencing GCC on NetBSD 7.1: warning: "textdomain" redefined * lib/system.h: Include <locale.h> and gnulib's "gettext.h" here, and define the macros textdomain, bindtextdomain, _ and N_. * find/exe.c: Use it. * find/fstype.c: Likewise. * find/ftsfind.c: Likewise. * find/oldfind.c: Likewise. * find/parser.c: Likewise. * find/pred.c: Likewise. * find/print.c: Likewise. * find/tree.c: Likewise. * find/util.c: Likewise. * lib/bugreports.c: Likewise. * lib/buildcmd.c: Likewise. * lib/dircallback.c: Likewise. * lib/fdleak.c: Likewise. * lib/findutils-version.c: Likewise. * lib/listfile.c: Likewise. * lib/regextype.c: Likewise. * lib/safe-atoi.c: Likewise. * locate/frcode.c: Likewise. * locate/locate.c: Likewise. * locate/word_io.c: Likewise. * xargs/xargs.c: Likewise. * cfg.mk (exclude_file_name_regexp--sc_bindtextdomain): Add exemption for some non-main sources to pass the syntax-check.
* maint: update copyright year number rangesBernhard Voelker2018-01-0130-31/+31
| | | | | | | Run 'make update-copyright'. * lib/regexprops.c (copying): Update the year number manually. * All other files: Update copyright years via the above make run.
* regexprops: don't mention regex dialects we're not going to document.James Youngman2017-11-143-15/+22
| | | | | | | | | | | | * lib/regextype.c (get_regex_type_synonym): don't return regex dialect Y as a synonym of dialect X, if we're not in fact going to include X. Accept a CONTEXT parameter in order to identify this situation. This ensures that the bug fixed in commit e2c673cbcdc325a3a2e9dd02169bb4a42c61bc48 stays fixed for any permutation of regex_map. * lib/regextype.h: update prototype of get_regex_type_synonym. * lib/regexprops.c (describe_all): Pass the new context parameter. * doc/regexprops.texi: regenerate this file.
* regexprops: fix dangling reference to the `ed' regular expression dialect.James Youngman2017-11-142-43/+45
| | | | | | | | | | | | | | * lib/regextype.c (regex_map): Permute the entries to list POSIX dialects before other ones, so that we don't end up with a dangling reference to `ed' regular expressions when context=findutils. Remove trailing white space from the output. * doc/regexprops.texi: Regenerate this file, so that we no longer have a dangling reference to the `ed' dialect. * doc/find.texi (Regular Expressions): Point out the difference between Emacs regular expressions and findutils regular expressions: in findutils "." will match newline. * find/find.1: Likewise. * locate/locate.1: Likewise. Also document the --regextype option.
* all: use die() rather than error(EXIT_FAILURE)Bernhard Voelker2017-11-134-26/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | die() has the advantage of being apparent to the compiler that it doesn't return, which will avoid warnings in some cases, and possibly generate better code. While at it, wrap some of the overly long error messages into a new line. * cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to catch any new uses of error (CONSTANT, ...); * find/exec.c: Include "die.h" and use die rather than exit (EXIT_FAILURE). * find/fstype.c: Likewise. * find/ftsfind.c: Likewise. * find/oldfind.c: Likewise. * find/parser.c: Likewise. * find/pred.c: Likewise. * find/print.c: Likewise. * find/tree.c: Likewise. * find/util.c: Likewise. * lib/buildcmd.c: Likewise. * lib/listfile.c: Likewise. * lib/regextype.c: Likewise. * lib/safe-atoi.c: Likewise. * locate/frcode.c: Likewise. * locate/locate.c: Likewise. * locate/word_io.c: Likewise. * xargs/xargs.c: Likewise.
* maint: avoid unused-but-set-variable, unused-parameter warnings from GCC 7Bernhard Voelker2017-11-132-2/+5
| | | | | | | | GCC-7.2.1 complained about this occur during 'make check'. * lib/regexprops.c (menu): Remove set-but-unused-variable 'options'. * lib/test_splitstring.c (main): Avoid unused-parameter warnings for 'argc' and 'argv'.
* maint: add die.h; avoid missing-fallthrough warnings after error w/ GCC 7Bernhard Voelker2017-11-132-1/+34
| | | | | | | | | | * lib/die.h (die): New file/function from grep/coreutils. Note: this file will probably be migrated to gnulib. * lib/Makefile.am (libfind_a_SOURCES): Reference it. * xargs/xargs.c: Include die.h. (xargs_do_exec): Use die in place of error-nonzero, thus allowing the compiler to know that we do not fall through into the 0 (child) case.
* maint: avoid implicit-fallthrough warnings from GCC 7Bernhard Voelker2017-11-132-1/+45
| | | | | | | | | | | | | | | | Avoid the new warnings GCC 7 gives with the "-Werror=implicit-fallthrough=" compiler option. Since version 7, GCC requires fallthrough switch/cases to be marked by the appropriate attribute. * lib/system.h: Add new header file defining the FALLTHROUGH macro. * lib/Makefile.am (libfind_a_SOURCES): Reference it. * find/print.c (do_fprintf): Use the new macro. * xargs/xargs.c (read_line): Likewise. (xargs_do_exec): For error(3), GCC 7 doesn't know that the function does not return, and would complain about falling through into the following case. Temporarily add an abort call - this will be fixed with another commit.
* maint: avoid unused-macros warning from GCC 7Bernhard Voelker2017-11-081-14/+9
| | | | | | | | | | GCC-7.2.1 on openSUSE-Tumbleweed complains: listfile.c:56:0: error: macro "HAVE_MAJOR" is not used \ [-Werror=unused-macros] #define HAVE_MAJOR * listfile.c (major,minor): Avoid the temporary #define HAVE_MAJOR by using #else's.
* all: prefer https:// URLs where possibleBernhard Voelker2017-10-2327-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change from http:// to https:// URLs for the following: www.gnu.org, gnu.org, savannah.gnu.org, git.sv.gnu.org, lists.gnu.org, translationproject.org, cve.mitre.org, cwe.mitre.org, xkcd.com, standards.ieee.org, and gcc.gnu.org. * COPYING: Do the above replacement. * ChangeLog-2013: Likewise. * NEWS: Likewise. * README: Likewise. * README-hacking: Likewise. * build-aux/Makefile.am: Likewise. * build-aux/check-testfiles.sh: Likewise. * build-aux/gen-changelog.sh: Likewise. * build-aux/man-lint.sh: Likewise. * build-aux/src-sniff.py: Likewise. * cfg.mk: Likewise. * configure.ac: Likewise. * doc/Makefile.am: Likewise. * doc/find-maint.texi: Likewise. * doc/find.texi: Likewise. * find/defs.h: Likewise. * find/exec.c: Likewise. * find/find.1: Likewise. * find/finddata.c: Likewise. * find/fstype.c: Likewise. * find/ftsfind.c: Likewise. * find/oldfind.c: Likewise. * find/parser.c: Likewise. * find/pred.c: Likewise. * find/print.c: Likewise. * find/print.h: Likewise. * find/sharefile.c: Likewise. * find/sharefile.h: Likewise. * find/testsuite/Makefile.am: Likewise. * find/testsuite/binary_locations.sh: Likewise. * find/testsuite/checklists.py: Likewise. * find/testsuite/config/unix.exp: Likewise. * find/testsuite/find.gnu/name-period.exp: Likewise. * find/testsuite/find.posix/depth1.exp: Likewise. * find/testsuite/sv-34079.sh: Likewise. * find/testsuite/sv-34976-execdir-fd-leak.sh: Likewise. * find/testsuite/sv-48030-exec-plus-bug.sh: Likewise. * find/testsuite/sv-48180-refuse-noop.sh: Likewise. * find/testsuite/sv-52220.sh: Likewise. * find/testsuite/sv-bug-32043.sh: Likewise. * find/testsuite/test_escape_c.sh: Likewise. * find/testsuite/test_escapechars.sh: Likewise. * find/testsuite/test_inode.sh: Likewise. * find/testsuite/test_type-list.sh: Likewise. * find/tree.c: Likewise. * find/util.c: Likewise. * gnulib-local/lib/gcc-function-attributes.h: Likewise. * lib/bugreports.c: Likewise. * lib/bugreports.h: Likewise. * lib/buildcmd.c: Likewise. * lib/buildcmd.h: Likewise. * lib/check-regexprops.sh: Likewise. * lib/dircallback.c: Likewise. * lib/dircallback.h: Likewise. * lib/extendbuf.c: Likewise. * lib/extendbuf.h: Likewise. * lib/fdleak.c: Likewise. * lib/fdleak.h: Likewise. * lib/findutils-version.c: Likewise. * lib/findutils-version.h: Likewise. * lib/listfile.c: Likewise. * lib/listfile.h: Likewise. * lib/printquoted.c: Likewise. * lib/printquoted.h: Likewise. * lib/qmark.c: Likewise. * lib/regexprops.c: Likewise. * lib/regextype.c: Likewise. * lib/regextype.h: Likewise. * lib/safe-atoi.c: Likewise. * lib/safe-atoi.h: Likewise. * lib/splitstring.c: Likewise. * lib/splitstring.h: Likewise. * lib/test_splitstring.c: Likewise. * lib/unused-result.h: Likewise. * locate/frcode.c: Likewise. * locate/locate.1: Likewise. * locate/locate.c: Likewise. * locate/locatedb.5: Likewise. * locate/locatedb.h: Likewise. * locate/testsuite/Makefile.am: Likewise. * locate/testsuite/config/unix.exp: Likewise. * locate/updatedb.1: Likewise. * locate/updatedb.sh: Likewise. * locate/word_io.c: Likewise. * po/fetch-po-files: Likewise. * xargs/testsuite/Makefile.am: Likewise. * xargs/testsuite/config/unix.exp: Likewise. * xargs/xargs.1: Likewise. * xargs/xargs.c: Likewise.
* maint: add copyright header to more filesBernhard Voelker2017-10-231-0/+15
| | | | | | | | | | | | * Makefile.am: Add copyright header. * README: Likewise. * TODO: Likewise. * doc/perm.texi: Likewise; use 1994-2017 as Kevin brought it into findutils from coreutils. * find/Makefile.am: Add copyright header. * lib/Makefile.am: Likewise. * locate/Makefile.am: Likewise. * xargs/Makefile.am: Likewise.
* maint: align copyright header lineBernhard Voelker2017-10-234-4/+4
| | | | | | | * lib/extendbuf.c: s/Copyright/Copyright (C)/ * lib/printquoted.h: Likewise. * lib/regextype.c: Likewise. * lib/regextype.h: Likewise.
* maint: update copyright year number rangesBernhard Voelker2017-10-2327-41/+29
| | | | | | | | | | | | | | | | | | Better late than never: run 'make update-copyright'. * cfg.mk (update-copyright-env): Change UPDATE_COPYRIGHT_USE_INTERVALS from 1 to 2 to get a minimal containing range of years; also set UPDATE_COPYRIGHT_MAX_LINE_LENGTH to 79 characters. * .x-update-copyright: Add an entry for bootstrap which comes from gnulib. * lib/qmark.c: While at it, fix a typo: s/courutils/coreutils/. * lib/regexprops.c (copying): Update the text so that the copyright years match the result of "make update-copyright". * po/fi.po: Change copyright header so that "make update-copyright" can pick it up: s/©/(C)/ * po/it.po: Likewise. * po/vi.po: Likewise. * All other files: Update copyright years via the above make run.
* maint: avoid warnings from GCC 6.2.1Bernhard Voelker2017-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buildcmd.c: In function 'bc_push_arg': buildcmd.c:362:11: error: this 'if' clause does not guard... [-Werror=misleading-indentation] if (ctl->replace_pat ^~ buildcmd.c:366:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' bc_do_exec (ctl, state); ^~~~~~~~~~ pred.c: In function 'print_optlist': pred.c:1328:46: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'long unsigned int' [-Werror=format=] fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits); ^ pred.c:1328:50: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'long unsigned int' [-Werror=format=] fprintf (fp, "[real success rate %ld/%ld", p->perf.successes, p->perf.visits); ^ print.c: In function 'scan_for_digit_differences': print.c:449:46: error: logical 'or' of equal expressions [-Werror=logical-op] if (!isdigit ((unsigned char)q[i]) || !isdigit ((unsigned char)q[i])) ^~ In file included from ../gl/lib/gettext.h:25:0, from locate.c:86: locate.c: In function 'dolocate': locate.c:1873:28: error: format '%d' expects argument of type 'int', but argument 5 has type 'unsigned int' [-Werror=format=] _("warning: database %s is more than %d %s old (actual age is %.1f %s)"), ^ locate.c:1873:26: note: in expansion of macro '_' _("warning: database %s is more than %d %s old (actual age is %.1f %s)"), ^ locate.c:1927:18: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'long unsigned int' [-Werror=format=] printf ("%ld\n", found); ^ cc1: all warnings being treated as errors * find/pred.c (print_optlist): Use %lu for unsigned long int. * find/print.c (scan_for_digit_differences): Check p[i] too rather than q[i] two times. * lib/buildcmd.c (bc_push_arg): Fix indentation. * locate/locate.c (dolocate): Use %u format for unsigned int. Use %lu format for unsigned long int.
* find: handle more readdir(3) errorsBernhard Voelker2016-11-021-4/+17
| | | | | | | | | | | Similar to the FTS readdir fix in v4.6.0-72-g155c9d1, handle the last two unhandled readdir(3) errors. * find/pred.c (pred_empty): Do the above. * lib/fdleak.c (get_proc_max_fd): Likewise. While at it, fix the condition to only skip "." and ".."; previously, also other files beginning with ".." would have been skipped - that was theoretically, as we only expect the FD files in "/proc/self/fd".
* Fix bug #48030: find: -exec + does not pass all arguments in certain casesBernhard Voelker2016-05-311-5/+5
| | | | | | | | | | | | | | | | | | | When the -exec arguments buffer (usually 128k) is full and the given command has been executed with all that arguments, find(1) missed to execute the command yet another time if only 1 another file would have to be processed. Both find(1), i.e., nowadays FTS-version, and oldfind are affected. This bug was present since the implementation of '-exec +' in 2005, see commit FINDUTILS_4_2_11-1-25-gf0a6ac6. * lib/buildcmd.c (bc_push_arg): Move the assignment to set 'state->todo' to 1 down after the immediate execution which resets that flag. * find/testsuite/sv-48030-exec-plus-bug.sh: Add a test. * find/testsuite/Makefile.am (test_shell_progs): Reference the test. * NEWS (Bug Fixes): Mention the fix. Reported by Joe Philip Ninan <indiajoe@gmail.com> in https://savannah.gnu.org/bugs/?48030
* maint: adjust .gitignore filesBernhard Voelker2016-02-161-24/+5
| | | | | | | | | | * lib/.gitignore: Use pattern for prominent suffixes like *.o, *.log and *.a; an entry for the new intermediate file bugreports.o was missing here. Sort file. * locate/.gitignore (bigram,code,bigram.o,code.o): Remove, as these programs have been removed with commit v4.6.0-44-g89ec021. * find/.gitignore: Use pattern for *.o, and sort the file. * xargs/.gitignore: Likewise.
* maint: avoid syntax-check failuresBernhard Voelker2016-02-161-3/+0
| | | | | | | | | | | | | | | | 'make syntax-check' failed with: locate/word_io.h: maint.mk: the above files include assert.h but don't use it maint.mk:479: recipe for target 'sc_prohibit_assert_without_use' failed ... lib/bugreports.h: maint.mk: empty line(s) or no newline at EOF maint.mk:929: recipe for target 'sc_prohibit_empty_lines_at_EOF' failed * locate/word_io.h (#include <assert.h>): Remove superfluous inclusion of <assert.h>. * lib/bugreports.h: Remove stray empty line at EOF.
* Better and more consistent guidance on how to report bugs.James Youngman2016-01-253-1/+76
| | | | | | | | | | | | | | | | | | | | * configure.ac (PACKAGE_BUGREPORT_URL): Define this macro to point to the findutils bug-reporting web page. * lib/bugreports.c: New file, defining the function explain_how_to_report_bugs which explains how to report bugs. Use the new PACKAGE_BUGREPORT_URL macro. * lib/bugreports.h: New file, providing a declaration of explain_how_to_report_bugs. * lib/Makefile.am (libfind_a_SOURCES): Add bugreports.c and bugreports.h. * find/parser.c (parse_help): Call explain_how_to_report_bugs instead of printing an explanation here. * xargs/xargs.c (usage): Likewise. * locate/locate.c (usage): Likewise. * locate/code.c (usage): Likewise. * locate/frcode.c (usage): Likewise. * locate/updatedb.sh (usage): Produce a similar message by including it in the usage text itself.
* maint: update .gitignore files, remove obsolete .cvsignore filesBernhard Voelker2016-01-042-41/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .gitignore (tool-versions.txt): Add entry. (ABOUT-NLS): Change to ... (/ABOUT-NLS): ... this to avoid ./bootstrap adding it again. * build-aux/.gitignore (/ar-lib, /snippet/, /test-driver): Add entries. While at it, use the git-specific '/' prefix on other entries, and sort the file. * doc/.gitignore (/dblocation.texi): Add entry. Prefix other entries with '/' and sort the file. * find/.gitignore (/exec.o, /print.o): Likewise. * find/testsuite/.gitignore (/configured-testfiles.txt, /*.log, /*.trs): Likewise. * lib/.gitignore (check-regexprops, /check-regexprops.log, /check-regexprops.trs, /regexprops.texi.new, /splitstring.o, /test_splitstring, /test_splitstring.log, /test_splitstring.o /test_splitstring.trs, /test-suite.log): Likewise. * po/.gitignore (/Makevars): Add entry. While at it, prefix all other entries with '/', too, to avoid bootstrap adding entries for e.g. "/Makefile.in.in" again. * .cvsignore: Remove file. * build-aux/.cvsignore: Likewise. * doc/.cvsignore: Likewise. * find/.cvsignore: Likewise. * find/testsuite/.cvsignore: Likewise. * lib/.cvsignore: Likewise. * locate/.cvsignore: Likewise. * locate/testsuite/.cvsignore: Likewise. * m4/.cvsignore: Likewise. * po/.cvsignore: Likewise. * xargs/.cvsignore: Likewise. * xargs/testsuite/.cvsignore: Likewise.
* maint: update copyright years.James Youngman2016-01-0325-30/+32
| | | | | | | | | | | | * lib/regexprops.c (copying): Update the text so that the copyright years (and the line breaks) match the result of "make update-copyright". * doc/regexprops.texi: Tweak copyright years to match the result of "make update-copyright". * All other files: update copyright years if the file has a copyright statement. * .x-update-copyright: new file, a list of files to exclude from automated copyright updates.
* regexprops: Fix compiler warnings and update copyright years.James Youngman2016-01-031-6/+6
| | | | | | | | | | | | | * lib/regexprops.c (newpara): Function parameter list should be declared as void in the function definition, instead of leaving it blank (C++ style). This fixes a GCC warning controlled by -Wstrict-prototypes. (beginenum): Likewise. (endenum): Likewise. (endtable): Likewise. (copying): Update copyright years. * doc/regexprops.texi: Update copyright years to match the output of regexprops.c.
* lib: Update the width of the st_nlink field and fix some compiler warnings.James Youngman2016-01-032-4/+25
| | | | | | | | | * lib/listfile.h (list_file): Make the relname parameter const. * lib/listfile.c (list_file): Make the relname parameter const. Remove the unused local variable inode_field_width. Update nlink_width with the greatest width of the st_nlink field, and print the field using the maximum width (as we do for other fields).
* maint: Don't define the gettext-related macro N_ where it is not needed.James Youngman2016-01-035-30/+0
| | | | | | | | | | | | | | | | | | | | | * lib/buildcmd.c: Don't define the macro N_(), since we don't use it. * lib/fdleak.c: Likewise. * lib/safe-atoi.c: Likewise. * lib/regextype.c: Likewise. * lib/listfile.c: Likewise. * locate/bigram.c: Likewise. * locate/code.c: Likewise. * locate/frcode.c: Likewise. * locate/word_io.c: Likewise. * find/fstype.c: Likewise. * find/parser.c: Likewise. * find/pred.c: Likewise. * find/exec.c: Likewise. * find/tree.c: Likewise. * find/util.c: Likewise. * find/print.c: Likewise. * find/ftsfind.c: Likewise.
* lib: FINDLIB_REPLACE_FUNCS has become obsolete, so delete findlib.James Youngman2016-01-033-138/+23
| | | | | | | | | | | | | | | | | * configure.ac: gnulib supplies waitpid and C89 supplies strspn. Hence there is no need for any call to FINDLIB_REPLACE_FUNCS. That being the case we don't need to test it with forcefindlib. * m4/findlib.m4: remove since FINDLIB_REPLACE_FUNCS is unused. * m4/Makefile.am (EXTRA_DIST): findlib.m4 has been deleted, so don't distribute it. * lib/waitpid.c: remove, since gnulib provides this. * lib/forcefindlib.c: remove, since there is no longer any need to test FINDLIB_REPLACE_FUNCS. * lib/Makefile.am (libfind_a_SOURCES): Specify this variable all in one go, instead of in several parts. Move some header files into here instead of just having them in EXTRA_DIST. Because FINDLIBOBJS is empty now, there is no need to copy that to libfind_a_LIBADD.
* maint: avoid sc_prohibit_always_true_header_tests failure.Bernhard Voelker2015-12-281-2/+2
| | | | | | | * configure.ac: Check for getrlimit function directly rather than the "sys/resource.h" header file. * lib/fdleak.c: Include "sys/resource.h" when HAVE_GETRLIMIT is set. (get_max_fd): s/HAVE_GETRUSAGE/HAVE_GETRLIMIT/.
* maint: avoid syntax-check failuresBernhard Voelker2015-12-282-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (gen-ChangeLog): Replace 8 spaces by a tab to avoid sc_makefile_TAB_only_indentation failure. * po/POTFILES.in: Remove some entries to let sc_po_check pass. While at it, sort the entries. * find/print.c (do_fprintf): Remove stray semicolon to let sc_prohibit_double_semicolon pass. * find/util.c (digest_mode): Likewise. * bootstrap.conf: Change comment to let sc_prohibit_doubled_word pass. * build-aux/git-log-fix: Remove empty lines at EOF to let sc_prohibit_empty_lines_at_EOF pass. * find/testsuite/Makefile.am: Likewise. * find/testsuite/sv-34079.sh: Likewise. * find/testsuite/test_inode.sh: Likewise. * locate/testsuite/locate.gnu/slocate.exp: Likewise. * lib/buildcmd.c: Remove unused include of openat header to let sc_prohibit_openat_without_use pass. * lib/listfile.c: Likewise. * find/util.c: Remove unused include of 'verify.h' to let sc_prohibit_verify_without_use pass. * xargs/xargs.c: Likewise. * find/parser.c (insert_regex): Mark error diagnostic for translation; found by 'make sc_unmarked_diagnostics'. * cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Exempt the 2 remaining sources using the possibly dangerous strncpy function from the syntax-check.
* Use the official FDL license wording in license text.Andreas Metzler2015-12-271-3/+3
| | | | | | | | | | | | * README-hacking (footer): use the official FDL license wording as listed in FDL's "ADDENDUM: How to use this License for your documents". Update copyright year. * NEWS (footer): Likewise. * doc/find-maint.texi: Likewise. * doc/find.texi: Likewise. * doc/regexprops.texi: Likewise. * lib/regexprops.c (copying): Amend the code to emit the updated wording. Update the copyright year.
* Document the functions declared in regextype.h.James Youngman2015-12-231-3/+24
| | | | | * lib/regextype.h: Document the semantics of the functions declared in this header.
* Add copyright headers to some files which lack them.James Youngman2015-11-011-1/+14
| | | | | | | | | | | | | | | | | * find/testsuite/excuses.txt: remove spurious character (a typo). * find/testsuite/test_escape_c.sh: Add copyright header. * find/testsuite/binary_locations.sh: Likewise. * find/testsuite/checklists.py: Likewise. * find/testsuite/Makefile.am: Likewise. * find/testsuite/sv-bug-32043.sh: Likewise. * find/testsuite/test_escapechars.sh: Likewise. * find/testsuite/test_inode.sh: Likewise. * xargs/testsuite/Makefile.am: Likewise. * locate/testsuite/Makefile.am: Likewise. * build-aux/Makefile.am: Likewise. * doc/Makefile.am: Likewise. * find/print.h: Likewise. * lib/check-regexprops.sh: Likewise.
* find: adaptive column alignment (resolves Savannah bug #45780)James Youngman2015-10-311-217/+332
| | | | | | | | | | | | | | | | * lib/listfile.c (list_file): For aligned fields, use the number of characters output to deduce whether our current idea of the maximum width of each field is too small. When this happens, increase the field width. Keep track of the field width in a static variable for each field. Do this for the inode number, number of blocks, owner, group, major and minor device numbers, and the file size. Use mbswidth in some places to count characters. * find/print.c (do_fprintf): Mention the potential portability problems in casting ino_t to uintmax_t. * bootstrap.conf (gnulib_modules): Add mbswidth. * po/Makevars (XGETTEXT_OPTIONS): updated by running bootstrap. *NEWS: Mention this bugfix.