diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-12-28 12:28:48 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-12-28 12:30:42 -0800 |
commit | b0097f3d2180352896a4434fb8eaeb076f12794c (patch) | |
tree | eb605f5d69d8c346278db1ccbec82d1a594403e1 | |
parent | 01211e9af728a5123b9cced19b7dfdc02b019f5b (diff) | |
download | coreutils-b0097f3d2180352896a4434fb8eaeb076f12794c.tar.xz |
coreutils: keep lines within 80-column limits
* cfg.mk (LINE_LEN_MAX, FILTER_LONG_LINES): New macros.
(sc_long_lines): New rule.
* HACKING: Use shorter URLs to the same material.
* doc/Makefile.am, doc/coreutils.texi, m4/boottime.m4:
* man/help2man, man/stdbuf.x, src/Makefile.am, src/cat.c, src/copy.c:
* src/cp.c, src/dd.c, src/df.c, src/du.c, src/groups.c, src/install.c:
* src/ls.c, src/md5sum.c, src/mv.c, src/od.c, src/pinky.c, src/ptx.c:
* src/readlink.c, src/remove.c, src/rmdir.c, src/setuidgid.c:
* src/sort.c, src/tail.c, src/touch.c, tests/Coreutils.pm:
* tests/cp/existing-perm-race, tests/cp/perm, tests/cp/preserve-gid:
* tests/du/2g, tests/du/long-from-unreadable, tests/init.sh:
* tests/install/basic-1, tests/ls/nameless-uid:
* tests/ls/readdir-mountpoint-inode, tests/misc/chroot-credentials:
* tests/misc/cut, tests/misc/date, tests/misc/join, tests/misc/md5sum:
* tests/misc/sha1sum, tests/misc/sha224sum, tests/misc/sort:
* tests/misc/sort-continue, tests/misc/sort-files0-from:
* tests/misc/sort-rand, tests/misc/stdbuf, tests/misc/tr:
* tests/misc/uniq, tests/mv/atomic, tests/mv/part-fail:
* tests/mv/part-symlink, tests/mv/sticky-to-xpart, tests/pr/pr-tests:
* tests/rm/fail-2eperm, tests/rm/interactive-always:
Reformat to fit within 80 columns.
* doc/Makefile.am (BAD_POSIX_PERL): New macro.
* doc/coreutils.texi: Reword slightly, to make menus and
index lines shorter.
* src/md5sum.c: Redo --help output so that it fits within 79
columns, since that's a bit more portable and all the other --help
strings fit in 79 columns.
60 files changed, 472 insertions, 232 deletions
@@ -439,12 +439,12 @@ The forms to choose from are in gnulib's doc/Copyright/ directory. If you want to assign a single change, you should use the file, doc/Copyright/request-assign.changes: - http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.changes;hb=HEAD + http://www.gnu.org/software/gnulib/Copyright/request-assign.changes If you would like to assign past and future contributions to a project, you'd use doc/Copyright/request-assign.future: - http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/request-assign.future;hb=HEAD + http://www.gnu.org/software/gnulib/Copyright/request-assign.future You may make assignments for up to four projects at a time. @@ -149,6 +149,23 @@ ALL_RECURSIVE_TARGETS += sc_check-AUTHORS sc_check-AUTHORS: @$(MAKE) -s -C src $@ +# Look for lines longer than 80 characters, except omit: +# - program-generated long lines in diff headers, +# - tests involving long checksum lines, and +# - the 'pr' test cases. +LINE_LEN_MAX = 80 +FILTER_LONG_LINES = \ + /^[^:]*\.diff:[^:]*:@@ / d; \ + \|^[^:]*tests/misc/sha[0-9]*sum[-:]| d; \ + \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; }; +sc_long_lines: + @files=$$($(VC_LIST_EXCEPT)) \ + halt='line(s) with more than $(LINE_LEN_MAX) characters; reindent'; \ + for file in $$files; do \ + expand $$file | grep -nE '^.{$(LINE_LEN_MAX)}.' | \ + sed -e "s|^|$$file:|" -e '$(FILTER_LONG_LINES)'; \ + done | grep . && { msg="$$halt" $(_sc_say_and_exit) } || : + # Option descriptions should not start with a capital letter # One could grep source directly as follows: # grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$') @@ -222,7 +239,8 @@ sc_prohibit_emacs__indent_tabs_mode__setting: $(_sc_search_regexp) # Ensure that each file that contains fail=1 also contains fail=0. -# Otherwise, setting file=1 in the environment would make tests fail unexpectedly. +# Otherwise, setting file=1 in the environment would make tests fail +# unexpectedly. sc_prohibit_fail_0: @prohibit='\<fail=0\>' \ halt='fail=0 initialization' \ diff --git a/doc/Makefile.am b/doc/Makefile.am index d627b630e..5240f0358 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -33,7 +33,8 @@ constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c $(AM_V_GEN)LC_ALL=C; export LC_ALL; \ { sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \ $(top_srcdir)/src/tail.c && \ - sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\ + sed -n -e \ + 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\ $(top_srcdir)/src/shred.c; } > t-$@ \ && mv t-$@ $@ @@ -60,6 +61,7 @@ syntax_checks = \ .PHONY: $(syntax_checks) check-texinfo # List words/regexps here that should not appear in the texinfo documentation. +BAD_POSIX_PERL = /\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ check-texinfo: $(syntax_checks) $(AM_V_GEN)fail=0; \ grep '@url{' $(srcdir)/*.texi && fail=1; \ @@ -69,7 +71,7 @@ check-texinfo: $(syntax_checks) | $(EGREP) -v 'setfilename|[{]filename[}]' \ && fail=1; \ $(PERL) -e 1 2> /dev/null && { $(PERL) -ne \ - '/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \ + '$(BAD_POSIX_PERL) and print,exit 1' \ $(srcdir)/*.texi 2> /dev/null || fail=1; }; \ exit $$fail @@ -108,7 +110,8 @@ sc-avoid-non-zero: # Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent). sc-avoid-zeroes: - $(AM_V_GEN)$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi && exit 1 || : + $(AM_V_GEN)$(EGREP) -i '$(_W)zeroes$(W_)' $(srcdir)/*.texi \ + && exit 1 || : # ME = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) ME = doc/Makefile diff --git a/doc/coreutils.texi b/doc/coreutils.texi index a74f64599..5411bd1a6 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -736,7 +736,7 @@ name. * Trailing slashes:: --strip-trailing-slashes, in some programs. * Traversing symlinks:: -H, -L, or -P, in some programs. * Treating / specially:: --preserve-root and --no-preserve-root. -* Special built-in utilities:: @command{break}, @command{:}, @command{eval}, @dots{} +* Special built-in utilities:: @command{break}, @command{:}, @dots{} * Standards conformance:: Conformance to the @acronym{POSIX} standard. @end menu @@ -1316,7 +1316,7 @@ a symlink or its referent. @macro choptH @item -H @opindex -H -@cindex symbolic link to directory, traverse each that is specified on the command line +@cindex symbolic link to directory, traverse if on the command line If @option{--recursive} (@option{-R}) is specified and a command line argument is a symbolic link to a directory, traverse it. @end macro @@ -1778,7 +1778,8 @@ Synopses: @smallexample od [@var{option}]@dots{} [@var{file}]@dots{} od [-abcdfilosx]@dots{} [@var{file}] [[+]@var{offset}[.][b]] -od [@var{option}]@dots{} --traditional [@var{file}] [[+]@var{offset}[.][b] [[+]@var{label}[.][b]]] +od [@var{option}]@dots{} --traditional [@var{file}]@c + [[+]@var{offset}[.][b] [[+]@var{label}[.][b]]] @end smallexample Each line of output consists of the offset in the input, followed by @@ -3408,10 +3409,11 @@ length limitation. In such cases, running @command{\cmd\} via @command{xargs} is undesirable because it splits the list into pieces and makes @command{\cmd\} print \subListOutput\ for each sublist rather than for the entire list. -One way to produce a list of @acronym{ASCII} @sc{nul} terminated file names is with @sc{gnu} +One way to produce a list of @acronym{ASCII} @sc{nul} terminated file +names is with @sc{gnu} @command{find}, using its @option{-print0} predicate. -If @var{file} is @samp{-} then the @acronym{ASCII} @sc{nul} terminated file names -are read from standard input. +If @var{file} is @samp{-} then the @acronym{ASCII} @sc{nul} terminated +file names are read from standard input. @end macro @filesZeroFromOption{wc,,a total} @@ -4234,7 +4236,8 @@ or other special characters). Historical (BSD and System V) implementations of @command{sort} have differed in their interpretation of some options, particularly -@option{-b}, @option{-f}, and @option{-n}. @sc{gnu} sort follows the @acronym{POSIX} +@option{-b}, @option{-f}, and @option{-n}. +@sc{gnu} sort follows the @acronym{POSIX} behavior, which is usually (but not always!) like the System V behavior. According to @acronym{POSIX}, @option{-n} no longer implies @option{-b}. For consistency, @option{-M} has been changed in the same way. This may @@ -4404,7 +4407,10 @@ by the sort operation. @c and converting each @samp{\0} back to the original record delimiter. @c @c @example -@c printf 'c\n\nb\n\na\n'|perl -0pe 's/\n\n/\n\0/g'|sort -z|perl -0pe 's/\0/\n/g' +@c printf 'c\n\nb\n\na\n' | +@c perl -0pe 's/\n\n/\n\0/g' | +@c sort -z | +@c perl -0pe 's/\0/\n/g' @c @end example @item @@ -5118,7 +5124,8 @@ Choose an output format suitable for @command{nroff} or @command{troff} processing. Each output line will look like: @smallexample -.xx "@var{tail}" "@var{before}" "@var{keyword_and_after}" "@var{head}" "@var{ref}" +.xx "@var{tail}" "@var{before}" "@var{keyword_and_after}"@c + "@var{head}" "@var{ref}" @end smallexample so it will be possible to write a @samp{.xx} roff macro to take care of @@ -5138,7 +5145,8 @@ Choose an output format suitable for @TeX{} processing. Each output line will look like: @smallexample -\xx @{@var{tail}@}@{@var{before}@}@{@var{keyword}@}@{@var{after}@}@{@var{head}@}@{@var{ref}@} +\xx @{@var{tail}@}@{@var{before}@}@{@var{keyword}@}@c +@{@var{after}@}@{@var{head}@}@{@var{ref}@} @end smallexample @noindent @@ -6017,7 +6025,8 @@ newlines. @noindent By the way, the above idiom is not portable because it uses ranges, and it assumes that the octal code for newline is 012. -Assuming a @acronym{POSIX} compliant @command{tr}, here is a better way to write it: +Assuming a @acronym{POSIX} compliant @command{tr}, here is a better +way to write it: @example tr -cs '[:alnum:]' '[\n*]' @@ -8454,7 +8463,8 @@ response is not affirmative, the file is skipped. when it might be a symlink to a directory. Otherwise, @command{mv} may do something very surprising, since its behavior depends on the underlying rename system call. -On a system with a modern Linux-based kernel, it fails with @code{errno=ENOTDIR}. +On a system with a modern Linux-based kernel, it fails with +@code{errno=ENOTDIR}. However, on other systems (at least FreeBSD 6.1 and Solaris 10) it silently renames not the symlink but rather the directory referenced by the symlink. @xref{Trailing slashes}. @@ -8845,7 +8855,8 @@ Display to standard error all status updates as sterilization proceeds. @opindex -x @opindex --exact By default, @command{shred} rounds the size of a regular file up to the next -multiple of the file system block size to fully erase the last block of the file. +multiple of the file system block size to fully erase the last block +of the file. Use @option{--exact} to suppress that behavior. Thus, by default if you shred a 10-byte regular file on a system with 512-byte blocks, the resulting file will be 512 bytes long. With this option, @@ -9628,7 +9639,8 @@ to @var{new-owner} or to the user and group of an existing reference file. Synopsis: @example -chown [@var{option}]@dots{} @{@var{new-owner} | --reference=@var{ref_file}@} @var{file}@dots{} +chown [@var{option}]@dots{} @{@var{new-owner} | --reference=@var{ref_file}@}@c + @var{file}@dots{} @end example If used, @var{new-owner} specifies the new owner and/or group as follows @@ -9843,7 +9855,8 @@ to @var{group} (which can be either a group name or a numeric group ID) or to the group of an existing reference file. Synopsis: @example -chgrp [@var{option}]@dots{} @{@var{group} | --reference=@var{ref_file}@} @var{file}@dots{} +chgrp [@var{option}]@dots{} @{@var{group} | --reference=@var{ref_file}@}@c + @var{file}@dots{} @end example If @var{group} is intended to represent a @@ -9964,7 +9977,8 @@ chgrp -hR staff /u @command{chmod} changes the access permissions of the named files. Synopsis: @example -chmod [@var{option}]@dots{} @{@var{mode} | --reference=@var{ref_file}@} @var{file}@dots{} +chmod [@var{option}]@dots{} @{@var{mode} | --reference=@var{ref_file}@}@c + @var{file}@dots{} @end example @cindex symbolic links, permissions of @@ -10264,7 +10278,8 @@ Non-integer quantities are rounded up to the next higher unit. If an argument @var{file} is a disk device file containing a mounted file system, @command{df} shows the space available on that file system rather than on the file system containing the device node (i.e., the root -file system). @sc{gnu} @command{df} does not attempt to determine the disk usage +file system). @sc{gnu} @command{df} does not attempt to determine the +disk usage on unmounted file systems, because on most kinds of systems doing so requires extremely nonportable intimate knowledge of file system structures. @@ -11390,7 +11405,8 @@ test If @var{expression} is omitted, @command{test} returns false. If @var{expression} is a single argument, -@command{test} returns false if the argument is null and true otherwise. The argument +@command{test} returns false if the argument is null and true +otherwise. The argument can be any string, including strings like @samp{-d}, @samp{-1}, @samp{--}, @samp{--help}, and @samp{--version} that most other programs would treat as options. To get help and version information, @@ -12586,8 +12602,9 @@ be used in combination with any line settings. @opindex --file Set the line opened by the file name specified in @var{device} instead of the tty line connected to standard input. This option is necessary -because opening a @acronym{POSIX} tty requires use of the @code{O_NONDELAY} flag to -prevent a @acronym{POSIX} tty from blocking until the carrier detect line is high if +because opening a @acronym{POSIX} tty requires use of the +@code{O_NONDELAY} flag to prevent a @acronym{POSIX} tty from blocking +until the carrier detect line is high if the @code{clocal} flag is not set. Hence, it is not always possible to allow the shell to open the device in the traditional manner. @@ -12609,8 +12626,9 @@ case, that is, when @emph{not} negated (unless stated otherwise, of course). Some settings are not available on all @acronym{POSIX} systems, since they use -extensions. Such arguments are marked below with ``Non-@acronym{POSIX}'' in their -description. On non-@acronym{POSIX} systems, those or other settings also may not +extensions. Such arguments are marked below with +``Non-@acronym{POSIX}'' in their description. On non-@acronym{POSIX} +systems, those or other settings also may not be available, but it's not feasible to document all the variations: just try it and see. @@ -12817,7 +12835,8 @@ Newline performs a carriage return. Non-@acronym{POSIX}. May be negated. @item ofill @opindex ofill @cindex pad instead of timing for delaying -Use fill (padding) characters instead of timing for delays. Non-@acronym{POSIX}. +Use fill (padding) characters instead of timing for delays. +Non-@acronym{POSIX}. May be negated. @item ofdel @@ -12945,7 +12964,8 @@ of literally. Non-@acronym{POSIX}. May be negated. @opindex crtkill Echo the @code{kill} special character by erasing each character on the line as indicated by the @code{echoprt} and @code{echoe} settings, -instead of by the @code{echoctl} and @code{echok} settings. Non-@acronym{POSIX}. +instead of by the @code{echoctl} and @code{echok} settings. +Non-@acronym{POSIX}. May be negated. @end table @@ -13169,7 +13189,8 @@ Set the output speed to @var{n}. @item rows @var{n} @opindex rows -Tell the tty kernel driver that the terminal has @var{n} rows. Non-@acronym{POSIX}. +Tell the tty kernel driver that the terminal has @var{n} rows. +Non-@acronym{POSIX}. @item cols @var{n} @itemx columns @var{n} @@ -14386,7 +14407,8 @@ parsed reliably. In the following example, @var{release} is @smallexample uname -a -@result{} Linux dum 2.2.18 #4 SMP Tue Jun 5 11:24:08 PDT 2001 i686 unknown unknown GNU/Linux +@result{} Linux dum 2.2.18 #4 SMP Tue Jun 5 11:24:08 PDT 2001 i686@c + unknown unknown GNU/Linux @end smallexample @@ -14592,7 +14614,8 @@ Synopses: @smallexample chcon [@var{option}]@dots{} @var{context} @var{file}@dots{} -chcon [@var{option}]@dots{} [-u @var{user}] [-r @var{role}] [-l @var{range}] [-t @var{type}] @var{file}@dots{} +chcon [@var{option}]@dots{} [-u @var{user}] [-r @var{role}] [-l @var{range}]@c + [-t @var{type}] @var{file}@dots{} chcon [@var{option}]@dots{} --reference=@var{rfile} @var{file}@dots{} @end smallexample @@ -14678,7 +14701,8 @@ Set range @var{range} in the target security context. Synopses: @smallexample runcon @var{context} @var{command} [@var{args}] -runcon [ -c ] [-u @var{user}] [-r @var{role}] [-t @var{type}] [-l @var{range}] @var{command} [@var{args}] +runcon [ -c ] [-u @var{user}] [-r @var{role}] [-t @var{type}]@c + [-l @var{range}] @var{command} [@var{args}] @end smallexample Run @var{command} with completely-specified @var{context}, or with @@ -14690,7 +14714,8 @@ is specified, the first argument is used as the complete context. Any additional arguments after @var{command} are interpreted as arguments to the command. -With neither @var{context} nor @var{command}, print the current security context. +With neither @var{context} nor @var{command}, print the current +security context. The program accepts the following options. Also see @ref{Common options}. @@ -15853,7 +15878,8 @@ It was written by Arnold Robbins. @unnumberedsec Toolbox Introduction This month's column is only peripherally related to the GNU Project, in -that it describes a number of the GNU tools on your GNU/Linux system and how they +that it describes a number of the GNU tools on your GNU/Linux system +and how they might be used. What it's really about is the ``Software Tools'' philosophy of program development and usage. @@ -16053,7 +16079,8 @@ by a count of the number of times that line occurred in the input. @unnumberedsec Putting the Tools Together Now, let's suppose this is a large ISP server system with dozens of users -logged in. The management wants the system administrator to write a program that will +logged in. The management wants the system administrator to write a +program that will generate a sorted list of logged in users. Furthermore, even if a user is logged in multiple times, his or her name should only show up in the output once. @@ -16095,7 +16122,8 @@ The @command{sort} command actually has a @option{-u} option that does what @command{uniq} does. However, @command{uniq} has other uses for which one cannot substitute @samp{sort -u}. -The administrator puts this pipeline into a shell script, and makes it available for +The administrator puts this pipeline into a shell script, and makes it +available for all the users on the system (@samp{#} is the system administrator, or @code{root}, prompt): diff --git a/m4/boottime.m4 b/m4/boottime.m4 index 3bca40f97..4e7317158 100644 --- a/m4/boottime.m4 +++ b/m4/boottime.m4 @@ -52,7 +52,9 @@ AC_DEFUN([GNULIB_BOOT_TIME], #endif ], [[ -#if defined BOOT_TIME || (defined CTL_KERN && defined KERN_BOOTTIME) || HAVE_OS_H +#if (defined BOOT_TIME \ + || (defined CTL_KERN && defined KERN_BOOTTIME) \ + || HAVE_OS_H) /* your system *does* have the infrastructure to determine boot time */ #else please_tell_us_how_to_determine_boot_time_on_your_system diff --git a/man/help2man b/man/help2man index 8e42f3cd1..75cc4932a 100755 --- a/man/help2man +++ b/man/help2man @@ -316,7 +316,10 @@ unless ($manual) # Extract usage clause(s) [if any] for SYNOPSIS. my $PAT_USAGE = _('Usage'); my $PAT_USAGE_CONT = _('or'); -if ($help_text =~ s/^($PAT_USAGE):( +(\S+))(.*)((?:\n(?: {6}\1| *($PAT_USAGE_CONT): +\S).*)*)//om) +if ($help_text =~ s/^($PAT_USAGE): + ([ ]+(\S+)) + (.*) + ((?:\n(?:[ ]{6}\1|[ ]*($PAT_USAGE_CONT):[ ]+\S).*)*)//omx) { my @syn = $3 . $4; diff --git a/man/stdbuf.x b/man/stdbuf.x index 1ef2d9e43..94425f5b6 100644 --- a/man/stdbuf.x +++ b/man/stdbuf.x @@ -4,7 +4,8 @@ '\" of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. '\" There is NO WARRANTY, to the extent permitted by law. [NAME] -stdbuf \- Run COMMAND, with modified buffering operations for its standard streams. +stdbuf \- +Run COMMAND, with modified buffering operations for its standard streams. [DESCRIPTION] .\" Add any additional description here [EXAMPLES] diff --git a/src/Makefile.am b/src/Makefile.am index 00c7ff713..fd08303b9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -726,7 +726,7 @@ sc_tight_scope: $(bin_PROGRAMS) ( printf 'main\nusage\n_.*\n'; \ grep -h -A1 '^extern .*[^;]$$' $$src \ | grep -vE '^(extern |--)' | sed 's/ .*//'; \ - perl -ne '/^extern (?:enum )?\S+ (\S*) \(/ and print "$$1\n"' $$hdr; \ + perl -ne '/^extern (?:enum )?\S+ (\S*) \(/ and print "$$1\n"' $$hdr; \ ) | $(ASSORT) -u | sed 's/^/^/;s/$$/$$/' > $$t; \ nm -e *.$(OBJEXT) \ | sed -n 's/.* T //p' \ @@ -323,7 +323,8 @@ cat ( use_fionread = false; else { - error (0, errno, _("cannot do ioctl on %s"), quote (infile)); + error (0, errno, _("cannot do ioctl on %s"), + quote (infile)); newlines2 = newlines; return false; } diff --git a/src/copy.c b/src/copy.c index 42d6d9249..a6621c22e 100644 --- a/src/copy.c +++ b/src/copy.c @@ -354,7 +354,8 @@ set_owner (const struct cp_options *x, char const *dst_name, int dest_desc, && qset_acl (dst_name, dest_desc, restrictive_temp_mode) != 0) { if (! owner_failure_ok (x)) - error (0, errno, _("clearing permissions for %s"), quote (dst_name)); + error (0, errno, _("clearing permissions for %s"), + quote (dst_name)); return -x->require_preserve; } } @@ -170,16 +170,19 @@ Mandatory arguments to long options are mandatory for short options too.\n\ fputs (_("\ -a, --archive same as -dR --preserve=all\n\ --attributes-only don't copy the file data, just the attributes\n\ - --backup[=CONTROL] make a backup of each existing destination file\n\ + --backup[=CONTROL] make a backup of each existing destination file\ +\n\ -b like --backup but does not accept an argument\n\ --copy-contents copy contents of special files when recursive\n\ -d same as --no-dereference --preserve=links\n\ "), stdout); fputs (_("\ -f, --force if an existing destination file cannot be\n\ - opened, remove it and try again (redundant if\n\ + opened, remove it and try again (redundant if\ +\n\ the -n option is used)\n\ - -i, --interactive prompt before overwrite (overrides a previous -n\n\ + -i, --interactive prompt before overwrite (overrides a previous -n\ +\n\ option)\n\ -H follow command-line symbolic links in SOURCE\n\ "), stdout); @@ -196,7 +199,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -p same as --preserve=mode,ownership,timestamps\n\ --preserve[=ATTR_LIST] preserve the specified attributes (default:\n\ mode,ownership,timestamps), if possible\n\ - additional attributes: context, links, xattr,\n\ + additional attributes: context, links, xattr,\ +\n\ all\n\ "), stdout); fputs (_("\ @@ -207,8 +211,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -R, -r, --recursive copy directories recursively\n\ --reflink[=WHEN] control clone/CoW copies. See below\n\ --remove-destination remove each existing destination file before\n\ - attempting to open it (contrast with --force)\n\ -"), stdout); + attempting to open it (contrast with --force)\ +\n"), stdout); fputs (_("\ --sparse=WHEN control creation of sparse files. See below\n\ --strip-trailing-slashes remove any trailing slashes from each SOURCE\n\ @@ -948,7 +952,8 @@ main (int argc, char **argv) reflink_type_string, reflink_type); break; - case 'a': /* Like -dR --preserve=all with reduced failure diagnostics. */ + case 'a': + /* Like -dR --preserve=all with reduced failure diagnostics. */ x.dereference = DEREF_NEVER; x.preserve_links = true; x.preserve_ownership = true; @@ -1939,7 +1939,8 @@ main (int argc, char **argv) || S_ISDIR (stdout_stat.st_mode) || S_TYPEISSHM (&stdout_stat)) error (EXIT_FAILURE, ftruncate_errno, - _("failed to truncate to %"PRIuMAX" bytes in output file %s"), + _("failed to truncate to %"PRIuMAX" bytes" + " in output file %s"), size, quote (output_file)); } } @@ -715,14 +715,16 @@ Mandatory arguments to long options are mandatory for short options too.\n\ `-BM' prints sizes in units of 1,048,576 bytes.\n\ See SIZE format below.\n\ --total produce a grand total\n\ - -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\ + -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\ +\n\ -H, --si likewise, but use powers of 1000 not 1024\n\ "), stdout); fputs (_("\ -i, --inodes list inode information instead of block usage\n\ -k like --block-size=1K\n\ -l, --local limit listing to local file systems\n\ - --no-sync do not invoke sync before getting usage info (default)\n\ + --no-sync do not invoke sync before getting usage info (default)\ +\n\ "), stdout); fputs (_("\ -P, --portability use the POSIX output format\n\ @@ -267,7 +267,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); fputs (_("\ -a, --all write counts for all files, not just directories\n\ - --apparent-size print apparent sizes, rather than disk usage; although\n\ + --apparent-size print apparent sizes, rather than disk usage; although\ +\n\ the apparent size is usually smaller, it may be\n\ larger due to holes in (`sparse') files, internal\n\ fragmentation, indirect blocks, and the like\n\ @@ -286,7 +287,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ names specified in file F;\n\ If F is - then read names from standard input\n\ -H equivalent to --dereference-args (-D)\n\ - -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\ + -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\ +\n\ --si like -h, but use powers of 1000 not 1024\n\ "), stdout); fputs (_("\ diff --git a/src/groups.c b/src/groups.c index c05da37d2..0f4c4ce2d 100644 --- a/src/groups.c +++ b/src/groups.c @@ -53,7 +53,8 @@ usage (int status) { printf (_("Usage: %s [OPTION]... [USERNAME]...\n"), program_name); fputs (_("\ -Print group memberships for each USERNAME or, if no USERNAME is specified, for\n\ +Print group memberships for each USERNAME or, if no USERNAME is specified, for\ +\n\ the current process (which may differ if the groups database has changed).\n"), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); diff --git a/src/install.c b/src/install.c index 467e50046..5cfc0e2e8 100644 --- a/src/install.c +++ b/src/install.c @@ -986,7 +986,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); fputs (_("\ --preserve-context preserve SELinux security context\n\ - -Z, --context=CONTEXT set SELinux security context of files and directories\n\ + -Z, --context=CONTEXT set SELinux security context of files and directories\ +\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -2048,7 +2048,8 @@ decode_switches (int argc, char **argv) } } /* Note we leave %5b etc. alone so user widths/flags are honored. */ - if (strstr (long_time_format[0],"%b") || strstr (long_time_format[1],"%b")) + if (strstr (long_time_format[0], "%b") + || strstr (long_time_format[1], "%b")) if (!abmon_init ()) error (0, 0, _("error initializing month strings")); } @@ -4628,15 +4629,18 @@ Mandatory arguments to long options are mandatory for short options too.\n\ --dereference-command-line-symlink-to-dir\n\ follow each command line symbolic link\n\ that points to a directory\n\ - --hide=PATTERN do not list implied entries matching shell PATTERN\n\ + --hide=PATTERN do not list implied entries matching shell PATTERN\ +\n\ (overridden by -a or -A)\n\ "), stdout); fputs (_("\ - --indicator-style=WORD append indicator with style WORD to entry names:\n\ + --indicator-style=WORD append indicator with style WORD to entry names:\ +\n\ none (default), slash (-p),\n\ file-type (--file-type), classify (-F)\n\ -i, --inode print the index number of each file\n\ - -I, --ignore=PATTERN do not list implied entries matching shell PATTERN\n\ + -I, --ignore=PATTERN do not list implied entries matching shell PATTERN\ +\n\ -k like --block-size=1K\n\ "), stdout); fputs (_("\ @@ -4644,7 +4648,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -L, --dereference when showing file information for a symbolic\n\ link, show information for the file the link\n\ references rather than for the link itself\n\ - -m fill width with a comma separated list of entries\n\ + -m fill width with a comma separated list of entries\ +\n\ "), stdout); fputs (_("\ -n, --numeric-uid-gid like -l, but list numeric user and group IDs\n\ @@ -4660,7 +4665,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ unless program is `ls' and output is a terminal)\n\ -Q, --quote-name enclose entry names in double quotes\n\ --quoting-style=WORD use quoting style WORD for entry names:\n\ - literal, locale, shell, shell-always, c, escape\n\ + literal, locale, shell, shell-always, c, escape\ +\n\ "), stdout); fputs (_("\ -r, --reverse reverse order while sorting\n\ @@ -4671,7 +4677,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -S sort by file size\n\ --sort=WORD sort by WORD instead of name: none -U,\n\ extension -X, size -S, time -t, version -v\n\ - --time=WORD with -l, show time as WORD instead of modification\n\ + --time=WORD with -l, show time as WORD instead of modification\ +\n\ time: atime -u, access -u, use -u, ctime -c,\n\ or status -c; use specified time as sort key\n\ if --sort=time\n\ diff --git a/src/md5sum.c b/src/md5sum.c index a660e3b2c..50bb0a1b4 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -1,4 +1,4 @@ -/* Compute MD5, SHA1, SHA224, SHA256, SHA384 or SHA512 checksum of files or strings +/* Compute checksums of files or strings. Copyright (C) 1995-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -162,29 +162,29 @@ With no FILE, or when FILE is -, read standard input.\n\ DIGEST_BITS); if (O_BINARY) fputs (_("\ - -b, --binary read in binary mode (default unless reading tty stdin)\n\ + -b, --binary read in binary mode (default unless reading tty stdin)\n\ "), stdout); else fputs (_("\ - -b, --binary read in binary mode\n\ + -b, --binary read in binary mode\n\ "), stdout); printf (_("\ - -c, --check read %s sums from the FILEs and check them\n"), + -c, --check read %s sums from the FILEs and check them\n"), DIGEST_TYPE_STRING); if (O_BINARY) fputs (_("\ - -t, --text read in text mode (default if reading tty stdin)\n\ + -t, --text read in text mode (default if reading tty stdin)\n\ "), stdout); else fputs (_("\ - -t, --text read in text mode (default)\n\ + -t, --text read in text mode (default)\n\ "), stdout); fputs (_("\ \n\ The following three options are useful only when verifying checksums:\n\ - --quiet don't print OK for each successfully verified file\n\ - --status don't output anything, status code shows success\n\ - -w, --warn warn about improperly formatted checksum lines\n\ + --quiet don't print OK for each successfully verified file\n\ + --status don't output anything, status code shows success\n\ + -w, --warn warn about improperly formatted checksum lines\n\ \n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); @@ -209,7 +209,8 @@ text), and name for each FILE.\n"), name. S is modified. Return true if successful. */ static bool -bsd_split_3 (char *s, size_t s_len, unsigned char **hex_digest, char **file_name) +bsd_split_3 (char *s, size_t s_len, unsigned char **hex_digest, + char **file_name) { size_t i; @@ -576,23 +577,26 @@ digest_check (const char *checkfile_name) { if (n_misformatted_lines != 0) error (0, 0, - ngettext ("WARNING: %" PRIuMAX " line is improperly formatted", - "WARNING: %" PRIuMAX " lines are improperly formatted", - select_plural (n_misformatted_lines)), + (ngettext + ("WARNING: %" PRIuMAX " line is improperly formatted", + "WARNING: %" PRIuMAX " lines are improperly formatted", + select_plural (n_misformatted_lines))), n_misformatted_lines); if (n_open_or_read_failures != 0) error (0, 0, - ngettext ("WARNING: %" PRIuMAX " listed file could not be read", - "WARNING: %" PRIuMAX " listed files could not be read", - select_plural (n_open_or_read_failures)), + (ngettext + ("WARNING: %" PRIuMAX " listed file could not be read", + "WARNING: %" PRIuMAX " listed files could not be read", + select_plural (n_open_or_read_failures))), n_open_or_read_failures); if (n_mismatched_checksums != 0) error (0, 0, - ngettext ("WARNING: %" PRIuMAX " computed checksum did NOT match", - "WARNING: %" PRIuMAX " computed checksums did NOT match", - select_plural (n_mismatched_checksums)), + (ngettext + ("WARNING: %" PRIuMAX " computed checksum did NOT match", + "WARNING: %" PRIuMAX " computed checksums did NOT match", + select_plural (n_mismatched_checksums))), n_mismatched_checksums); } } @@ -296,7 +296,8 @@ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\ Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); fputs (_("\ - --backup[=CONTROL] make a backup of each existing destination file\n\ + --backup[=CONTROL] make a backup of each existing destination file\ +\n\ -b like --backup but does not accept an argument\n\ -f, --force do not prompt before overwriting\n\ -i, --interactive prompt before overwrite\n\ @@ -374,7 +374,8 @@ RADIX is d for decimal, o for octal, x for hexadecimal or n for none.\n\ BYTES is hexadecimal with 0x or 0X prefix, and may have a multiplier suffix:\n\ b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,\n\ GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.\n\ -Adding a z suffix to any type displays printable characters at the end of each\n\ +Adding a z suffix to any type displays printable characters at the end of each\ +\n\ output line.\n\ "), stdout); fputs (_("\ @@ -1046,7 +1047,8 @@ skip (uintmax_t n_skip) } static void -format_address_none (uintmax_t address ATTRIBUTE_UNUSED, char c ATTRIBUTE_UNUSED) +format_address_none (uintmax_t address ATTRIBUTE_UNUSED, + char c ATTRIBUTE_UNUSED) { } diff --git a/src/pinky.c b/src/pinky.c index e9b4d1bca..b19c4d8d8 100644 --- a/src/pinky.c +++ b/src/pinky.c @@ -220,7 +220,7 @@ print_entry (const STRUCT_UTMP *utmp_ent) else { strcpy (line, DEV_DIR_WITH_TRAILING_SLASH); - strncpy (line + DEV_DIR_LEN, utmp_ent->ut_line, sizeof (utmp_ent->ut_line)); + strncpy (line + DEV_DIR_LEN, utmp_ent->ut_line, sizeof utmp_ent->ut_line); line[DEV_DIR_LEN + sizeof (utmp_ent->ut_line)] = '\0'; } @@ -89,7 +89,7 @@ static enum Format output_format = UNKNOWN_FORMAT; /* output format */ static bool ignore_case = false; /* fold lower to upper for sorting */ -static const char *break_file = NULL; /* name of the `Break characters' file */ +static const char *break_file = NULL; /* name of the `Break chars' file */ static const char *only_file = NULL; /* name of the `Only words' file */ static const char *ignore_file = NULL; /* name of the `Ignore words' file */ @@ -254,7 +254,7 @@ static char edited_flag[CHAR_SET_SIZE]; static int half_line_width; /* half of line width, reference excluded */ static int before_max_width; /* maximum width of before field */ static int keyafter_max_width; /* maximum width of keyword-and-after field */ -static int truncation_string_length;/* length of string used to flag truncation */ +static int truncation_string_length;/* length of string that flags truncation */ /* When context is limited by lines, wraparound may happen on final output: the `head' pointer gives access to some supplementary left context which @@ -1019,8 +1019,9 @@ find_occurs_in_text (void) < occurs_alloc[0]) xalloc_die (); occurs_alloc[0] = occurs_alloc[0] * 2 + 1; - occurs_table[0] = xrealloc (occurs_table[0], - occurs_alloc[0] * sizeof *occurs_table[0]); + occurs_table[0] = + xrealloc (occurs_table[0], + occurs_alloc[0] * sizeof *occurs_table[0]); } occurs_cursor = occurs_table[0] + number_of_occurs[0]; diff --git a/src/readlink.c b/src/readlink.c index a0f9173fb..eea307c3a 100644 --- a/src/readlink.c +++ b/src/readlink.c @@ -65,15 +65,18 @@ usage (int status) stdout); fputs (_("\ -f, --canonicalize canonicalize by following every symlink in\n\ - every component of the given name recursively;\n\ + every component of the given name recursively;\ +\n\ all but the last component must exist\n\ -e, --canonicalize-existing canonicalize by following every symlink in\n\ - every component of the given name recursively,\n\ + every component of the given name recursively,\ +\n\ all components must exist\n\ "), stdout); fputs (_("\ -m, --canonicalize-missing canonicalize by following every symlink in\n\ - every component of the given name recursively,\n\ + every component of the given name recursively,\ +\n\ without requirements on components existence\n\ -n, --no-newline do not output the trailing newline\n\ -q, --quiet,\n\ diff --git a/src/remove.c b/src/remove.c index d0b2dae2f..a827a6453 100644 --- a/src/remove.c +++ b/src/remove.c @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Extracted from rm.c and librarified, then rewritten twice by Jim Meyering. */ +/* Extracted from rm.c, librarified, then rewritten twice by Jim Meyering. */ #include <config.h> #include <stdio.h> diff --git a/src/rmdir.c b/src/rmdir.c index 90a80a602..452a027ed 100644 --- a/src/rmdir.c +++ b/src/rmdir.c @@ -171,7 +171,8 @@ Remove the DIRECTORY(ies), if they are empty.\n\ is non-empty\n\ "), stdout); fputs (_("\ - -p, --parents remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' is\n\ + -p, --parents remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' is\ +\n\ similar to `rmdir a/b/c a/b a'\n\ -v, --verbose output a diagnostic for every directory processed\n\ "), stdout); diff --git a/src/setuidgid.c b/src/setuidgid.c index 4881b46d7..59ed4782d 100644 --- a/src/setuidgid.c +++ b/src/setuidgid.c @@ -54,7 +54,8 @@ Usage: %s [SHORT-OPTION]... USER COMMAND [ARGUMENT]...\n\ program_name, program_name); fputs (_("\ -Drop any supplemental groups, assume the user-ID and group-ID of the specified\n\ +Drop any supplemental groups, assume the user-ID and group-ID of the specified\ +\n\ USER (numeric ID or user name), and run COMMAND with any specified ARGUMENTs.\n\ Exit with status 111 if unable to assume the required user and group ID.\n\ Otherwise, exit with the exit status of COMMAND.\n\ diff --git a/src/sort.c b/src/sort.c index 96e06960d..ec925465f 100644 --- a/src/sort.c +++ b/src/sort.c @@ -400,7 +400,8 @@ Ordering options:\n\ "), stdout); fputs (_("\ -b, --ignore-leading-blanks ignore leading blanks\n\ - -d, --dictionary-order consider only blanks and alphanumeric characters\n\ + -d, --dictionary-order consider only blanks and alphanumeric characters\ +\n\ -f, --ignore-case fold lower case to upper case characters\n\ "), stdout); fputs (_("\ @@ -419,7 +420,8 @@ Ordering options:\n\ "), stdout); fputs (_("\ --sort=WORD sort according to WORD:\n\ - general-numeric -g, human-numeric -h, month -M,\n\ + general-numeric -g, human-numeric -h, month -M,\ +\n\ numeric -n, random -R, version -V\n\ -V, --version-sort natural sort of (version) numbers within text\n\ \n\ @@ -434,7 +436,8 @@ Other options:\n\ "), stdout); fputs (_("\ -c, --check, --check=diagnose-first check for sorted input; do not sort\n\ - -C, --check=quiet, --check=silent like -c, but do not report first bad line\n\ + -C, --check=quiet, --check=silent like -c, but do not report first bad line\ +\n\ --compress-program=PROG compress temporaries with PROG;\n\ decompress them with PROG -d\n\ "), stdout); @@ -452,7 +455,8 @@ Other options:\n\ "), stdout); fputs (_("\ -o, --output=FILE write result to FILE instead of standard output\n\ - -s, --stable stabilize sort by disabling last-resort comparison\n\ + -s, --stable stabilize sort by disabling last-resort comparison\ +\n\ -S, --buffer-size=SIZE use SIZE for main memory buffer\n\ "), stdout); printf (_("\ @@ -461,7 +465,8 @@ Other options:\n\ multiple options specify multiple directories\n\ --parallel=N change the number of sorts run concurrently to N\n\ -u, --unique with -c, check for strict ordering;\n\ - without -c, output only the first of an equal run\n\ + without -c, output only the first of an equal run\ +\n\ "), DEFAULT_TMPDIR); fputs (_("\ -z, --zero-terminated end lines with 0 byte, not newline\n\ @@ -471,8 +476,10 @@ Other options:\n\ fputs (_("\ \n\ POS is F[.C][OPTS], where F is the field number and C the character position\n\ -in the field; both are origin 1. If neither -t nor -b is in effect, characters\n\ -in a field are counted from the beginning of the preceding whitespace. OPTS is\n\ +in the field; both are origin 1. If neither -t nor -b is in effect, characters\ +\n\ +in a field are counted from the beginning of the preceding whitespace. OPTS is\ +\n\ one or more single-letter ordering options, which override global ordering\n\ options for that key. If no key is given, use the entire line as the key.\n\ \n\ @@ -4481,8 +4488,8 @@ main (int argc, char **argv) else if (files[i][0] == '\0') { /* Using the standard `filename:line-number:' prefix here is - not totally appropriate, since NUL is the separator, not NL, - but it might be better than nothing. */ + not totally appropriate, since NUL is the separator, + not NL, but it might be better than nothing. */ unsigned long int file_number = i + 1; error (SORT_FAILURE, 0, _("%s:%lu: invalid zero-length file name"), diff --git a/src/tail.c b/src/tail.c index 2af9693de..47a3ba4f9 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1546,7 +1546,8 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files, must continue to watch the file. It's only when following by file descriptor that we must remove the watch. */ if ((ev->mask & IN_DELETE_SELF) - || ((ev->mask & IN_MOVE_SELF) && follow_mode == Follow_descriptor)) + || ((ev->mask & IN_MOVE_SELF) + && follow_mode == Follow_descriptor)) { inotify_rm_watch (wd, fspec->wd); hash_delete (wd_to_name, fspec); diff --git a/src/touch.c b/src/touch.c index f9374c07a..8c816e4b4 100644 --- a/src/touch.c +++ b/src/touch.c @@ -132,9 +132,11 @@ touch (const char *file) else if (! (no_create || no_dereference)) { /* Try to open FILE, creating it if necessary. */ + int default_permissions = + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; fd = fd_reopen (STDIN_FILENO, file, O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY, - S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + default_permissions); /* Don't save a copy of errno if it's EISDIR, since that would lead touch to give a bogus diagnostic for e.g., `touch /' (assuming diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm index 70974a8ad..63312ad88 100644 --- a/tests/Coreutils.pm +++ b/tests/Coreutils.pm @@ -67,7 +67,7 @@ defined $ENV{DJDIR} # {ERR => ...} # Same as for OUT, but compare with stderr, not stdout. # {OUT_SUBST => 's/variable_output/expected_output/'} -# Transform actual standard output before comparing it against expected output. +# Transform actual standard output before comparing it against expected. # This is useful e.g. for programs like du that produce output that # varies a lot from system. E.g., an empty file may consume zero file # blocks, or more, depending on the OS and on the file system type. @@ -507,7 +507,8 @@ sub run_tests ($$$$$) { my $out_file = $actual{$eo}; open IN, $out_file - or (warn "$program_name: cannot open $out_file for reading: $!\n"), + or (warn + "$program_name: cannot open $out_file for reading: $!\n"), $fail = 1, next; $actual_data{$eo} = <IN>; close IN diff --git a/tests/cp/existing-perm-race b/tests/cp/existing-perm-race index f048eb160..d5774404e 100755 --- a/tests/cp/existing-perm-race +++ b/tests/cp/existing-perm-race @@ -71,8 +71,8 @@ case $mode in # a $g2 process can maintain an open file descriptor to the # destination, but it's safer anyway. -rw-r-----*) - # If the file has group $g1 and is group-readable, that is definitely - # bogus, as neither the source nor the destination was readable to group $g1. + # If the file has group $g1 and is group-readable, that is definitely bogus, + # as neither the source nor the destination was readable to group $g1. test "$group" = "$g1" && fail=1;; *) fail=1;; diff --git a/tests/cp/perm b/tests/cp/perm index e5fdb098d..663ad4dfa 100755 --- a/tests/cp/perm +++ b/tests/cp/perm @@ -55,9 +55,13 @@ for u in 31 37 2; do ;; cp:*:no) test $u = 37 && - expected_perms=`echo $expected_perms|sed 's/.....$/-----/'` + expected_perms=` + echo $expected_perms | sed 's/.....$/-----/' + ` test $u = 31 && - expected_perms=`echo $expected_perms|sed 's/..\(..\).$/--\1-/'` + expected_perms=` + echo $expected_perms | sed 's/..\(..\).$/--\1-/' + ` ;; esac test _$actual_perms = _$expected_perms || exit 1 diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid index a25cbb478..b0497841d 100755 --- a/tests/cp/preserve-gid +++ b/tests/cp/preserve-gid @@ -60,9 +60,24 @@ t1() { "$nameless_uid" "$@" } -nameless_uid=`$PERL -le 'foreach my $i (1000..16*1024-1) { getpwuid $i or (print $i), exit }'` -nameless_gid1=`$PERL -le 'foreach my $i (1000..16*1024) { getgrgid $i or (print $i), exit }'` -nameless_gid2=`$PERL -le 'foreach my $i ('"$nameless_gid1"'+1..16*1024) { getgrgid $i or (print $i), exit }'` +nameless_uid=`$PERL -le ' + foreach my $i (1000..16*1024-1) + { + getpwuid $i or (print $i), exit + } +'` +nameless_gid1=`$PERL -le ' + foreach my $i (1000..16*1024) + { + getgrgid $i or (print $i), exit + } +'` +nameless_gid2=`$PERL -le ' + foreach my $i ('"$nameless_gid1"'+1..16*1024) + { + getgrgid $i or (print $i), exit + } +'` if test -z "$nameless_uid" \ || test -z "$nameless_gid1" \ diff --git a/tests/du/2g b/tests/du/2g index da3cc6a48..1b50e34d6 100755 --- a/tests/du/2g +++ b/tests/du/2g @@ -40,7 +40,8 @@ esac min_kb=3000000 test $min_kb -lt $free_kb || { - skip_test_ "too little free space on current partition: $free_kb (need $min_kb KB)" + skip_test_ \ + "too little free space on current partition: $free_kb (need $min_kb KB)" } big=big diff --git a/tests/du/long-from-unreadable b/tests/du/long-from-unreadable index 1da08bfaa..d27279013 100755 --- a/tests/du/long-from-unreadable +++ b/tests/du/long-from-unreadable @@ -47,7 +47,9 @@ dir=`printf '%200s\n' ' '|tr ' ' x` # cd $tmp || framework_failure # Sheesh. Bash 3.1.5 can't create this hierarchy. I get -# cd: error retrieving current directory: getcwd: cannot access parent directories: +# cd: error retrieving current directory: getcwd: +# cannot access parent directories: +# (all on one line). cwd=`pwd` # Use perl instead: diff --git a/tests/init.sh b/tests/init.sh index 4d89a1af6..22ba23656 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -111,7 +111,7 @@ fi # Eval this code in a subshell to determine a shell's suitability. # 10 - passes all tests; ok to use -# 9 - ok, but enabling "set -x" corrupts application stderr; prefer higher score +# 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 @@ -414,7 +414,8 @@ mktempd_() case $template_ in *XXXX) ;; - *) fail_ "invalid template: $template_ (must have a suffix of at least 4 X's)";; + *) fail_ \ + "invalid template: $template_ (must have a suffix of at least 4 X's)";; esac # First, try to use mktemp. diff --git a/tests/install/basic-1 b/tests/install/basic-1 index 3c45c2abb..6e37c2c48 100755 --- a/tests/install/basic-1 +++ b/tests/install/basic-1 @@ -74,7 +74,10 @@ test -d newdir3 || fail=1 # hence cannot do anything meaningful with the following relative-named dirs. iwd=`pwd` mkdir sub || fail=1 -(cd sub && chmod 0 . && ginstall -d "$iwd/xx/yy" rel/sub1 rel/sub2 2> /dev/null) && fail=1 +(cd sub && + chmod 0 . && + ginstall -d "$iwd/xx/yy" rel/sub1 rel/sub2 2> /dev/null +) && fail=1 chmod 755 sub # Ensure that the first argument-dir has been created. diff --git a/tests/ls/nameless-uid b/tests/ls/nameless-uid index e54c7ae55..73023a92c 100755 --- a/tests/ls/nameless-uid +++ b/tests/ls/nameless-uid @@ -24,7 +24,9 @@ print_ver_ ls require_root_ -nameless_uid=`$PERL -e 'foreach my $i (1000..16*1024) { getpwuid $i or (print "$i\n"), exit }'` +nameless_uid=`$PERL -e ' + foreach my $i (1000..16*1024) { getpwuid $i or (print "$i\n"), exit } +'` if test x$nameless_uid = x; then skip_test_ "couldn't find a nameless UID" diff --git a/tests/ls/readdir-mountpoint-inode b/tests/ls/readdir-mountpoint-inode index 8c17eb455..fc837d0d7 100755 --- a/tests/ls/readdir-mountpoint-inode +++ b/tests/ls/readdir-mountpoint-inode @@ -22,7 +22,8 @@ print_ver_ ls # We use --local here so as to not activate # potentially very many remote mounts. mount_points=$(df --local -P 2>&1 | sed -n 's,.*[0-9]% \(/.\),\1,p') -test -z "$mount_points" && skip_test_ "this test requires a non-root mount point" +test -z "$mount_points" && + skip_test_ "this test requires a non-root mount point" # Given e.g., /dev/shm, produce the list of GNU ls options that # let us list just that entry using readdir data from its parent: diff --git a/tests/misc/chroot-credentials b/tests/misc/chroot-credentials index cfa903dd5..2bce5cfd9 100755 --- a/tests/misc/chroot-credentials +++ b/tests/misc/chroot-credentials @@ -28,12 +28,17 @@ test $(chroot / whoami) = root || fail=1 test "$(groups)" = "$(chroot / groups)" || fail=1 # Verify that credentials are changed correctly. -test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami)" != root \ - || fail=1 +whoami_after_chroot=$( + chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami +) +test "$whoami_after_chroot" != root || fail=1 # Verify that there are no additional groups. -test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP --groups=$NON_ROOT_GROUP / id -G)"\ - = $NON_ROOT_GROUP || fail=1 +id_G_after_chroot=$( + chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP \ + --groups=$NON_ROOT_GROUP / id -G +) +test "$id_G_after_chroot" = $NON_ROOT_GROUP || fail=1 # Verify that when specifying only the user name we get the current # primary group ID. diff --git a/tests/misc/cut b/tests/misc/cut index e8f003ff2..f91932c02 100755 --- a/tests/misc/cut +++ b/tests/misc/cut @@ -87,7 +87,8 @@ my @Tests = . "\tonly when operating on fields\n$try"}], # You must specify bytes or fields (or chars) ['z', '', {IN=>":\n"}, {OUT=>""}, {EXIT=>1}, - {ERR=>"$prog: you must specify a list of bytes, characters, or fields\n$try"}], + {ERR=>"$prog: you must specify a list of bytes, characters, or fields\n$try"} + ], # Empty field list ['empty-fl', qw(-f ''), {IN=>":\n"}, {OUT=>""}, {EXIT=>1}, {ERR=>$from_1}], # Missing field list @@ -124,7 +125,7 @@ my @Tests = ['out-delim3a', '-c1-3,2-4,6-', '--output-d=:', {IN=>"abcdefg\n"}, {OUT=>"abcd:fg\n"}], # Ensure that the following two commands produce the same output. - # Before an off-by-one fix, the output from the former would not contain a `:'. + # Before an off-by-1 fix, the output from the former would not contain a `:'. ['out-delim4', '-c4-,2-3', '--output-d=:', {IN=>"abcdefg\n"}, {OUT=>"bc:defg\n"}], ['out-delim5', '-c2-3,4-', '--output-d=:', @@ -137,14 +138,16 @@ my @Tests = ['od-overlap2', '-b1-2,2-', '--output-d=:', {IN=>"abc\n"}, {OUT=>"abc\n"}], ['od-overlap3', '-b1-3,2-', '--output-d=:', {IN=>"abcd\n"}, {OUT=>"abcd\n"}], ['od-overlap4', '-b1-3,2-3', '--output-d=:', {IN=>"abcd\n"}, {OUT=>"abc\n"}], - ['od-overlap5', '-b1-3,1-4', '--output-d=:', {IN=>"abcde\n"}, {OUT=>"abcd\n"}], + ['od-overlap5', '-b1-3,1-4', '--output-d=:', + {IN=>"abcde\n"}, {OUT=>"abcd\n"}], # None of the following invalid ranges provoked an error up to coreutils-6.9. ['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>"$prog: invalid decreasing range\n$try"}], ['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval3', '-f', '4,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], - ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], + ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, + {ERR=>$no_endpoint}], ['inval5', '-f', '1-,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval6', '-f', '-1,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ); diff --git a/tests/misc/date b/tests/misc/date index 1b64558b4..38c4f3726 100755 --- a/tests/misc/date +++ b/tests/misc/date @@ -230,7 +230,8 @@ my @Tests = ['tz-5wf', '+%:8z', {OUT=>"%:8z"}, {ENV=>'TZ=XXX0:01'}], ['ns-relative', - '--iso=ns', "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", + '--iso=ns', + "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", {OUT=>"2000-06-15T09:43:58,111111021+0000"}], ['ns-relativer', '--rfc-3339=ns', "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", diff --git a/tests/misc/join b/tests/misc/join index a319b943c..ab43b5d56 100755 --- a/tests/misc/join +++ b/tests/misc/join @@ -216,7 +216,8 @@ my @tv = ( # '--header' always outputs headers from the first file # even if the headers from the second file don't match ['header-5', '--header', - [ "ID1 Name\n1 A\n2 B\n", "ID2 Color\n1 red\n"], "ID1 Name Color\n1 A red\n", 0], + [ "ID1 Name\n1 A\n2 B\n", "ID2 Color\n1 red\n"], + "ID1 Name Color\n1 A red\n", 0], ); diff --git a/tests/misc/md5sum b/tests/misc/md5sum index 819a81925..fc3bbb8c6 100755 --- a/tests/misc/md5sum +++ b/tests/misc/md5sum @@ -62,8 +62,8 @@ my @Tests = . "invalid\n" }}, {AUX=> {f=> 'foo'}}, {OUT=>"f: FAILED\nf: FAILED\n"}, - {ERR=>"md5sum: WARNING: 1 line is improperly formatted\n" - . "md5sum: WARNING: 2 computed checksums did NOT match\n"}, + {ERR=>"md5sum: WARNING: 1 line is improperly formatted\n" + . "md5sum: WARNING: 2 computed checksums did NOT match\n"}, {EXIT=> 1}], # Similar to the above, but use --warn to evoke one more diagnostic. ['check-multifail-warn', '--check', '--warn', diff --git a/tests/misc/sha1sum b/tests/misc/sha1sum index ecd779620..15badc085 100755 --- a/tests/misc/sha1sum +++ b/tests/misc/sha1sum @@ -60,7 +60,8 @@ my @Tests = ['check-bsd3', '--check', '--status', {IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}}, {AUX=> {f=> 'bar'}}, {EXIT=> 1}], - ['check-openssl', '--check', {IN=> {'f.md5' => "MD5(f)= $sha_degenerate\n"}}, + ['check-openssl', '--check', + {IN=> {'f.md5' => "MD5(f)= $sha_degenerate\n"}}, {AUX=> {f=> ''}}, {ERR=>"sha1sum: f.md5: no properly formatted " . "SHA1 checksum lines found\n"}, diff --git a/tests/misc/sha224sum b/tests/misc/sha224sum index a46c2a1fa..634150dd1 100755 --- a/tests/misc/sha224sum +++ b/tests/misc/sha224sum @@ -26,12 +26,12 @@ use strict; my @Tests = ( ['s3', {IN=> {f=> 'abc'}}, - {OUT=>"23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 f\n"}], + {OUT=>"23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 f\n"}], ['s4', {IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}}, - {OUT=>"75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 f\n"}], + {OUT=>"75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 f\n"}], ['s8', {IN=> {f=> 'a' x 1000000}}, - {OUT=>"20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67 f\n"}], + {OUT=>"20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67 f\n"}], ); # Insert the `--text' argument for each test. diff --git a/tests/misc/sort b/tests/misc/sort index 5bc526a27..e01e29bbe 100755 --- a/tests/misc/sort +++ b/tests/misc/sort @@ -55,8 +55,11 @@ my @Tests = ["n11b", '-s -n -k1,1', {IN=>".010\n.01a\n"}, {OUT=>".010\n.01a\n"}], # human readable suffixes -["h1", '-h', {IN=>"1Y\n1Z\n1E\n1P\n1T\n1G\n1M\n1K\n02\n1\nY\n-1k\n-1M\n-1G\n-1T\n-1P\n-1E\n-1Z\n-1Y\n"}, - {OUT=>"-1Y\n-1Z\n-1E\n-1P\n-1T\n-1G\n-1M\n-1k\nY\n1\n02\n1K\n1M\n1G\n1T\n1P\n1E\n1Z\n1Y\n"}], +["h1", '-h', + {IN=>"1Y\n1Z\n1E\n1P\n1T\n1G\n1M\n1K\n02\n1\nY\n-1k\n-1M\n-1G\n-1T\n" + . "-1P\n-1E\n-1Z\n-1Y\n"}, + {OUT=>"-1Y\n-1Z\n-1E\n-1P\n-1T\n-1G\n-1M\n-1k\nY\n1\n02\n1K\n1M\n1G\n1T\n" + . "1P\n1E\n1Z\n1Y\n"}], ["h2", '-h', {IN=>"1M\n-2G\n-3K"}, {OUT=>"-2G\n-3K\n1M\n"}], # check that it works with powers of 1024 ["h3", '-k 2,2h -k 1,1', {IN=>"a 1G\nb 1023M\n"}, {OUT=>"b 1023M\na 1G\n"}], @@ -275,8 +278,14 @@ my @Tests = # of memcmp in the Next C library. With optimization, gcc uses its # (working) builtin version. Test case form William Lewis. ["20a", '', - {IN=>"_________U__free\n_________U__malloc\n_________U__abort\n_________U__memcpy\n_________U__memset\n_________U_dyld_stub_binding_helper\n_________U__malloc\n_________U___iob\n_________U__abort\n_________U__fprintf\n"}, - {OUT=>"_________U___iob\n_________U__abort\n_________U__abort\n_________U__fprintf\n_________U__free\n_________U__malloc\n_________U__malloc\n_________U__memcpy\n_________U__memset\n_________U_dyld_stub_binding_helper\n"}], + {IN=>"_________U__free\n_________U__malloc\n_________U__abort\n" + . "_________U__memcpy\n_________U__memset\n" + . "_________U_dyld_stub_binding_helper\n_________U__malloc\n" + . "_________U___iob\n_________U__abort\n_________U__fprintf\n"}, + {OUT=>"_________U___iob\n_________U__abort\n_________U__abort\n" + . "_________U__fprintf\n_________U__free\n_________U__malloc\n" + . "_________U__malloc\n_________U__memcpy\n_________U__memset\n" + . "_________U_dyld_stub_binding_helper\n"}], # Demonstrate that folding changes the ordering of e.g. A, a, and _ # because while they normally (in the C locale) collate like A, _, a, diff --git a/tests/misc/sort-continue b/tests/misc/sort-continue index 95f2c488e..f82255d6f 100755 --- a/tests/misc/sort-continue +++ b/tests/misc/sort-continue @@ -33,7 +33,8 @@ done exec 0</dev/null 3<&- 4<&- 5<&- sort -n -m __test.* > out ) && -compare in out || { fail=1; echo 'file descriptor exhaustion not handled' 1>&2; } +compare in out || + { fail=1; echo 'file descriptor exhaustion not handled' 1>&2; } echo 32 | tee -a in > in1 ( diff --git a/tests/misc/sort-files0-from b/tests/misc/sort-files0-from index e2eb5c47f..6082e8a02 100755 --- a/tests/misc/sort-files0-from +++ b/tests/misc/sort-files0-from @@ -80,7 +80,7 @@ my @Tests = ['2a', '--files0-from=-', '<', {IN=>{f=>"g\0g\0"}}, {AUX=>{g=>'a'}}, {OUT=>"a\na\n"} ], - # Ensure that $prog performs no processing when there is a zero-length filename + # Ensure that $prog does nothing when there is a zero-length filename. # Note that the behavior here differs from `wc' in that the # first zero-length file name is treated as fatal, so there # should be no output on STDOUT. diff --git a/tests/misc/sort-rand b/tests/misc/sort-rand index 8fa3bc366..0034c452a 100755 --- a/tests/misc/sort-rand +++ b/tests/misc/sort-rand @@ -40,11 +40,13 @@ if (locale --version) > /dev/null 2>&1; then LC_ALL=$locale sort --random-sort in > out2 || fail=1 # Fail if the output "randomly" is the same twice in a row. - compare out1 out2 > /dev/null && { fail=1; echo "not random with LC_ALL=$locale" 1>&2; } + compare out1 out2 > /dev/null && + { fail=1; echo "not random with LC_ALL=$locale" 1>&2; } # Fail if the sorted output is not the same as the input. sort -n out > out1 - compare in out1 || { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; } + compare in out1 || + { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; } fi Exit $fail diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf index 59c780370..2b7bdb833 100755 --- a/tests/misc/stdbuf +++ b/tests/misc/stdbuf @@ -22,7 +22,8 @@ print_ver_ stdbuf mv getlimits_ require_built_ stdbuf -# stdbuf fails when the absolute top build dir name contains e.g., space, TAB, NL +# stdbuf fails when the absolute top build dir name contains e.g., +# space, TAB, NL lf=' ' case $abs_top_builddir in diff --git a/tests/misc/tr b/tests/misc/tr index 00cd8e62c..8d7d755b7 100755 --- a/tests/misc/tr +++ b/tests/misc/tr @@ -54,7 +54,8 @@ my @Tests = ['i', qw(-d '[:xdigit:]'), {IN=>'w0x1y2z3456789acbdefABCDEFz'}, {OUT=>'wxyzz'}], ['j', qw(-d '[:digit:]'), {IN=>'0123456789'}, {OUT=>''}], - ['k', qw(-d '[:digit:]'), {IN=>'a0b1c2d3e4f5g6h7i8j9k'}, {OUT=>'abcdefghijk'}], + ['k', qw(-d '[:digit:]'), + {IN=>'a0b1c2d3e4f5g6h7i8j9k'}, {OUT=>'abcdefghijk'}], ['l', qw(-d '[:lower:]'), {IN=>'abcdefghijklmnopqrstuvwxyz'}, {OUT=>''}], ['m', qw(-d '[:upper:]'), {IN=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {OUT=>''}], ['n', qw(-d '[:lower:][:upper:]'), @@ -83,11 +84,13 @@ my @Tests = ['u', qw(-ds b a), {IN=>'aabbaa'}, {OUT=>'a'}], ['v', qw(-ds '[:xdigit:]' Z), {IN=>'ZZ0123456789acbdefABCDEFZZ'}, {OUT=>'Z'}], - # Try some data with 8th bit set in case something is mistakenly sign-extended. + # Try some data with 8th bit set in case something is mistakenly + # sign-extended. ['w', qw(-ds '\350' '\345'), {IN=>"\300\301\377\345\345\350\345"}, {OUT=>"\300\301\377\345"}], - ['x', qw(-s abcdefghijklmn '[:*016]'), {IN=>'abcdefghijklmnop'}, {OUT=>':op'}], + ['x', qw(-s abcdefghijklmn '[:*016]'), + {IN=>'abcdefghijklmnop'}, {OUT=>':op'}], ['y', qw(-d a-z), {IN=>'abc $code'}, {OUT=>' $'}], ['z', qw(-ds a-z '$.'), {IN=>'a.b.c $$$$code\\'}, {OUT=>'. $\\'}], diff --git a/tests/misc/uniq b/tests/misc/uniq index 4d1f8a4ff..5e83ad94f 100755 --- a/tests/misc/uniq +++ b/tests/misc/uniq @@ -180,10 +180,13 @@ my @Tests = "$prog: printing all duplicated lines and repeat counts is meaningless\n$try"} ], ['113', '--all-repeated=separate', {IN=>"a\na\n"}, {OUT=>"a\na\n"}], - ['114', '--all-repeated=separate', {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"a\na\n\nc\nc\n"}], - ['115', '--all-repeated=separate', {IN=>"a\na\nb\nb\nc\n"}, {OUT=>"a\na\n\nb\nb\n"}], + ['114', '--all-repeated=separate', + {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"a\na\n\nc\nc\n"}], + ['115', '--all-repeated=separate', + {IN=>"a\na\nb\nb\nc\n"}, {OUT=>"a\na\n\nb\nb\n"}], ['116', '--all-repeated=prepend', {IN=>"a\na\n"}, {OUT=>"\na\na\n"}], - ['117', '--all-repeated=prepend', {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"\na\na\n\nc\nc\n"}], + ['117', '--all-repeated=prepend', + {IN=>"a\na\nb\nc\nc\n"}, {OUT=>"\na\na\n\nc\nc\n"}], ['118', '--all-repeated=prepend', {IN=>"a\nb\n"}, {OUT=>""}], ['119', '--all-repeated=badoption', {IN=>"a\n"}, {OUT=>""}, {EXIT=>1}, {ERR=>"$prog: invalid argument \`badoption' for \`--all-repeated'\n" diff --git a/tests/mv/atomic b/tests/mv/atomic index c75e62bb4..c62491fda 100755 --- a/tests/mv/atomic +++ b/tests/mv/atomic @@ -21,11 +21,13 @@ print_ver_ mv require_strace_ unlink # Before the fix, mv would unnecessarily unlink the destination symlink: -# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2; strace -qe unlink /bin/mv -T s1 s2 +# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2 +# $ strace -qe unlink /bin/mv -T s1 s2 # unlink("s2") = 0 # # With the fix, it doesn't call unlink: -# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2; strace -qe unlink ./mv -T s1 s2 +# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2 +# $ strace -qe unlink ./mv -T s1 s2 # $ ln -s t1 s1 || framework_failure diff --git a/tests/mv/part-fail b/tests/mv/part-fail index 2d80f599d..a506b92ad 100755 --- a/tests/mv/part-fail +++ b/tests/mv/part-fail @@ -30,9 +30,10 @@ chmod u-w "$other_partition_tmpdir" || framework_failure mv -f k "$other_partition_tmpdir" 2> out && fail=1 -cat <<EOF > exp -mv: inter-device move failed: \`k' to \`$other_partition_tmpdir/k'; unable to remove target: Permission denied -EOF +printf \ +'mv: inter-device move failed: `%s'\'' to `%s'\'';'\ +' unable to remove target: Permission denied\n' \ + k "$other_partition_tmpdir/k" >exp # On some (less-compliant) systems, we get EPERM in this case. # Accept either diagnostic. diff --git a/tests/mv/part-symlink b/tests/mv/part-symlink index 425718aff..0d40355cb 100755 --- a/tests/mv/part-symlink +++ b/tests/mv/part-symlink @@ -92,9 +92,10 @@ for copy in cp mv; do # remove any site-dependent part of other-partition file name, # and put brackets around the output. test -s .err && { - echo '[' | tr -d '\n' - sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err - echo ']' | tr -d '\n' + echo ' [' | tr -d '\n' + sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err | + tr -d '\n' + echo ']' } # Strip off all but the file names. # Remove any site-dependent part of each file name. @@ -110,16 +111,16 @@ for copy in cp mv; do -e "s,$other_partition_tmpdir/,," \ -e "s,$pwd_tmp/,," \ -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'` - echo "($ls) ($ls2)" + echo " ("$ls") ("$ls2")" # If the command failed, then it must not have changed the files. if test $copy_status != 0; then for f in $actual_args; do test -f $f || - { echo "$copy FAILED but removed $f"; continue; } + { echo " $copy FAILED but removed $f"; continue; } case "`cat $f`" in "$contents") ;; - *) echo "$copy FAILED but modified $f";; + *) echo " $copy FAILED but modified $f";; esac done fi @@ -134,15 +135,14 @@ for copy in cp mv; do fi case "`cat $f`" in "$contents") ;; - *) echo $copy FAILED;; + *) echo " $copy FAILED";; esac else - echo symlink-loop + echo " symlink-loop" fi done fi - ) | tr '\n' ' ' - echo + ) ) | sed 's/ *$//' cd .. done @@ -154,49 +154,107 @@ test $fail = 1 && { (exit 1); exit; } cat <<\EOF > $expected -1 cp loc_reg rem_sl [cp: `loc_reg' and `rem_sl' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) -0 cp --rem loc_reg rem_sl (loc_reg) (rem_sl) -0 cp --rem -d loc_reg rem_sl (loc_reg) (rem_sl) -0 cp --rem -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) -0 cp -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) -0 cp -bd loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) -1 cp -d loc_reg rem_sl [cp: `loc_reg' and `rem_sl' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) - -1 cp rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) -1 cp --rem rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) -1 cp --rem -d rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) -1 cp --rem -b rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) -1 cp -b rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) -0 cp -bd rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) (rem_sl -> dir/loc_reg) symlink-loop symlink-loop -1 cp -d rem_sl loc_reg [cp: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) - -1 cp loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) -1 cp --rem loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) -1 cp --rem -d loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) -1 cp --rem -b loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) -1 cp -b loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) -0 cp -bd loc_sl rem_reg (loc_sl -> rem_reg) (rem_reg -> rem_reg rem_reg~) symlink-loop symlink-loop -1 cp -d loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) - -1 cp rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file ](loc_sl -> rem_reg) (rem_reg) -0 cp --rem rem_reg loc_sl (loc_sl) (rem_reg) -0 cp --rem -d rem_reg loc_sl (loc_sl) (rem_reg) -0 cp --rem -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg) -0 cp -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg) -0 cp -bd rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg) -1 cp -d rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file ](loc_sl -> rem_reg) (rem_reg) - -0 mv loc_reg rem_sl () (rem_sl) -0 mv -b loc_reg rem_sl () (rem_sl rem_sl~ -> dir/loc_reg) - -1 mv rem_sl loc_reg [mv: `rem_sl' and `loc_reg' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) -0 mv -b rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) () - -1 mv loc_sl rem_reg [mv: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) -0 mv -b loc_sl rem_reg () (rem_reg -> rem_reg rem_reg~) - -0 mv rem_reg loc_sl (loc_sl) () -0 mv -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) () +1 cp loc_reg rem_sl + [cp: `loc_reg' and `rem_sl' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) +0 cp --rem loc_reg rem_sl + (loc_reg) (rem_sl) +0 cp --rem -d loc_reg rem_sl + (loc_reg) (rem_sl) +0 cp --rem -b loc_reg rem_sl + (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) +0 cp -b loc_reg rem_sl + (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) +0 cp -bd loc_reg rem_sl + (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) +1 cp -d loc_reg rem_sl + [cp: `loc_reg' and `rem_sl' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) + +1 cp rem_sl loc_reg + [cp: `rem_sl' and `loc_reg' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) +1 cp --rem rem_sl loc_reg + [cp: `rem_sl' and `loc_reg' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) +1 cp --rem -d rem_sl loc_reg + [cp: `rem_sl' and `loc_reg' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) +1 cp --rem -b rem_sl loc_reg + [cp: `rem_sl' and `loc_reg' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) +1 cp -b rem_sl loc_reg + [cp: `rem_sl' and `loc_reg' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) +0 cp -bd rem_sl loc_reg + (loc_reg -> dir/loc_reg loc_reg~) (rem_sl -> dir/loc_reg) + symlink-loop + symlink-loop +1 cp -d rem_sl loc_reg + [cp: `rem_sl' and `loc_reg' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) + +1 cp loc_sl rem_reg + [cp: `loc_sl' and `rem_reg' are the same file] + (loc_sl -> rem_reg) (rem_reg) +1 cp --rem loc_sl rem_reg + [cp: `loc_sl' and `rem_reg' are the same file] + (loc_sl -> rem_reg) (rem_reg) +1 cp --rem -d loc_sl rem_reg + [cp: `loc_sl' and `rem_reg' are the same file] + (loc_sl -> rem_reg) (rem_reg) +1 cp --rem -b loc_sl rem_reg + [cp: `loc_sl' and `rem_reg' are the same file] + (loc_sl -> rem_reg) (rem_reg) +1 cp -b loc_sl rem_reg + [cp: `loc_sl' and `rem_reg' are the same file] + (loc_sl -> rem_reg) (rem_reg) +0 cp -bd loc_sl rem_reg + (loc_sl -> rem_reg) (rem_reg -> rem_reg rem_reg~) + symlink-loop + symlink-loop +1 cp -d loc_sl rem_reg + [cp: `loc_sl' and `rem_reg' are the same file] + (loc_sl -> rem_reg) (rem_reg) + +1 cp rem_reg loc_sl + [cp: `rem_reg' and `loc_sl' are the same file] + (loc_sl -> rem_reg) (rem_reg) +0 cp --rem rem_reg loc_sl + (loc_sl) (rem_reg) +0 cp --rem -d rem_reg loc_sl + (loc_sl) (rem_reg) +0 cp --rem -b rem_reg loc_sl + (loc_sl loc_sl~ -> rem_reg) (rem_reg) +0 cp -b rem_reg loc_sl + (loc_sl loc_sl~ -> rem_reg) (rem_reg) +0 cp -bd rem_reg loc_sl + (loc_sl loc_sl~ -> rem_reg) (rem_reg) +1 cp -d rem_reg loc_sl + [cp: `rem_reg' and `loc_sl' are the same file] + (loc_sl -> rem_reg) (rem_reg) + +0 mv loc_reg rem_sl + () (rem_sl) +0 mv -b loc_reg rem_sl + () (rem_sl rem_sl~ -> dir/loc_reg) + +1 mv rem_sl loc_reg + [mv: `rem_sl' and `loc_reg' are the same file] + (loc_reg) (rem_sl -> dir/loc_reg) +0 mv -b rem_sl loc_reg + (loc_reg -> dir/loc_reg loc_reg~) () + +1 mv loc_sl rem_reg + [mv: `loc_sl' and `rem_reg' are the same file] + (loc_sl -> rem_reg) (rem_reg) +0 mv -b loc_sl rem_reg + () (rem_reg -> rem_reg rem_reg~) + +0 mv rem_reg loc_sl + (loc_sl) () +0 mv -b rem_reg loc_sl + (loc_sl loc_sl~ -> rem_reg) () EOF diff --git a/tests/mv/sticky-to-xpart b/tests/mv/sticky-to-xpart index dbb558483..a40f434fa 100755 --- a/tests/mv/sticky-to-xpart +++ b/tests/mv/sticky-to-xpart @@ -41,7 +41,10 @@ chmod go+x . || framework_failure # Ensure that $NON_ROOT_USERNAME can access the required version of mv. -version=`setuidgid $NON_ROOT_USERNAME env PATH="$PATH" mv --version|sed -n '1s/.* //p'` +version=` + setuidgid $NON_ROOT_USERNAME env PATH="$PATH" mv --version | + sed -n '1s/.* //p' +` case $version in $PACKAGE_VERSION) ;; *) echo "$0: cannot access just-built mv as user $NON_ROOT_USERNAME" 1>&2 diff --git a/tests/pr/pr-tests b/tests/pr/pr-tests index 0dabdb682..0349a12a0 100755 --- a/tests/pr/pr-tests +++ b/tests/pr/pr-tests @@ -256,8 +256,10 @@ my @tv = ( ['10md', '-J -m -l 24 -f', [\'tFFt-lm', \'loli'], [\'Jml24f-lm-lo'], 0], ['10me', '-W 35 -J -m -l 24 -f', [\'tFFt-lm', \'loli'], [\'W35Jml24f-lmlo'], 0], ['10mf', '-w 35 -J -m -l 24 -f', [\'tFFt-lm', \'loli'], [\'W35Jml24f-lmlo'], 0], -['10mg', '-n.3 -J -m -l 24 -f', [\'tFFt-lm', \'tFFt-lm', \'loli'], [\'nJml24f-lmlmlo'], 0], -['10mh', '-n.3 -J -m -l 24 -f', [\'tFFt-lm', \'loli', \'tFFt-lm'], [\'nJml24f-lmlolm'], 0], +['10mg', '-n.3 -J -m -l 24 -f', [\'tFFt-lm', \'tFFt-lm', \'loli'], + [\'nJml24f-lmlmlo'], 0], +['10mh', '-n.3 -J -m -l 24 -f', [\'tFFt-lm', \'loli', \'tFFt-lm'], + [\'nJml24f-lmlolm'], 0], ['10aa', '-a -3 -l 24 -f', [\'tFFt-lm'], [\'a3l24f-lm'], 0], ['10ab', '-W 35 -a -3 -l 24 -f', [\'tFFt-lm'], [\'W35a3l24f-lm'], 0], ['10ac', '-J -a -3 -l 24 -f', [\'tFFt-lm'], [\'Ja3l24f-lm'], 0], @@ -268,12 +270,18 @@ my @tv = ( ['10bd', '-W 35 -J -b -3 -l 24 -f', [\'tFFt-lm'], [\'W35Jb3l24f-lm'], 0], # # merge files (-m option) use separator string (-S option) -['11sa', '-n.3 -S:--: -m -l 20 -f', [\'tFFt-bl', \'FnFn'], [\'nSml20-bl-FF'], 0], -['11sb', '-n.3 -S:--: -m -l 24 -f', [\'tFFt-bl', \'FnFn'], [\'nSml24-bl-FF'], 0], -['11se', '-n.3 -S:--: -m -l 20 -f', [\'tn', \'tn', \'FnFn'], [\'nSml20-t-t-FF'], 0], -['11sf', '-n.3 -S:--: -m -l 24 -f', [\'tn', \'tn', \'FnFn'], [\'nSml24-t-t-FF'], 0], -['11sg', '-n.3 -S:--: -m -l 20 -f', [\'tn', \'tn', \'FnFn', \'FnFn'], [\'nSml20-t-tFFFF'], 0], -['11sh', '-n.3 -S:--: -m -l 24 -f', [\'tn', \'tn', \'FnFn', \'FnFn'], [\'nSml24-t-tFFFF'], 0], +['11sa', '-n.3 -S:--: -m -l 20 -f', [\'tFFt-bl', \'FnFn'], + [\'nSml20-bl-FF'], 0], +['11sb', '-n.3 -S:--: -m -l 24 -f', [\'tFFt-bl', \'FnFn'], + [\'nSml24-bl-FF'], 0], +['11se', '-n.3 -S:--: -m -l 20 -f', [\'tn', \'tn', \'FnFn'], + [\'nSml20-t-t-FF'], 0], +['11sf', '-n.3 -S:--: -m -l 24 -f', [\'tn', \'tn', \'FnFn'], + [\'nSml24-t-t-FF'], 0], +['11sg', '-n.3 -S:--: -m -l 20 -f', [\'tn', \'tn', \'FnFn', \'FnFn'], + [\'nSml20-t-tFFFF'], 0], +['11sh', '-n.3 -S:--: -m -l 24 -f', [\'tn', \'tn', \'FnFn', \'FnFn'], + [\'nSml24-t-tFFFF'], 0], # # left margin (-o option) and separator string (-S option) ['12aa', '-o3 -a -3 -l24 -f', [\'tn'], [\'o3a3l24f-tn'], 0], @@ -284,7 +292,8 @@ my @tv = ( ['12bc', '-o3 -b -3 -S:--: -n. -l24 -f', [\'tn'], [\'o3b3Snl24f-tn'], 0], ['12ma', '-o3 -m -l24 -f', [\'tFFt-bl', \'tn'], [\'o3ml24f-bl-tn'], 0], ['12mb', '-o3 -m -S:--: -l24 -f', [\'tFFt-bl', \'tn'], [\'o3mSl24f-bl-tn'], 0], -['12mc', '-o3 -m -S:--: -n. -l24 -f', [\'tFFt-bl', \'tn'], [\'o3mSnl24fbltn'], 0], +['12mc', '-o3 -m -S:--: -n. -l24 -f', [\'tFFt-bl', \'tn'], + [\'o3mSnl24fbltn'], 0], ['12md', '-o3 -J -m -l24 -f', [\'tFFt-lm', \'loli'], [\'o3Jml24f-lm-lo'], 0], # # @@ -342,18 +351,23 @@ my @tv = ( # SunOS.5.5.1-BUG: 8 input spaces --> 11 output spaces between a and b; ['i-opt-a', '-tn -i5 -h ""', "a b\n", " 1 a b\n", 0], # SunOS.5.5.1-BUG: 8 input spaces --> 9 output spaces between a and b; -['i-opt-b', '-tn -i5 -o9 -h ""', "a b\n", " 1 a b\n", 0], +['i-opt-b', '-tn -i5 -o9 -h ""', "a b\n", + " 1 a b\n", 0], # # line number overflow not allowed: cut off leading digits; # don't adapt other UNIXes, no real standard to follow, a consequent # programming of column handling may change the GNU pr concept. -['ncut-a', '-tn2 -N98', "y\ny\ny\ny\ny\n", "98 y\n99 y\n00 y\n01 y\n02 y\n", 0], -['ncut-b', '-tn:2 -N98', "y\ny\ny\ny\ny\n", "98:y\n99:y\n00:y\n01:y\n02:y\n", 0], +['ncut-a', '-tn2 -N98', "y\ny\ny\ny\ny\n", + "98 y\n99 y\n00 y\n01 y\n02 y\n", 0], +['ncut-b', '-tn:2 -N98', "y\ny\ny\ny\ny\n", + "98:y\n99:y\n00:y\n01:y\n02:y\n", 0], ['margin-0', '-o 0', '', '', 0], # BUG fixed: that leading space on 3rd line of output should not be there -['dbl-sp-a', '-d -l 14 -h ""', "1\n2\n", "\n\n-- Date/Time -- Page 1\n\n\n1\n\n2\n\n\n\n\n\n\n", 0], +['dbl-sp-a', '-d -l 14 -h ""', "1\n2\n", + "\n\n-- Date/Time -- " + . "Page 1\n\n\n1\n\n2\n\n\n\n\n\n\n", 0], # This test failed with 1.22e and earlier. ['dbl-sp-b', '-d -t', "1\n2\n", "1\n\n2\n\n", 0], diff --git a/tests/rm/fail-2eperm b/tests/rm/fail-2eperm index 416c97e98..49cd44169 100755 --- a/tests/rm/fail-2eperm +++ b/tests/rm/fail-2eperm @@ -31,7 +31,10 @@ touch a/b || framework_failure # Try to ensure that $NON_ROOT_USERNAME can access # the required version of rm. -rm_version=`setuidgid $NON_ROOT_USERNAME env PATH="$PATH" rm --version|sed -n '1s/.* //p'` +rm_version=` + setuidgid $NON_ROOT_USERNAME env PATH="$PATH" rm --version | + sed -n '1s/.* //p' +` case $rm_version in $PACKAGE_VERSION) ;; *) skip_test_ "cannot access just-built rm as user $NON_ROOT_USERNAME";; diff --git a/tests/rm/interactive-always b/tests/rm/interactive-always index 7a1297046..6c11255c3 100755 --- a/tests/rm/interactive-always +++ b/tests/rm/interactive-always @@ -68,15 +68,15 @@ test -f file4-1 || fail=1 cat <<\EOF > expout || fail=1 EOF -cat <<\EOF > experr || fail=1 +sed 's/@remove_empty/rm: remove regular empty file/g' <<\EOF > experr || fail=1 no WHEN -rm: remove regular empty file `file1-1'? rm: remove regular empty file `file1-2'? . +@remove_empty `file1-1'? @remove_empty `file1-2'? . WHEN=never . WHEN=once rm: remove all arguments recursively? . WHEN=always -rm: remove regular empty file `file4-1'? rm: remove regular empty file `file4-2'? . +@remove_empty `file4-1'? @remove_empty `file4-2'? . -f overrides --interactive . --interactive overrides -f |