Commit Graph

304 Commits

Author SHA1 Message Date
Pádraig Brady
4cb2742d70 tests: fix false failure on systems that can chmod symlinks
* tests/chmod/symlinks.sh: The count of adjusted modes was
one more on systems where symlink modes can be adjusted.
Therefore only include the non symlinks in the count.
2024-03-25 12:12:19 +00:00
Pádraig Brady
f77a6352fb test: avoid false failure with setgid directories
* tests/chmod/symlinks.sh: Ensure this new test is immune
to setgid directories by resetting modes with =777 rather than 777.
Also output more debugging in all failure cases.
2024-03-24 19:46:57 +00:00
Pádraig Brady
07a69fc3ba chmod: add support for -h, -H,-L,-P, --dereference options
There have been various requests to add -h to avoid following symlinks
for security reasons.  This wasn't provided previously as chmod(1)
already ignored symlinks unless specified on the command line.
Note chmod defaults to -H mode rather than the chown default of -P,
as usually chown can work directly on symlinks and so defaults
to not traversing those specified on the command line.
Note FreeBSD chmod does default to -P mode, but we retain the -H mode
default also for compatibility with existing chmod behavior.

Adding -HLP will allow chmod to disable traversing CLI symlinks to dirs.
Adding -h will allow to disable following CLI symlinks to files/dirs,
  also operating on all symlinks on systems that support that.
Adding --dereference will be significant with -H (the default).  I.e.
  symlinks to dirs not recursed, but symlinks are dereferenced.
Adding these options will also be consistent with chown(1), chgrp(1),
and chmod(1) on other systems.

Note since chmod(1) currently ignores symlinks by default,
and -h is primarily a mechanism to avoid following symlinks, rather than
for operating on the symlink itself, we make -h try to chmod a symlink,
but ignore ENOTSUP.  In that way we're consistent with chown(1)
where it also ignores ENOTSUP for symlinks, and we don't fail when
trying to be extra secure with command line params.

* doc/coreutils.texi (chmod invocation): Reference the -H,-L,-P
descriptions, and adjust the corresponding macros to say
the default is -H or -P as appropriate.
Add --dereference and -h,--no-dereference descriptions.
* man/chmod.x: Adjust discussion of symlink handling.
* src/chmod.c (main): Accept new options and set
fts flags appropriately.
(process_file): Process / dereference symlinks as necessary.
* src/system.h (emit_symlink_recurse_options): A new function
refactored from chown.c and chmod.c usage().
* tests/chmod/symlinks.sh: New test for the new options.
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.
2024-03-19 23:43:53 +00:00
Pádraig Brady
a966dcdb69 maint: update all copyright year number ranges
Update to latest gnulib with new copyright year.
Run "make update-copyright" and then...

* gnulib: Update included in this commit as copyright years
are the only change from the previous gnulib commit.
* 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.
2024-01-01 13:27:23 +00:00
Paul Eggert
95f4ee0577 tests: port chmod/setgid.sh to macOS 12
* tests/chmod/setgid.sh: Try all the groups you’re a member of,
in case id -g returns 4294967295 (nogroup) which is special
and does not let you chgrp a file to it.
2023-02-18 13:30:10 -08:00
Pádraig Brady
01755d36e7 maint: update all copyright year number ranges
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.
2023-01-01 14:50:15 +00:00
Pádraig Brady
3067a9293a maint: update all copyright year number ranges
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.
2022-01-02 16:15:55 +00:00
Pádraig Brady
e8b56ebd53 chmod: fix exit status when ignoring symlinks
* src/chmod.c: Reorder enum so CH_NOT_APPLIED
can be treated as a non error.
* tests/chmod/ignore-symlink.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/50784
2021-09-24 23:42:20 +01:00
Pádraig Brady
32ff1d1313 maint: update all copyright year number ranges
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.
2021-01-01 16:36:09 +00:00
Pádraig Brady
aaba82431c maint: update all copyright year number ranges
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.
2020-01-01 14:16:56 +00:00
Assaf Gordon
8dfcf38af1 maint: update all copyright year number ranges
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.
2019-01-01 16:51:48 -07:00
Pádraig Brady
ece7157933 maint: update all copyright year number ranges
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.
2018-01-01 15:57:22 +00:00
Paul Eggert
be87d61299 all: prefer HTTPS in URLs 2017-09-19 01:22:54 -07:00
Pádraig Brady
e7a2580b96 maint: update all copyright year number ranges
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.
2017-01-01 22:38:02 +00:00
Jim Meyering
22063c8c08 tests: use "returns_" rather than explicit comparison with "$?"
* tests/chmod/no-x.sh: Likewise.
* tests/cp/no-deref-link1.sh: Likewise.
* tests/cp/no-deref-link2.sh: Likewise.
* tests/cp/no-deref-link3.sh: Likewise.
* tests/du/move-dir-while-traversing.sh: Likewise.
* tests/ls/infloop.sh: Likewise.
* tests/ls/stat-failed.sh: Likewise.
* tests/ls/time-style-diag.sh: Likewise.
* tests/misc/chroot-fail.sh: Likewise.
* tests/misc/env-null.sh: Likewise.
* tests/misc/env.sh: Likewise.
* tests/misc/nice-fail.sh: Likewise.
* tests/misc/printenv.sh: Likewise.
* tests/misc/timeout.sh: Likewise.
* tests/tail-2/follow-name.sh: Likewise.
2016-11-13 08:26:19 -08:00
Pádraig Brady
b16e999f55 maint: update all copyright year number ranges
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.
2016-01-01 14:10:41 +00:00
Pádraig Brady
58cff8a009 tests: add extra protection against unexpected exits
Many tests use `program ... && fail=1` to ensure expected
error situations are indicated.  However that would mask
an unexpected exit (like a crash).  Therefore explicitly
check the expected exit code.
Note where error messages are also verified, the extra
protection is not added.

* tests/init.sh (returns_): A new helper function to
check the return code of a command, and used
throughout the tests.
* cfg.mk (sc_prohibit_and_fail_1): Add a syntax check
to avoid new instances of this issue.
2015-01-14 12:20:32 +00:00
Pádraig Brady
e0afeb0099 maint: update all copyright year number ranges
Run "make update-copyright" and then...

* tests/sample-test: Adjust to use the single most recent year.
* tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message,
so that year is updated automatically in future.
2015-01-01 04:52:17 +00:00
Pádraig Brady
8840a00cd7 tests: improve diagnostics when asserting empty files
* tests/chmod/c-option.sh: Use `compare /dev/null ... || fail=1`
rather than `test -s ... && fail=1`, so that the file contents
are output, thus improving diagnostics for failing tests.
* tests/cp/acl.sh: Likewise.
* tests/cp/cp-a-selinux.sh: Likewise.
* tests/cp/cp-mv-enotsup-xattr.sh: Likewise.
* tests/cp/reflink-perm.sh: Likewise.
* tests/dd/misc.sh: Likewise.
* tests/misc/env-null.sh: Likewise.
* tests/misc/env.sh: Likewise.
* tests/misc/nice.sh: Likewise.
* tests/misc/nohup.sh: Likewise.
* tests/misc/printenv.sh: Likewise.
* tests/misc/xattr.sh: Likewise.
* tests/mv/update.sh: Likewise.
* tests/rm/deep-2.sh: Likewise.
* tests/rm/read-only.sh: Likewise.
* tests/split/r-chunk.sh: Likewise.
* tests/tail-2/follow-stdin.sh: Likewise.
* tests/tail-2/inotify-race.sh: Likewise.
* tests/tail-2/wait.sh: Likewise.
* tests/touch/no-dereference.sh: Likewise.

* cfg.mk (sc_prohibit_test_empty:): New syntax-check.
* tests/cp/proc-zero-len.sh: Adjust to avoid false syntax-check failure.
* tests/cp/proc-zero-len.sh: Likewise.
* tests/mv/part-symlink.sh: Likewise.
* tests/tail-2/infloop-1.sh: Likewise.
2014-05-07 00:06:00 +01:00
Dylan Simon
09eda9ed9d chmod: fix erroneous warnings with -R --changes
For files with "special" bits set, we would stat the relative
file name in the wrong directory, giving an erroneous ENOENT diagnostic.
This issue was introduced with commit v5.92-653-gc1994c1
which changed fts to not change directory on traversal.

* src/chmod.c (mode_changed): Use fts->fts_cwd_fd with fstatat rather
than stat.  All callers changed.
* tests/chmod/c-option.sh: Add a test case.
* NEWS: Mention the fix.
Fixes http://bugs.gnu.org/17035
2014-03-19 02:33:44 +00:00
Bernhard Voelker
275c078fb4 maint: update all copyright year number ranges
Run "make update-copyright", but then also run this,
  perl -pi -e 's/2\d\d\d-//' tests/sample-test
to make that one script use the single most recent year number.
2014-01-02 22:19:59 +01:00
Jim Meyering
77da73c754 maint: update all copyright year number ranges
Run "make update-copyright", but then also run this,
  perl -pi -e 's/2\d\d\d-//' tests/sample-test
to make that one script use the single most recent year number.
2013-01-01 04:51:20 +01:00
Stefano Lattarini
21b5147fd8 build: don't use recursive make for tests/ subdirectory
* Makefile.am (SUBDIRS): Remove 'tests'.
(include): The '$(top_srcdir)/tests/local.mk' file.
(check-root): Remove this convenience target, it's no longer needed
now that the "real" check-root target once in 'tests/Makefile' will
land in the top-level makefile.
* configure.ac (AC_CONFIG_FILES): Remove 'tests/Makefile'.
* tests/Makefile.am: Rename ...
* tests/local.mk: ... like this, with a lot of adjustments.
* tests/init.cfg: Move ...
* init.cfg: ... here.  This is necessary, for a limitation of the
gnulib-provided 'tests/init.sh', which unconditionally look for
'init.cfg' in the $(srcdir) directory.
* tests/*/*.sh: Adjust: expect init.sh to be in '$srcdir/tests',
not in '$srcdir', and extend $PATH with './src', not with '../src'.
* tests/Coreutils.pm: Adjust similarly.
* tests/pr/pr-tests.pl ($pfx): Likewise.
2012-09-05 08:48:29 +02:00
Stefano Lattarini
9eb4c31eb7 tests: add .sh and .pl suffixes to shell and perl tests, respectively
Not only this shrinks the size of the generated Makefile (from > 6300
lines to ~3000), but will allow further simplifications in future
changes.

* tests/Makefile.am (TEST_EXTENSIONS): Add '.sh' and '.pl'.
(PL_LOG_COMPILER, SH_LOG_COMPILER): New, still defined simply to
$(LOG_COMPILER) for the time being.
(TESTS, root_tests): Adjust as described.
* All tests: Rename as described.
2012-08-30 18:55:59 +02:00
Jim Meyering
e43d30eab3 tests: convert nearly all ... expressions to $(...)
Exempt init.sh because it runs before we're assured to have a
shell that groks $(...).  Exempt *.mk because "$" would have to
be doubled, and besides, any `...` expression in a .mk file is
almost certainly evaluated before init.sh is run.  Finally, also
exempt the perl-based tests, because perl's `...` cannot be
converted to $(...).  Do that by running this command:

git grep -l '`.*`' tests \
  | grep -Ev 'init\.sh|\.mk$' | xargs grep -Lw perl \
  | xargs perl -pi -e 's/`(.*?)`/\$($1)/g'

One minor fix-up change was required after that, due to how
quoting differs:
diff --git a/tests/chmod/equals b/tests/chmod/equals
-    expected_perms=$(eval 'echo \$expected_'$dest)
+    expected_perms=$(eval 'echo $expected_'$dest)

Another was to make these required quoting adjustments:
diff --git a/tests/misc/stty b/tests/misc/stty
...
-  rev=$(eval echo "\\\$REV_$opt")
+  rev=$(eval echo "\$REV_$opt")
...
-      rev1=$(eval echo "\\\$REV_$opt1")
-      rev2=$(eval echo "\\\$REV_$opt2")
+      rev1=$(eval echo "\$REV_$opt1")
+      rev2=$(eval echo "\$REV_$opt2")

Also, transform two files that were needlessly excluded above:
(both use perl, but are mostly bourne shell)

  perl -pi -e 's/`(.*?)`/\$($1)/g' \
    tests/du/long-from-unreadable tests/init.cfg
2012-04-04 12:20:56 +02:00
Paul Eggert
8931cdbfda chmod: add notations +40, 00440, etc.
* NEWS: Document this.
* doc/perm.texi (Operator Numeric Modes): New section.
(Numeric Modes, Directory Setuid and Setgid): Document new behavior.
* src/chmod.c (usage): Document new behavior.
(main): Support new options -0, -1, etc.
* tests/chmod/setgid: Test these new features.
2012-03-08 19:01:26 -08:00
Jim Meyering
d7878454cd maint: use single copyright year range
Run "make update-copyright".
2012-01-27 11:35:24 +01:00
Jim Meyering
ae2b0d2ddc tests: more automated quote adjustment
Relax initial regexp to match more instances, but add a
filter to avoid some invalid conversions.  Run this:

git grep -l "\`[^']*'" tests | xargs perl -pi -e '$q=q"'\''";' \
  -e '$q="$q\\$q$q"; /(= ?\`|\`expr|\`echo|\Q$q\E)/ and next;' \
  -e ' s/\`([^'\''"]*?'\'')/'\''$1/g'
The last disjunct in the above (...) filter is to exempt
any line that contains this string: '\''
With quoting like that, converting a ` to ' is likely to cause trouble,
so we'll handle those manually.  Here are three examples where
the exemption is required:

  *': `link-to-dir/'\'': hard link not allowed for directory'*) ;;
  printf 'creating file `%s'\''\n' $f
  'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
2012-01-09 21:50:08 +01:00
Jim Meyering
dd0e4c5621 tests: change `...' to '...' on lines not matching /[=\$]/
Exempt lines with '$' or '=', since those are prone to improper
conversion.  Run this:
  git grep -l "\`[^']*'" tests \
   |xargs perl -pi -e '/[=\$]/ and next;s/\`([^'\''"]*?'\'')/'\''$1/g'
2012-01-09 21:50:08 +01:00
Jim Meyering
50610144b0 tests: adjust \`...' quoting to '...' to adapt to latest gnulib
Run this:
  git grep -l "\\\\\`[^']*'" tests \
    |xargs perl -pi -e 's/\\\`(.*?'\'')/'\''$1/g
2012-01-09 21:50:08 +01:00
Jim Meyering
5111aa4296 maint: update all copyright year number ranges
Run "make update-copyright".
2012-01-01 10:04:06 +01:00
Jim Meyering
a2c811db42 tests: use "compare exp out", not "compare out exp"
Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name.  Prompted by a suggestion from Bruno Haible
in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154

Run these commands:

    git grep -l -E 'compare [^ ]+ exp' \
      |xargs perl -pi -e 's/(compare) (\S+) (exp\S*)/$1 $3 $2/'
    git grep -l -E 'compare [^ ]+ /dev/null' \
      |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/'

* tests/chgrp/no-x: As above.
* tests/chmod/no-x: Likewise.
* tests/chmod/silent: Likewise.
* tests/chmod/thru-dangling: Likewise.
* tests/chown/basic: Likewise.
* tests/chown/deref: Likewise.
* tests/chown/preserve-root: Likewise.
* tests/cp/abuse: Likewise.
* tests/cp/backup-is-src: Likewise.
* tests/cp/cp-a-selinux: Likewise.
* tests/cp/cp-mv-enotsup-xattr: Likewise.
* tests/cp/fail-perm: Likewise.
* tests/cp/into-self: Likewise.
* tests/cp/proc-zero-len: Likewise.
* tests/cp/src-base-dot: Likewise.
* tests/cp/thru-dangling: Likewise.
* tests/dd/reblock: Likewise.
* tests/dd/unblock-sync: Likewise.
* tests/du/2g: Likewise.
* tests/du/8gb: Likewise.
* tests/du/basic: Likewise.
* tests/du/bigtime: Likewise.
* tests/du/deref-args: Likewise.
* tests/du/exclude: Likewise.
* tests/du/files0-from-dir: Likewise.
* tests/du/hard-link: Likewise.
* tests/du/inacc-dest: Likewise.
* tests/du/inacc-dir: Likewise.
* tests/du/long-sloop: Likewise.
* tests/du/max-depth: Likewise.
* tests/du/move-dir-while-traversing: Likewise.
* tests/du/no-deref: Likewise.
* tests/du/no-x: Likewise.
* tests/du/one-file-system: Likewise.
* tests/du/slash: Likewise.
* tests/du/trailing-slash: Likewise.
* tests/install/strip-program: Likewise.
* tests/ln/hard-backup: Likewise.
* tests/ls/block-size: Likewise.
* tests/ls/color-clear-to-eol: Likewise.
* tests/ls/color-dtype-dir: Likewise.
* tests/ls/color-norm: Likewise.
* tests/ls/dangle: Likewise.
* tests/ls/dired: Likewise.
* tests/ls/file-type: Likewise.
* tests/ls/follow-slink: Likewise.
* tests/ls/infloop: Likewise.
* tests/ls/m-option: Likewise.
* tests/ls/no-arg: Likewise.
* tests/ls/recursive: Likewise.
* tests/ls/rt-1: Likewise.
* tests/ls/stat-dtype: Likewise.
* tests/ls/stat-failed: Likewise.
* tests/ls/stat-free-symlinks: Likewise.
* tests/ls/x-option: Likewise.
* tests/misc/arch: Likewise.
* tests/misc/cat-buf: Likewise.
* tests/misc/cat-proc: Likewise.
* tests/misc/chcon: Likewise.
* tests/misc/csplit: Likewise.
* tests/misc/df-P: Likewise.
* tests/misc/fmt-long-line: Likewise.
* tests/misc/groups-dash: Likewise.
* tests/misc/groups-version: Likewise.
* tests/misc/head-pos: Likewise.
* tests/misc/nl: Likewise.
* tests/misc/od-N: Likewise.
* tests/misc/od-multiple-t: Likewise.
* tests/misc/od-x8: Likewise.
* tests/misc/printf: Likewise.
* tests/misc/printf-hex: Likewise.
* tests/misc/pwd-option: Likewise.
* tests/misc/readlink-fp-loop: Likewise.
* tests/misc/runcon-no-reorder: Likewise.
* tests/misc/seq-long-double: Likewise.
* tests/misc/sort-NaN-infloop: Likewise.
* tests/misc/sort-benchmark-random: Likewise.
* tests/misc/sort-debug-keys: Likewise.
* tests/misc/sort-float: Likewise.
* tests/misc/sort-merge-fdlimit: Likewise.
* tests/misc/sort-unique-segv: Likewise.
* tests/misc/stat-hyphen: Likewise.
* tests/misc/stat-slash: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/sum-sysv: Likewise.
* tests/misc/tac-2-nonseekable: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/misc/tr-case-class: Likewise.
* tests/misc/truncate-fail-diag: Likewise.
* tests/misc/wc-files0: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mv/backup-dir: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/dir2dir: Likewise.
* tests/mv/dup-source: Likewise.
* tests/mv/force: Likewise.
* tests/mv/hard-verbose: Likewise.
* tests/mv/i-link-no: Likewise.
* tests/mv/into-self: Likewise.
* tests/mv/into-self-2: Likewise.
* tests/mv/into-self-3: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/perm-1: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/mv/trailing-slash: Likewise.
* tests/rm/rm1: Likewise.
* tests/rm/rm2: Likewise.
* tests/rm/cycle: Likewise.
* tests/rm/dir-no-w: Likewise.
* tests/rm/dir-nonrecur: Likewise.
* tests/rm/fail-2eperm: Likewise.
* tests/rm/fail-eacces: Likewise.
* tests/rm/i-never: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/interactive-always: Likewise.
* tests/rm/interactive-once: Likewise.
* tests/rm/isatty: Likewise.
* tests/rm/one-file-system: Likewise.
* tests/rm/rm3: Likewise.
* tests/rm/rm5: Likewise.
* tests/rm/unread2: Likewise.
* tests/rm/v-slash: Likewise.
* tests/sample-test: Likewise.
* tests/split/b-chunk: Likewise.
* tests/split/fail: Likewise.
* tests/split/l-chunk: Likewise.
* tests/split/lines: Likewise.
* tests/split/r-chunk: Likewise.
* tests/split/suffix-length: Likewise.
* tests/tail-2/big-4gb: Likewise.
* tests/tail-2/follow-name: Likewise.
* tests/tail-2/follow-stdin: Likewise.
* tests/tail-2/pipe-f: Likewise.
* tests/tail-2/pipe-f2: Likewise.
* tests/tail-2/start-middle: Likewise.
* tests/touch/60-seconds: Likewise.
* tests/touch/fail-diag: Likewise.
* tests/touch/not-owner: Likewise.
* tests/touch/relative: Likewise.
2011-11-22 10:35:03 +01:00
Stefano Lattarini
554caaf6ff tests: complete the renaming framework_failure -> framework_failure_
These changes were mostly mechanical, made by running the
following command:

  git grep -lw framework_failure | grep -v ChangeLog \
    | xargs perl -pi -e 's/\b(framework_failure)\b/${1}_/'

and then editing init.cfg and `tests/cp/cp-a-selinux' by hand.

* tests/init.cfg (framework_failure): Remove, `framework_failure_'
from init.sh should be used instead in the tests.
Remove now-obsolete "FIXME" comment.
(is_local_dir_, require_strace_, require_membership_in_two_groups_,
require_sparse_support_, skip_if_mcstransd_is_running_,
mkfifo_or_skip_) Use `framework_failure_', not `framework_failure'.
* Many test scripts: Likewise.
2011-08-08 10:11:48 +02:00
Jim Meyering
2e580ca741 tests: remove skip_test_ function; use new skip_ instead
* tests/init.cfg (skip_test_): Remove function.
Use skip_ in place of skip_test_ everywhere else.
* cfg.mk (sc_prohibit_skip_): Remove rule.
* tests/**: Use skip_, not skip_test_, everywhere.
2011-06-17 09:17:37 +02:00
Bernhard Voelker
e89c998a9e chmod: output the original mode in verbose mode
* src/chmod.c (describe_change): Pass in the original mode,
and output this in the messages.
* tests/chmod/c-option: Adjust as per the new message.
* THANKS.in: Remove the now auto-generated name.
* NEWS: Mention the change in behavior.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
2011-05-25 23:04:12 +01:00
Jim Meyering
9d6231ef2a maint: update all copyright year number ranges
Run "make update-copyright".
2011-01-01 22:16:47 +01:00
Jim Meyering
8f9be76b0d tests: convert the multi-prog $VERBOSE/--version uses
E.g.,

-test "$VERBOSE" = yes && { env -- pwd --version; readlink --version; }
+print_ver_ pwd readlink

-test "$VERBOSE" = yes && { stdbuf --version; mv --version; }
+print_ver_ stdbuf mv

Use this command:
git grep -l 'VERBOSE.*--version'|xargs perl -ni \
  -e '/^test "\$VERBOSE" = yes && { .*--version/ or print,next;' \
  -e 's/env -- //g;' \
  -e 's/test "\$VERBOSE" = yes && { /print_ver_ /;' \
  -e ' s/(\w+) --version;/$1/g; s/ *}$//; print'
2010-11-17 21:46:25 +01:00
Jim Meyering
293c37b906 tests: substitute the single-program $VERBOSE/--version uses
Automatically make all of the changes like this:

  -test "$VERBOSE" = yes && chgrp --version
  +print_ver_ chgrp

git grep -l 'VERBOSE.*--version'|xargs perl -pi -e \
  's/test "\$VERBOSE" = yes && (\w+) --version/print_ver_ $1/'
2010-11-17 21:45:51 +01:00
Jim Meyering
fbcc100f5b tests: convert remaining uses of test-lib.sh to init.sh
RHS='. "\${srcdir=.}/init.sh"; path_prepend_ ../src'
git grep -l test-lib.sh \
  | xargs perl -pi -e 's,^\. \$srcdir/test-lib\.sh$,'"$RHS",
2010-11-17 20:48:57 +01:00
Jim Meyering
ff7f0ff85c tests: convert 'if test "$VERBOSE" = yes; then' to test ... && 2010-11-17 20:48:57 +01:00
Jim Meyering
f38becab02 tests: convert first batch of tests from test-lib.sh to init.sh
Initially, I did this,
git grep -l srcdir/test-lib.sh|xargs perl -p0i -e '~180-byte script'
but that line would have been much longer than the maximum permitted
by coreutils' commit hook, and wasn't readable besides, so here's a
more readable version:

lhs=$(printf '%s\\n' \
'if test "$VERBOSE" = yes; then' \
'  set -x' \
'  touch --version' \
'fi' \
'' \
'. $srcdir/test-lib.sh' \
  | sed 's/\$/\\\$/g;s/touch/(\\w+)/')

rhs=$(printf '%s\\n' \
'. "${srcdir=.}/init.sh"; path_prepend_ ../src' \
'test "$VERBOSE" = yes && FIXME --version' \
  | sed 's/\$/\\\$/g;s/FIXME/\$1/')

git grep -l srcdir/test-lib.sh|xargs perl -p0i -e "s,$lhs,$rhs,"
2010-11-17 20:48:57 +01:00
Jim Meyering
1aa17dc89b maint: update all FSF copyright year lists to include 2010
Use this command:
git ls-files | grep -v COPYING \
  | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \
      build-aux/update-copyright
2010-01-01 14:06:47 +01:00
Jim Meyering
3c88587b2e tests: factor 350 fail=0 initializations into test-lib.sh
Run this command to remove the factored-out "fail=0" lines.
perl -ni -e '/^fail=0$/ or print' $(g grep -l '^fail=0$')
* tests/test-lib.sh: Initialize fail=0 here, not in 300+ scripts.
* tests/...: nearly all bourne shell scripts
Suggested by Eric Blake.
2009-10-30 12:50:12 +01:00
Jim Meyering
5e778f7c8d global: convert indentation-TABs to spaces
Transformed via this shell code:
t=$'\t'
git ls-files \
  | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \
  | grep -vE 'tests/pr/|help2man' \
  | xargs grep -lE "^ *$t" \
  | xargs perl -MText::Tabs -ni -le \
    '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-08-25 09:21:00 +02:00
Jim Meyering
2232b4d08f maint: update all Copyright year lists to include 2009 2009-06-23 22:33:15 +02:00
Jim Meyering
e65d0d0525 tests: migrate setgid-check into test-lib.sh
* tests/test-lib.sh (skip_if_setgid_): New function.
* tests/setgid-check: Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove setgid-check.
* tests/chmod/c-option: Use the new function rather than sourcing
the separate file.
* tests/cp/cp-parents: Likewise.
* tests/install/install-C: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
2009-03-27 09:28:08 +01:00
Jim Meyering
9b8023e69c tests: ensure that chmod, chgrp and chown honor --silent
* tests/chmod/silent: New file, to test all three programs.
* tests/Makefile.am (TESTS): Add chmod/silent.
* NEWS (Bug fixes): Mention this.
The bug was introduced in 96a5d2ce6a.
2008-12-03 11:02:57 +01:00
Jim Meyering
68561594ca tests: use "Exit $fail", not (exit $fail); exit $fail
* tests/test-lib.sh (Exit): New function by Ralf Wildenhues in automake
http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=20594c08f63
* tests/**: Convert all uses:

This restrictive change converted the vast majority:

  git grep -l '^(exit \$fail); exit \$fail$' \
    | xargs perl -pi -e 's/'^\(exit \$fail\); exit \$fail$/Exit \$fail/'

And this did the rest, plus a few undesirable ones, so I manually
backed out the changes to ChangeLog-* and build-aux/check.mk:

  git grep -l -E '\(exit [^)]+\); exit ' \
    | xargs perl -pi -e 's/\(exit (.+?)\); exit \1/Exit $1/'
2008-09-10 13:20:10 +02:00
Jim Meyering
00a3098235 in 280+ tests/* files, use $srcdir, not $top_srcdir/tests 2008-05-27 13:48:32 +02:00
Jim Meyering
c6c9e8730e prefer abs_srcdir over abs_top_srcdir, ...
so that e.g., tests/* may refer to absolute names without
hard-coding the name of the containing directory (tests/, here).
* tests/check.mk (TESTS_ENVIRONMENT): Define abs_srcdir.
* tests/pr/pr-tests: Use $abs_srcdir/pr not $abs_top_srcdir/tests/pr.
* tests/chmod/c-option: Use $abs_srcdir, not $abs_top_srcdir/tests.
* tests/cp/cp-parents: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/into-self-2: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/rm/one-file-system: Likewise.
* tests/sample-test: Likewise.
2008-05-27 13:30:44 +02:00