1
0
mirror of https://git.savannah.gnu.org/git/coreutils.git synced 2025-08-05 20:15:51 +03:00

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.
This commit is contained in:
Paul Eggert
2010-12-28 12:28:48 -08:00
parent 01211e9af7
commit b0097f3d21
60 changed files with 465 additions and 225 deletions

View File

@@ -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, If you want to assign a single change, you should use the file,
doc/Copyright/request-assign.changes: 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, If you would like to assign past and future contributions to a project,
you'd use doc/Copyright/request-assign.future: 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. You may make assignments for up to four projects at a time.

20
cfg.mk
View File

@@ -149,6 +149,23 @@ ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
sc_check-AUTHORS: sc_check-AUTHORS:
@$(MAKE) -s -C src $@ @$(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 # Option descriptions should not start with a capital letter
# One could grep source directly as follows: # One could grep source directly as follows:
# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$') # 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) $(_sc_search_regexp)
# Ensure that each file that contains fail=1 also contains fail=0. # 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: sc_prohibit_fail_0:
@prohibit='\<fail=0\>' \ @prohibit='\<fail=0\>' \
halt='fail=0 initialization' \ halt='fail=0 initialization' \

View File

@@ -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; \ $(AM_V_GEN)LC_ALL=C; export LC_ALL; \
{ sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \ { sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c && \ $(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-$@ \ $(top_srcdir)/src/shred.c; } > t-$@ \
&& mv t-$@ $@ && mv t-$@ $@
@@ -60,6 +61,7 @@ syntax_checks = \
.PHONY: $(syntax_checks) check-texinfo .PHONY: $(syntax_checks) check-texinfo
# List words/regexps here that should not appear in the texinfo documentation. # List words/regexps here that should not appear in the texinfo documentation.
BAD_POSIX_PERL = /\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/
check-texinfo: $(syntax_checks) check-texinfo: $(syntax_checks)
$(AM_V_GEN)fail=0; \ $(AM_V_GEN)fail=0; \
grep '@url{' $(srcdir)/*.texi && fail=1; \ grep '@url{' $(srcdir)/*.texi && fail=1; \
@@ -69,7 +71,7 @@ check-texinfo: $(syntax_checks)
| $(EGREP) -v 'setfilename|[{]filename[}]' \ | $(EGREP) -v 'setfilename|[{]filename[}]' \
&& fail=1; \ && fail=1; \
$(PERL) -e 1 2> /dev/null && { $(PERL) -ne \ $(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; }; \ $(srcdir)/*.texi 2> /dev/null || fail=1; }; \
exit $$fail exit $$fail
@@ -108,7 +110,8 @@ sc-avoid-non-zero:
# Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent). # Use `zeros', not `zeroes' (nothing wrong with `zeroes'. just be consistent).
sc-avoid-zeroes: 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 = $(subdir)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME = doc/Makefile ME = doc/Makefile

View File

@@ -736,7 +736,7 @@ name.
* Trailing slashes:: --strip-trailing-slashes, in some programs. * Trailing slashes:: --strip-trailing-slashes, in some programs.
* Traversing symlinks:: -H, -L, or -P, in some programs. * Traversing symlinks:: -H, -L, or -P, in some programs.
* Treating / specially:: --preserve-root and --no-preserve-root. * 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. * Standards conformance:: Conformance to the @acronym{POSIX} standard.
@end menu @end menu
@@ -1316,7 +1316,7 @@ a symlink or its referent.
@macro choptH @macro choptH
@item -H @item -H
@opindex -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 If @option{--recursive} (@option{-R}) is specified and
a command line argument is a symbolic link to a directory, traverse it. a command line argument is a symbolic link to a directory, traverse it.
@end macro @end macro
@@ -1778,7 +1778,8 @@ Synopses:
@smallexample @smallexample
od [@var{option}]@dots{} [@var{file}]@dots{} od [@var{option}]@dots{} [@var{file}]@dots{}
od [-abcdfilosx]@dots{} [@var{file}] [[+]@var{offset}[.][b]] 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 @end smallexample
Each line of output consists of the offset in the input, followed by 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 In such cases, running @command{\cmd\} via @command{xargs} is undesirable
because it splits the list into pieces and makes @command{\cmd\} print because it splits the list into pieces and makes @command{\cmd\} print
\subListOutput\ for each sublist rather than for the entire list. \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. @command{find}, using its @option{-print0} predicate.
If @var{file} is @samp{-} then the @acronym{ASCII} @sc{nul} terminated file names If @var{file} is @samp{-} then the @acronym{ASCII} @sc{nul} terminated
are read from standard input. file names are read from standard input.
@end macro @end macro
@filesZeroFromOption{wc,,a total} @filesZeroFromOption{wc,,a total}
@@ -4234,7 +4236,8 @@ or other special characters).
Historical (BSD and System V) implementations of @command{sort} have Historical (BSD and System V) implementations of @command{sort} have
differed in their interpretation of some options, particularly 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. behavior, which is usually (but not always!) like the System V behavior.
According to @acronym{POSIX}, @option{-n} no longer implies @option{-b}. For According to @acronym{POSIX}, @option{-n} no longer implies @option{-b}. For
consistency, @option{-M} has been changed in the same way. This may 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 and converting each @samp{\0} back to the original record delimiter.
@c @c
@c @example @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 @c @end example
@item @item
@@ -5118,7 +5124,8 @@ Choose an output format suitable for @command{nroff} or @command{troff}
processing. Each output line will look like: processing. Each output line will look like:
@smallexample @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 @end smallexample
so it will be possible to write a @samp{.xx} roff macro to take care of 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: line will look like:
@smallexample @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 @end smallexample
@noindent @noindent
@@ -6017,7 +6025,8 @@ newlines.
@noindent @noindent
By the way, the above idiom is not portable because it uses ranges, and By the way, the above idiom is not portable because it uses ranges, and
it assumes that the octal code for newline is 012. 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 @example
tr -cs '[:alnum:]' '[\n*]' 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. when it might be a symlink to a directory.
Otherwise, @command{mv} may do something very surprising, since Otherwise, @command{mv} may do something very surprising, since
its behavior depends on the underlying rename system call. 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 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. renames not the symlink but rather the directory referenced by the symlink.
@xref{Trailing slashes}. @xref{Trailing slashes}.
@@ -8845,7 +8855,8 @@ Display to standard error all status updates as sterilization proceeds.
@opindex -x @opindex -x
@opindex --exact @opindex --exact
By default, @command{shred} rounds the size of a regular file up to the next 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. Use @option{--exact} to suppress that behavior.
Thus, by default if you shred a 10-byte regular file on a system with 512-byte 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, 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: Synopsis:
@example @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 @end example
If used, @var{new-owner} specifies the new owner and/or group as follows 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: or to the group of an existing reference file. Synopsis:
@example @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 @end example
If @var{group} is intended to represent a 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: @command{chmod} changes the access permissions of the named files. Synopsis:
@example @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 @end example
@cindex symbolic links, permissions of @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 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 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 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 on unmounted file systems, because on most kinds of systems doing so
requires extremely nonportable intimate knowledge of file system requires extremely nonportable intimate knowledge of file system
structures. structures.
@@ -11390,7 +11405,8 @@ test
If @var{expression} is omitted, @command{test} returns false. If @var{expression} is omitted, @command{test} returns false.
If @var{expression} is a single argument, 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}, can be any string, including strings like @samp{-d}, @samp{-1},
@samp{--}, @samp{--help}, and @samp{--version} that most other @samp{--}, @samp{--help}, and @samp{--version} that most other
programs would treat as options. To get help and version information, 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 @opindex --file
Set the line opened by the file name specified in @var{device} instead of 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 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 because opening a @acronym{POSIX} tty requires use of the
prevent a @acronym{POSIX} tty from blocking until the carrier detect line is high if @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 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. 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). of course).
Some settings are not available on all @acronym{POSIX} systems, since they use 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 extensions. Such arguments are marked below with
description. On non-@acronym{POSIX} systems, those or other settings also may not ``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 be available, but it's not feasible to document all the variations: just
try it and see. try it and see.
@@ -12817,7 +12835,8 @@ Newline performs a carriage return. Non-@acronym{POSIX}. May be negated.
@item ofill @item ofill
@opindex ofill @opindex ofill
@cindex pad instead of timing for delaying @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. May be negated.
@item ofdel @item ofdel
@@ -12945,7 +12964,8 @@ of literally. Non-@acronym{POSIX}. May be negated.
@opindex crtkill @opindex crtkill
Echo the @code{kill} special character by erasing each character on Echo the @code{kill} special character by erasing each character on
the line as indicated by the @code{echoprt} and @code{echoe} settings, 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. May be negated.
@end table @end table
@@ -13169,7 +13189,8 @@ Set the output speed to @var{n}.
@item rows @var{n} @item rows @var{n}
@opindex rows @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} @item cols @var{n}
@itemx columns @var{n} @itemx columns @var{n}
@@ -14386,7 +14407,8 @@ parsed reliably. In the following example, @var{release} is
@smallexample @smallexample
uname -a 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 @end smallexample
@@ -14592,7 +14614,8 @@ Synopses:
@smallexample @smallexample
chcon [@var{option}]@dots{} @var{context} @var{file}@dots{} 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{} chcon [@var{option}]@dots{} --reference=@var{rfile} @var{file}@dots{}
@end smallexample @end smallexample
@@ -14678,7 +14701,8 @@ Set range @var{range} in the target security context.
Synopses: Synopses:
@smallexample @smallexample
runcon @var{context} @var{command} [@var{args}] 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 @end smallexample
Run @var{command} with completely-specified @var{context}, or with 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} Any additional arguments after @var{command}
are interpreted as arguments to the 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}. The program accepts the following options. Also see @ref{Common options}.
@@ -15853,7 +15878,8 @@ It was written by Arnold Robbins.
@unnumberedsec Toolbox Introduction @unnumberedsec Toolbox Introduction
This month's column is only peripherally related to the GNU Project, in 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 might be used. What it's really about is the ``Software Tools'' philosophy
of program development and usage. 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 @unnumberedsec Putting the Tools Together
Now, let's suppose this is a large ISP server system with dozens of users 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 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 is logged in multiple times, his or her name should only show up in the
output once. 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 @command{uniq} does. However, @command{uniq} has other uses for which one
cannot substitute @samp{sort -u}. 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, all the users on the system (@samp{#} is the system administrator,
or @code{root}, prompt): or @code{root}, prompt):

View File

@@ -52,7 +52,9 @@ AC_DEFUN([GNULIB_BOOT_TIME],
#endif #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 */ /* your system *does* have the infrastructure to determine boot time */
#else #else
please_tell_us_how_to_determine_boot_time_on_your_system please_tell_us_how_to_determine_boot_time_on_your_system

View File

@@ -316,7 +316,10 @@ unless ($manual)
# Extract usage clause(s) [if any] for SYNOPSIS. # Extract usage clause(s) [if any] for SYNOPSIS.
my $PAT_USAGE = _('Usage'); my $PAT_USAGE = _('Usage');
my $PAT_USAGE_CONT = _('or'); 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; my @syn = $3 . $4;

View File

@@ -4,7 +4,8 @@
'\" of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. '\" of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
'\" There is NO WARRANTY, to the extent permitted by law. '\" There is NO WARRANTY, to the extent permitted by law.
[NAME] [NAME]
stdbuf \- Run COMMAND, with modified buffering operations for its standard streams. stdbuf \-
Run COMMAND, with modified buffering operations for its standard streams.
[DESCRIPTION] [DESCRIPTION]
.\" Add any additional description here .\" Add any additional description here
[EXAMPLES] [EXAMPLES]

View File

@@ -323,7 +323,8 @@ cat (
use_fionread = false; use_fionread = false;
else else
{ {
error (0, errno, _("cannot do ioctl on %s"), quote (infile)); error (0, errno, _("cannot do ioctl on %s"),
quote (infile));
newlines2 = newlines; newlines2 = newlines;
return false; return false;
} }

View File

@@ -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) && qset_acl (dst_name, dest_desc, restrictive_temp_mode) != 0)
{ {
if (! owner_failure_ok (x)) 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; return -x->require_preserve;
} }
} }

View File

@@ -170,16 +170,19 @@ Mandatory arguments to long options are mandatory for short options too.\n\
fputs (_("\ fputs (_("\
-a, --archive same as -dR --preserve=all\n\ -a, --archive same as -dR --preserve=all\n\
--attributes-only don't copy the file data, just the attributes\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\ -b like --backup but does not accept an argument\n\
--copy-contents copy contents of special files when recursive\n\ --copy-contents copy contents of special files when recursive\n\
-d same as --no-dereference --preserve=links\n\ -d same as --no-dereference --preserve=links\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
-f, --force if an existing destination file cannot be\n\ -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\ 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\ option)\n\
-H follow command-line symbolic links in SOURCE\n\ -H follow command-line symbolic links in SOURCE\n\
"), stdout); "), 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\ -p same as --preserve=mode,ownership,timestamps\n\
--preserve[=ATTR_LIST] preserve the specified attributes (default:\n\ --preserve[=ATTR_LIST] preserve the specified attributes (default:\n\
mode,ownership,timestamps), if possible\n\ mode,ownership,timestamps), if possible\n\
additional attributes: context, links, xattr,\n\ additional attributes: context, links, xattr,\
\n\
all\n\ all\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@@ -207,8 +211,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-R, -r, --recursive copy directories recursively\n\ -R, -r, --recursive copy directories recursively\n\
--reflink[=WHEN] control clone/CoW copies. See below\n\ --reflink[=WHEN] control clone/CoW copies. See below\n\
--remove-destination remove each existing destination file before\n\ --remove-destination remove each existing destination file before\n\
attempting to open it (contrast with --force)\n\ attempting to open it (contrast with --force)\
"), stdout); \n"), stdout);
fputs (_("\ fputs (_("\
--sparse=WHEN control creation of sparse files. See below\n\ --sparse=WHEN control creation of sparse files. See below\n\
--strip-trailing-slashes remove any trailing slashes from each SOURCE\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); reflink_type_string, reflink_type);
break; 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.dereference = DEREF_NEVER;
x.preserve_links = true; x.preserve_links = true;
x.preserve_ownership = true; x.preserve_ownership = true;

View File

@@ -1939,7 +1939,8 @@ main (int argc, char **argv)
|| S_ISDIR (stdout_stat.st_mode) || S_ISDIR (stdout_stat.st_mode)
|| S_TYPEISSHM (&stdout_stat)) || S_TYPEISSHM (&stdout_stat))
error (EXIT_FAILURE, ftruncate_errno, 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)); size, quote (output_file));
} }
} }

View 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\ `-BM' prints sizes in units of 1,048,576 bytes.\n\
See SIZE format below.\n\ See SIZE format below.\n\
--total produce a grand total\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\ -H, --si likewise, but use powers of 1000 not 1024\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
-i, --inodes list inode information instead of block usage\n\ -i, --inodes list inode information instead of block usage\n\
-k like --block-size=1K\n\ -k like --block-size=1K\n\
-l, --local limit listing to local file systems\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); "), stdout);
fputs (_("\ fputs (_("\
-P, --portability use the POSIX output format\n\ -P, --portability use the POSIX output format\n\

View File

@@ -267,7 +267,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
-a, --all write counts for all files, not just directories\n\ -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\ the apparent size is usually smaller, it may be\n\
larger due to holes in (`sparse') files, internal\n\ larger due to holes in (`sparse') files, internal\n\
fragmentation, indirect blocks, and the like\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\ names specified in file F;\n\
If F is - then read names from standard input\n\ If F is - then read names from standard input\n\
-H equivalent to --dereference-args (-D)\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\ --si like -h, but use powers of 1000 not 1024\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\

View File

@@ -53,7 +53,8 @@ usage (int status)
{ {
printf (_("Usage: %s [OPTION]... [USERNAME]...\n"), program_name); printf (_("Usage: %s [OPTION]... [USERNAME]...\n"), program_name);
fputs (_("\ 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"), the current process (which may differ if the groups database has changed).\n"),
stdout); stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (HELP_OPTION_DESCRIPTION, stdout);

View File

@@ -986,7 +986,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
--preserve-context preserve SELinux security context\n\ --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); "), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (HELP_OPTION_DESCRIPTION, stdout);

View File

@@ -2048,7 +2048,8 @@ decode_switches (int argc, char **argv)
} }
} }
/* Note we leave %5b etc. alone so user widths/flags are honored. */ /* 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 ()) if (!abmon_init ())
error (0, 0, _("error initializing month strings")); 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\ --dereference-command-line-symlink-to-dir\n\
follow each command line symbolic link\n\ follow each command line symbolic link\n\
that points to a directory\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\ (overridden by -a or -A)\n\
"), stdout); "), stdout);
fputs (_("\ 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\ none (default), slash (-p),\n\
file-type (--file-type), classify (-F)\n\ file-type (--file-type), classify (-F)\n\
-i, --inode print the index number of each file\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\ -k like --block-size=1K\n\
"), stdout); "), stdout);
fputs (_("\ 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\ -L, --dereference when showing file information for a symbolic\n\
link, show information for the file the link\n\ link, show information for the file the link\n\
references rather than for the link itself\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); "), stdout);
fputs (_("\ fputs (_("\
-n, --numeric-uid-gid like -l, but list numeric user and group IDs\n\ -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\ unless program is `ls' and output is a terminal)\n\
-Q, --quote-name enclose entry names in double quotes\n\ -Q, --quote-name enclose entry names in double quotes\n\
--quoting-style=WORD use quoting style WORD for entry names:\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); "), stdout);
fputs (_("\ fputs (_("\
-r, --reverse reverse order while sorting\n\ -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\ -S sort by file size\n\
--sort=WORD sort by WORD instead of name: none -U,\n\ --sort=WORD sort by WORD instead of name: none -U,\n\
extension -X, size -S, time -t, version -v\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\ time: atime -u, access -u, use -u, ctime -c,\n\
or status -c; use specified time as sort key\n\ or status -c; use specified time as sort key\n\
if --sort=time\n\ if --sort=time\n\

View File

@@ -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. Copyright (C) 1995-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@@ -209,7 +209,8 @@ text), and name for each FILE.\n"),
name. S is modified. Return true if successful. */ name. S is modified. Return true if successful. */
static bool 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; size_t i;
@@ -576,23 +577,26 @@ digest_check (const char *checkfile_name)
{ {
if (n_misformatted_lines != 0) if (n_misformatted_lines != 0)
error (0, 0, error (0, 0,
ngettext ("WARNING: %" PRIuMAX " line is improperly formatted", (ngettext
("WARNING: %" PRIuMAX " line is improperly formatted",
"WARNING: %" PRIuMAX " lines are improperly formatted", "WARNING: %" PRIuMAX " lines are improperly formatted",
select_plural (n_misformatted_lines)), select_plural (n_misformatted_lines))),
n_misformatted_lines); n_misformatted_lines);
if (n_open_or_read_failures != 0) if (n_open_or_read_failures != 0)
error (0, 0, error (0, 0,
ngettext ("WARNING: %" PRIuMAX " listed file could not be read", (ngettext
("WARNING: %" PRIuMAX " listed file could not be read",
"WARNING: %" PRIuMAX " listed files could not be read", "WARNING: %" PRIuMAX " listed files could not be read",
select_plural (n_open_or_read_failures)), select_plural (n_open_or_read_failures))),
n_open_or_read_failures); n_open_or_read_failures);
if (n_mismatched_checksums != 0) if (n_mismatched_checksums != 0)
error (0, 0, error (0, 0,
ngettext ("WARNING: %" PRIuMAX " computed checksum did NOT match", (ngettext
("WARNING: %" PRIuMAX " computed checksum did NOT match",
"WARNING: %" PRIuMAX " computed checksums did NOT match", "WARNING: %" PRIuMAX " computed checksums did NOT match",
select_plural (n_mismatched_checksums)), select_plural (n_mismatched_checksums))),
n_mismatched_checksums); n_mismatched_checksums);
} }
} }

View File

@@ -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\ Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout); "), stdout);
fputs (_("\ 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\ -b like --backup but does not accept an argument\n\
-f, --force do not prompt before overwriting\n\ -f, --force do not prompt before overwriting\n\
-i, --interactive prompt before overwrite\n\ -i, --interactive prompt before overwrite\n\

View File

@@ -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\ 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\ 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\ 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\ output line.\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@@ -1046,7 +1047,8 @@ skip (uintmax_t n_skip)
} }
static void 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)
{ {
} }

View File

@@ -220,7 +220,7 @@ print_entry (const STRUCT_UTMP *utmp_ent)
else else
{ {
strcpy (line, DEV_DIR_WITH_TRAILING_SLASH); 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'; line[DEV_DIR_LEN + sizeof (utmp_ent->ut_line)] = '\0';
} }

View File

@@ -89,7 +89,7 @@ static enum Format output_format = UNKNOWN_FORMAT;
/* output format */ /* output format */
static bool ignore_case = false; /* fold lower to upper for sorting */ 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 *only_file = NULL; /* name of the `Only words' file */
static const char *ignore_file = NULL; /* name of the `Ignore 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 half_line_width; /* half of line width, reference excluded */
static int before_max_width; /* maximum width of before field */ static int before_max_width; /* maximum width of before field */
static int keyafter_max_width; /* maximum width of keyword-and-after 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: /* When context is limited by lines, wraparound may happen on final output:
the `head' pointer gives access to some supplementary left context which the `head' pointer gives access to some supplementary left context which
@@ -1019,7 +1019,8 @@ find_occurs_in_text (void)
< occurs_alloc[0]) < occurs_alloc[0])
xalloc_die (); xalloc_die ();
occurs_alloc[0] = occurs_alloc[0] * 2 + 1; occurs_alloc[0] = occurs_alloc[0] * 2 + 1;
occurs_table[0] = xrealloc (occurs_table[0], occurs_table[0] =
xrealloc (occurs_table[0],
occurs_alloc[0] * sizeof *occurs_table[0]); occurs_alloc[0] * sizeof *occurs_table[0]);
} }

View File

@@ -65,15 +65,18 @@ usage (int status)
stdout); stdout);
fputs (_("\ fputs (_("\
-f, --canonicalize canonicalize by following every symlink in\n\ -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\ all but the last component must exist\n\
-e, --canonicalize-existing canonicalize by following every symlink in\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\ all components must exist\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
-m, --canonicalize-missing canonicalize by following every symlink in\n\ -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\ without requirements on components existence\n\
-n, --no-newline do not output the trailing newline\n\ -n, --no-newline do not output the trailing newline\n\
-q, --quiet,\n\ -q, --quiet,\n\

View File

@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ 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 <config.h>
#include <stdio.h> #include <stdio.h>

View File

@@ -171,7 +171,8 @@ Remove the DIRECTORY(ies), if they are empty.\n\
is non-empty\n\ is non-empty\n\
"), stdout); "), stdout);
fputs (_("\ 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\ similar to `rmdir a/b/c a/b a'\n\
-v, --verbose output a diagnostic for every directory processed\n\ -v, --verbose output a diagnostic for every directory processed\n\
"), stdout); "), stdout);

View File

@@ -54,7 +54,8 @@ Usage: %s [SHORT-OPTION]... USER COMMAND [ARGUMENT]...\n\
program_name, program_name); program_name, program_name);
fputs (_("\ 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\ 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\ Exit with status 111 if unable to assume the required user and group ID.\n\
Otherwise, exit with the exit status of COMMAND.\n\ Otherwise, exit with the exit status of COMMAND.\n\

View File

@@ -400,7 +400,8 @@ Ordering options:\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
-b, --ignore-leading-blanks ignore leading blanks\n\ -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\ -f, --ignore-case fold lower case to upper case characters\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@@ -419,7 +420,8 @@ Ordering options:\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
--sort=WORD sort according to WORD:\n\ --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\ numeric -n, random -R, version -V\n\
-V, --version-sort natural sort of (version) numbers within text\n\ -V, --version-sort natural sort of (version) numbers within text\n\
\n\ \n\
@@ -434,7 +436,8 @@ Other options:\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
-c, --check, --check=diagnose-first check for sorted input; do not sort\n\ -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\ --compress-program=PROG compress temporaries with PROG;\n\
decompress them with PROG -d\n\ decompress them with PROG -d\n\
"), stdout); "), stdout);
@@ -452,7 +455,8 @@ Other options:\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
-o, --output=FILE write result to FILE instead of standard output\n\ -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\ -S, --buffer-size=SIZE use SIZE for main memory buffer\n\
"), stdout); "), stdout);
printf (_("\ printf (_("\
@@ -461,7 +465,8 @@ Other options:\n\
multiple options specify multiple directories\n\ multiple options specify multiple directories\n\
--parallel=N change the number of sorts run concurrently to N\n\ --parallel=N change the number of sorts run concurrently to N\n\
-u, --unique with -c, check for strict ordering;\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); "), DEFAULT_TMPDIR);
fputs (_("\ fputs (_("\
-z, --zero-terminated end lines with 0 byte, not newline\n\ -z, --zero-terminated end lines with 0 byte, not newline\n\
@@ -471,8 +476,10 @@ Other options:\n\
fputs (_("\ fputs (_("\
\n\ \n\
POS is F[.C][OPTS], where F is the field number and C the character position\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 the field; both are origin 1. If neither -t nor -b is in effect, characters\
in a field are counted from the beginning of the preceding whitespace. OPTS is\n\ \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\ 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\ options for that key. If no key is given, use the entire line as the key.\n\
\n\ \n\
@@ -4481,8 +4488,8 @@ main (int argc, char **argv)
else if (files[i][0] == '\0') else if (files[i][0] == '\0')
{ {
/* Using the standard `filename:line-number:' prefix here is /* Using the standard `filename:line-number:' prefix here is
not totally appropriate, since NUL is the separator, not NL, not totally appropriate, since NUL is the separator,
but it might be better than nothing. */ not NL, but it might be better than nothing. */
unsigned long int file_number = i + 1; unsigned long int file_number = i + 1;
error (SORT_FAILURE, 0, error (SORT_FAILURE, 0,
_("%s:%lu: invalid zero-length file name"), _("%s:%lu: invalid zero-length file name"),

View File

@@ -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 must continue to watch the file. It's only when following
by file descriptor that we must remove the watch. */ by file descriptor that we must remove the watch. */
if ((ev->mask & IN_DELETE_SELF) 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); inotify_rm_watch (wd, fspec->wd);
hash_delete (wd_to_name, fspec); hash_delete (wd_to_name, fspec);

View File

@@ -132,9 +132,11 @@ touch (const char *file)
else if (! (no_create || no_dereference)) else if (! (no_create || no_dereference))
{ {
/* Try to open FILE, creating it if necessary. */ /* 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, fd = fd_reopen (STDIN_FILENO, file,
O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY, 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 /* 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 touch to give a bogus diagnostic for e.g., `touch /' (assuming

View File

@@ -67,7 +67,7 @@ defined $ENV{DJDIR}
# {ERR => ...} # {ERR => ...}
# Same as for OUT, but compare with stderr, not stdout. # Same as for OUT, but compare with stderr, not stdout.
# {OUT_SUBST => 's/variable_output/expected_output/'} # {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 # 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 # 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. # 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}; my $out_file = $actual{$eo};
open IN, $out_file 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; $fail = 1, next;
$actual_data{$eo} = <IN>; $actual_data{$eo} = <IN>;
close IN close IN

View File

@@ -71,8 +71,8 @@ case $mode in
# a $g2 process can maintain an open file descriptor to the # a $g2 process can maintain an open file descriptor to the
# destination, but it's safer anyway. # destination, but it's safer anyway.
-rw-r-----*) -rw-r-----*)
# If the file has group $g1 and is group-readable, that is definitely # If the file has group $g1 and is group-readable, that is definitely bogus,
# bogus, as neither the source nor the destination was readable to group $g1. # as neither the source nor the destination was readable to group $g1.
test "$group" = "$g1" && fail=1;; test "$group" = "$g1" && fail=1;;
*) fail=1;; *) fail=1;;

View File

@@ -55,9 +55,13 @@ for u in 31 37 2; do
;; ;;
cp:*:no) cp:*:no)
test $u = 37 && test $u = 37 &&
expected_perms=`echo $expected_perms|sed 's/.....$/-----/'` expected_perms=`
echo $expected_perms | sed 's/.....$/-----/'
`
test $u = 31 && test $u = 31 &&
expected_perms=`echo $expected_perms|sed 's/..\(..\).$/--\1-/'` expected_perms=`
echo $expected_perms | sed 's/..\(..\).$/--\1-/'
`
;; ;;
esac esac
test _$actual_perms = _$expected_perms || exit 1 test _$actual_perms = _$expected_perms || exit 1

View File

@@ -60,9 +60,24 @@ t1() {
"$nameless_uid" "$@" "$nameless_uid" "$@"
} }
nameless_uid=`$PERL -le 'foreach my $i (1000..16*1024-1) { getpwuid $i or (print $i), exit }'` nameless_uid=`$PERL -le '
nameless_gid1=`$PERL -le 'foreach my $i (1000..16*1024) { getgrgid $i or (print $i), exit }'` foreach my $i (1000..16*1024-1)
nameless_gid2=`$PERL -le 'foreach my $i ('"$nameless_gid1"'+1..16*1024) { getgrgid $i or (print $i), exit }'` {
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" \ if test -z "$nameless_uid" \
|| test -z "$nameless_gid1" \ || test -z "$nameless_gid1" \

View File

@@ -40,7 +40,8 @@ esac
min_kb=3000000 min_kb=3000000
test $min_kb -lt $free_kb || 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 big=big

View File

@@ -47,7 +47,9 @@ dir=`printf '%200s\n' ' '|tr ' ' x`
# cd $tmp || framework_failure # cd $tmp || framework_failure
# Sheesh. Bash 3.1.5 can't create this hierarchy. I get # 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` cwd=`pwd`
# Use perl instead: # Use perl instead:

View File

@@ -111,7 +111,7 @@ fi
# Eval this code in a subshell to determine a shell's suitability. # Eval this code in a subshell to determine a shell's suitability.
# 10 - passes all tests; ok to use # 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 # ? - not ok
gl_shell_test_script_=' gl_shell_test_script_='
test $(echo y) = y || exit 1 test $(echo y) = y || exit 1
@@ -414,7 +414,8 @@ mktempd_()
case $template_ in case $template_ in
*XXXX) ;; *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 esac
# First, try to use mktemp. # First, try to use mktemp.

View File

@@ -74,7 +74,10 @@ test -d newdir3 || fail=1
# hence cannot do anything meaningful with the following relative-named dirs. # hence cannot do anything meaningful with the following relative-named dirs.
iwd=`pwd` iwd=`pwd`
mkdir sub || fail=1 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 chmod 755 sub
# Ensure that the first argument-dir has been created. # Ensure that the first argument-dir has been created.

View File

@@ -24,7 +24,9 @@ print_ver_ ls
require_root_ 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 if test x$nameless_uid = x; then
skip_test_ "couldn't find a nameless UID" skip_test_ "couldn't find a nameless UID"

View File

@@ -22,7 +22,8 @@ print_ver_ ls
# We use --local here so as to not activate # We use --local here so as to not activate
# potentially very many remote mounts. # potentially very many remote mounts.
mount_points=$(df --local -P 2>&1 | sed -n 's,.*[0-9]% \(/.\),\1,p') 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 # 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: # let us list just that entry using readdir data from its parent:

View File

@@ -28,12 +28,17 @@ test $(chroot / whoami) = root || fail=1
test "$(groups)" = "$(chroot / groups)" || fail=1 test "$(groups)" = "$(chroot / groups)" || fail=1
# Verify that credentials are changed correctly. # Verify that credentials are changed correctly.
test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami)" != root \ whoami_after_chroot=$(
|| fail=1 chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami
)
test "$whoami_after_chroot" != root || fail=1
# Verify that there are no additional groups. # Verify that there are no additional groups.
test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP --groups=$NON_ROOT_GROUP / id -G)"\ id_G_after_chroot=$(
= $NON_ROOT_GROUP || fail=1 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 # Verify that when specifying only the user name we get the current
# primary group ID. # primary group ID.

View File

@@ -87,7 +87,8 @@ my @Tests =
. "\tonly when operating on fields\n$try"}], . "\tonly when operating on fields\n$try"}],
# You must specify bytes or fields (or chars) # You must specify bytes or fields (or chars)
['z', '', {IN=>":\n"}, {OUT=>""}, {EXIT=>1}, ['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 field list
['empty-fl', qw(-f ''), {IN=>":\n"}, {OUT=>""}, {EXIT=>1}, {ERR=>$from_1}], ['empty-fl', qw(-f ''), {IN=>":\n"}, {OUT=>""}, {EXIT=>1}, {ERR=>$from_1}],
# Missing field list # Missing field list
@@ -124,7 +125,7 @@ my @Tests =
['out-delim3a', '-c1-3,2-4,6-', '--output-d=:', {IN=>"abcdefg\n"}, ['out-delim3a', '-c1-3,2-4,6-', '--output-d=:', {IN=>"abcdefg\n"},
{OUT=>"abcd:fg\n"}], {OUT=>"abcd:fg\n"}],
# Ensure that the following two commands produce the same output. # 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=:', ['out-delim4', '-c4-,2-3', '--output-d=:',
{IN=>"abcdefg\n"}, {OUT=>"bc:defg\n"}], {IN=>"abcdefg\n"}, {OUT=>"bc:defg\n"}],
['out-delim5', '-c2-3,4-', '--output-d=:', ['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-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-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-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. # None of the following invalid ranges provoked an error up to coreutils-6.9.
['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1}, ['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1},
{ERR=>"$prog: invalid decreasing range\n$try"}], {ERR=>"$prog: invalid decreasing range\n$try"}],
['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval3', '-f', '4,-', {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}], ['inval5', '-f', '1-,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
['inval6', '-f', '-1,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval6', '-f', '-1,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
); );

View File

@@ -230,7 +230,8 @@ my @Tests =
['tz-5wf', '+%:8z', {OUT=>"%:8z"}, {ENV=>'TZ=XXX0:01'}], ['tz-5wf', '+%:8z', {OUT=>"%:8z"}, {ENV=>'TZ=XXX0:01'}],
['ns-relative', ['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"}], {OUT=>"2000-06-15T09:43:58,111111021+0000"}],
['ns-relativer', '--rfc-3339=ns', ['ns-relativer', '--rfc-3339=ns',
"-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'", "-d'1970-01-01 00:00:00.1234567 UTC +961062237.987654321 sec'",

View File

@@ -216,7 +216,8 @@ my @tv = (
# '--header' always outputs headers from the first file # '--header' always outputs headers from the first file
# even if the headers from the second file don't match # even if the headers from the second file don't match
['header-5', '--header', ['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],
); );

View File

@@ -60,7 +60,8 @@ my @Tests =
['check-bsd3', '--check', '--status', ['check-bsd3', '--check', '--status',
{IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}}, {IN=> {'f.sha1' => "SHA1 (f) = $sha_degenerate\n"}},
{AUX=> {f=> 'bar'}}, {EXIT=> 1}], {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=> ''}}, {AUX=> {f=> ''}},
{ERR=>"sha1sum: f.md5: no properly formatted " {ERR=>"sha1sum: f.md5: no properly formatted "
. "SHA1 checksum lines found\n"}, . "SHA1 checksum lines found\n"},

View File

@@ -55,8 +55,11 @@ my @Tests =
["n11b", '-s -n -k1,1', {IN=>".010\n.01a\n"}, {OUT=>".010\n.01a\n"}], ["n11b", '-s -n -k1,1', {IN=>".010\n.01a\n"}, {OUT=>".010\n.01a\n"}],
# human readable suffixes # 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"}, ["h1", '-h',
{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"}], {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"}], ["h2", '-h', {IN=>"1M\n-2G\n-3K"}, {OUT=>"-2G\n-3K\n1M\n"}],
# check that it works with powers of 1024 # 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"}], ["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 # of memcmp in the Next C library. With optimization, gcc uses its
# (working) builtin version. Test case form William Lewis. # (working) builtin version. Test case form William Lewis.
["20a", '', ["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"}, {IN=>"_________U__free\n_________U__malloc\n_________U__abort\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"}], . "_________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 _ # Demonstrate that folding changes the ordering of e.g. A, a, and _
# because while they normally (in the C locale) collate like A, _, a, # because while they normally (in the C locale) collate like A, _, a,

View File

@@ -33,7 +33,8 @@ done
exec 0</dev/null 3<&- 4<&- 5<&- exec 0</dev/null 3<&- 4<&- 5<&-
sort -n -m __test.* > out 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 echo 32 | tee -a in > in1
( (

View File

@@ -80,7 +80,7 @@ my @Tests =
['2a', '--files0-from=-', '<', ['2a', '--files0-from=-', '<',
{IN=>{f=>"g\0g\0"}}, {AUX=>{g=>'a'}}, {OUT=>"a\na\n"} ], {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 # Note that the behavior here differs from `wc' in that the
# first zero-length file name is treated as fatal, so there # first zero-length file name is treated as fatal, so there
# should be no output on STDOUT. # should be no output on STDOUT.

View File

@@ -40,11 +40,13 @@ if (locale --version) > /dev/null 2>&1; then
LC_ALL=$locale sort --random-sort in > out2 || fail=1 LC_ALL=$locale sort --random-sort in > out2 || fail=1
# Fail if the output "randomly" is the same twice in a row. # 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. # Fail if the sorted output is not the same as the input.
sort -n out > out1 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 fi
Exit $fail Exit $fail

View File

@@ -22,7 +22,8 @@ print_ver_ stdbuf mv
getlimits_ getlimits_
require_built_ stdbuf 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=' lf='
' '
case $abs_top_builddir in case $abs_top_builddir in

View File

@@ -54,7 +54,8 @@ my @Tests =
['i', qw(-d '[:xdigit:]'), {IN=>'w0x1y2z3456789acbdefABCDEFz'}, ['i', qw(-d '[:xdigit:]'), {IN=>'w0x1y2z3456789acbdefABCDEFz'},
{OUT=>'wxyzz'}], {OUT=>'wxyzz'}],
['j', qw(-d '[:digit:]'), {IN=>'0123456789'}, {OUT=>''}], ['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=>''}], ['l', qw(-d '[:lower:]'), {IN=>'abcdefghijklmnopqrstuvwxyz'}, {OUT=>''}],
['m', qw(-d '[:upper:]'), {IN=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {OUT=>''}], ['m', qw(-d '[:upper:]'), {IN=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}, {OUT=>''}],
['n', qw(-d '[:lower:][:upper:]'), ['n', qw(-d '[:lower:][:upper:]'),
@@ -83,11 +84,13 @@ my @Tests =
['u', qw(-ds b a), {IN=>'aabbaa'}, {OUT=>'a'}], ['u', qw(-ds b a), {IN=>'aabbaa'}, {OUT=>'a'}],
['v', qw(-ds '[:xdigit:]' Z), {IN=>'ZZ0123456789acbdefABCDEFZZ'}, {OUT=>'Z'}], ['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'), ['w', qw(-ds '\350' '\345'),
{IN=>"\300\301\377\345\345\350\345"}, {IN=>"\300\301\377\345\345\350\345"},
{OUT=>"\300\301\377\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=>' $'}], ['y', qw(-d a-z), {IN=>'abc $code'}, {OUT=>' $'}],
['z', qw(-ds a-z '$.'), {IN=>'a.b.c $$$$code\\'}, {OUT=>'. $\\'}], ['z', qw(-ds a-z '$.'), {IN=>'a.b.c $$$$code\\'}, {OUT=>'. $\\'}],

View File

@@ -180,10 +180,13 @@ my @Tests =
"$prog: printing all duplicated lines and repeat counts is meaningless\n$try"} "$prog: printing all duplicated lines and repeat counts is meaningless\n$try"}
], ],
['113', '--all-repeated=separate', {IN=>"a\na\n"}, {OUT=>"a\na\n"}], ['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"}], ['114', '--all-repeated=separate',
['115', '--all-repeated=separate', {IN=>"a\na\nb\nb\nc\n"}, {OUT=>"a\na\n\nb\nb\n"}], {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"}], ['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=>""}], ['118', '--all-repeated=prepend', {IN=>"a\nb\n"}, {OUT=>""}],
['119', '--all-repeated=badoption', {IN=>"a\n"}, {OUT=>""}, {EXIT=>1}, ['119', '--all-repeated=badoption', {IN=>"a\n"}, {OUT=>""}, {EXIT=>1},
{ERR=>"$prog: invalid argument \`badoption' for \`--all-repeated'\n" {ERR=>"$prog: invalid argument \`badoption' for \`--all-repeated'\n"

View File

@@ -21,11 +21,13 @@ print_ver_ mv
require_strace_ unlink require_strace_ unlink
# Before the fix, mv would unnecessarily unlink the destination symlink: # 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 # unlink("s2") = 0
# #
# With the fix, it doesn't call unlink: # 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 ln -s t1 s1 || framework_failure

View File

@@ -30,9 +30,10 @@ chmod u-w "$other_partition_tmpdir" || framework_failure
mv -f k "$other_partition_tmpdir" 2> out && fail=1 mv -f k "$other_partition_tmpdir" 2> out && fail=1
cat <<EOF > exp printf \
mv: inter-device move failed: \`k' to \`$other_partition_tmpdir/k'; unable to remove target: Permission denied 'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
EOF ' unable to remove target: Permission denied\n' \
k "$other_partition_tmpdir/k" >exp
# On some (less-compliant) systems, we get EPERM in this case. # On some (less-compliant) systems, we get EPERM in this case.
# Accept either diagnostic. # Accept either diagnostic.

View File

@@ -93,8 +93,9 @@ for copy in cp mv; do
# and put brackets around the output. # and put brackets around the output.
test -s .err && { test -s .err && {
echo ' [' | tr -d '\n' echo ' [' | tr -d '\n'
sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err |
echo ']' | tr -d '\n' tr -d '\n'
echo ']'
} }
# Strip off all but the file names. # Strip off all but the file names.
# Remove any site-dependent part of each file name. # Remove any site-dependent part of each file name.
@@ -110,7 +111,7 @@ for copy in cp mv; do
-e "s,$other_partition_tmpdir/,," \ -e "s,$other_partition_tmpdir/,," \
-e "s,$pwd_tmp/,," \ -e "s,$pwd_tmp/,," \
-e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'` -e 's/^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'`
echo "($ls) ($ls2)" echo " ("$ls") ("$ls2")"
# If the command failed, then it must not have changed the files. # If the command failed, then it must not have changed the files.
if test $copy_status != 0; then if test $copy_status != 0; then
@@ -134,15 +135,14 @@ for copy in cp mv; do
fi fi
case "`cat $f`" in case "`cat $f`" in
"$contents") ;; "$contents") ;;
*) echo $copy FAILED;; *) echo " $copy FAILED";;
esac esac
else else
echo symlink-loop echo " symlink-loop"
fi fi
done done
fi fi
) | tr '\n' ' ' )
echo
) | sed 's/ *$//' ) | sed 's/ *$//'
cd .. cd ..
done done
@@ -154,49 +154,107 @@ test $fail = 1 &&
{ (exit 1); exit; } { (exit 1); exit; }
cat <<\EOF > $expected 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) 1 cp loc_reg rem_sl
0 cp --rem loc_reg rem_sl (loc_reg) (rem_sl) [cp: `loc_reg' and `rem_sl' are the same file]
0 cp --rem -d loc_reg rem_sl (loc_reg) (rem_sl) (loc_reg) (rem_sl -> dir/loc_reg)
0 cp --rem -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) 0 cp --rem loc_reg rem_sl
0 cp -b loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) (loc_reg) (rem_sl)
0 cp -bd loc_reg rem_sl (loc_reg) (rem_sl rem_sl~ -> dir/loc_reg) 0 cp --rem -d loc_reg rem_sl
1 cp -d loc_reg rem_sl [cp: `loc_reg' and `rem_sl' are the same file ](loc_reg) (rem_sl -> dir/loc_reg) (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_sl 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) [cp: `rem_sl' and `loc_reg' are the same file]
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) (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 --rem rem_sl 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) [cp: `rem_sl' and `loc_reg' are the same file]
0 cp -bd rem_sl loc_reg (loc_reg -> dir/loc_reg loc_reg~) (rem_sl -> dir/loc_reg) symlink-loop symlink-loop (loc_reg) (rem_sl -> dir/loc_reg)
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 --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 loc_sl 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) [cp: `loc_sl' and `rem_reg' are the same file]
1 cp --rem -d loc_sl rem_reg [cp: `loc_sl' and `rem_reg' are the same file ](loc_sl -> rem_reg) (rem_reg) (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 --rem loc_sl 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) [cp: `loc_sl' and `rem_reg' are the same file]
0 cp -bd loc_sl rem_reg (loc_sl -> rem_reg) (rem_reg -> rem_reg rem_reg~) symlink-loop symlink-loop (loc_sl -> rem_reg) (rem_reg)
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 -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) 1 cp rem_reg loc_sl
0 cp --rem rem_reg loc_sl (loc_sl) (rem_reg) [cp: `rem_reg' and `loc_sl' are the same file]
0 cp --rem -d rem_reg loc_sl (loc_sl) (rem_reg) (loc_sl -> rem_reg) (rem_reg)
0 cp --rem -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg) 0 cp --rem rem_reg loc_sl
0 cp -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg) (loc_sl) (rem_reg)
0 cp -bd rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) (rem_reg) 0 cp --rem -d rem_reg loc_sl
1 cp -d rem_reg loc_sl [cp: `rem_reg' and `loc_sl' are the same file ](loc_sl -> rem_reg) (rem_reg) (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 loc_reg rem_sl
0 mv -b loc_reg rem_sl () (rem_sl rem_sl~ -> dir/loc_reg) () (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) 1 mv rem_sl loc_reg
0 mv -b rem_sl loc_reg (loc_reg -> dir/loc_reg 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) 1 mv loc_sl rem_reg
0 mv -b loc_sl rem_reg () (rem_reg -> rem_reg 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 rem_reg loc_sl
0 mv -b rem_reg loc_sl (loc_sl loc_sl~ -> rem_reg) () (loc_sl) ()
0 mv -b rem_reg loc_sl
(loc_sl loc_sl~ -> rem_reg) ()
EOF EOF

View File

@@ -41,7 +41,10 @@ chmod go+x . || framework_failure
# Ensure that $NON_ROOT_USERNAME can access the required version of mv. # 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 case $version in
$PACKAGE_VERSION) ;; $PACKAGE_VERSION) ;;
*) echo "$0: cannot access just-built mv as user $NON_ROOT_USERNAME" 1>&2 *) echo "$0: cannot access just-built mv as user $NON_ROOT_USERNAME" 1>&2

View File

@@ -256,8 +256,10 @@ my @tv = (
['10md', '-J -m -l 24 -f', [\'tFFt-lm', \'loli'], [\'Jml24f-lm-lo'], 0], ['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], ['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], ['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], ['10mg', '-n.3 -J -m -l 24 -f', [\'tFFt-lm', \'tFFt-lm', \'loli'],
['10mh', '-n.3 -J -m -l 24 -f', [\'tFFt-lm', \'loli', \'tFFt-lm'], [\'nJml24f-lmlolm'], 0], [\'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], ['10aa', '-a -3 -l 24 -f', [\'tFFt-lm'], [\'a3l24f-lm'], 0],
['10ab', '-W 35 -a -3 -l 24 -f', [\'tFFt-lm'], [\'W35a3l24f-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], ['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], ['10bd', '-W 35 -J -b -3 -l 24 -f', [\'tFFt-lm'], [\'W35Jb3l24f-lm'], 0],
# #
# merge files (-m option) use separator string (-S option) # merge files (-m option) use separator string (-S option)
['11sa', '-n.3 -S:--: -m -l 20 -f', [\'tFFt-bl', \'FnFn'], [\'nSml20-bl-FF'], 0], ['11sa', '-n.3 -S:--: -m -l 20 -f', [\'tFFt-bl', \'FnFn'],
['11sb', '-n.3 -S:--: -m -l 24 -f', [\'tFFt-bl', \'FnFn'], [\'nSml24-bl-FF'], 0], [\'nSml20-bl-FF'], 0],
['11se', '-n.3 -S:--: -m -l 20 -f', [\'tn', \'tn', \'FnFn'], [\'nSml20-t-t-FF'], 0], ['11sb', '-n.3 -S:--: -m -l 24 -f', [\'tFFt-bl', \'FnFn'],
['11sf', '-n.3 -S:--: -m -l 24 -f', [\'tn', \'tn', \'FnFn'], [\'nSml24-t-t-FF'], 0], [\'nSml24-bl-FF'], 0],
['11sg', '-n.3 -S:--: -m -l 20 -f', [\'tn', \'tn', \'FnFn', \'FnFn'], [\'nSml20-t-tFFFF'], 0], ['11se', '-n.3 -S:--: -m -l 20 -f', [\'tn', \'tn', \'FnFn'],
['11sh', '-n.3 -S:--: -m -l 24 -f', [\'tn', \'tn', \'FnFn', \'FnFn'], [\'nSml24-t-tFFFF'], 0], [\'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) # left margin (-o option) and separator string (-S option)
['12aa', '-o3 -a -3 -l24 -f', [\'tn'], [\'o3a3l24f-tn'], 0], ['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], ['12bc', '-o3 -b -3 -S:--: -n. -l24 -f', [\'tn'], [\'o3b3Snl24f-tn'], 0],
['12ma', '-o3 -m -l24 -f', [\'tFFt-bl', \'tn'], [\'o3ml24f-bl-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], ['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], ['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; # 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], ['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; # 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; # line number overflow not allowed: cut off leading digits;
# don't adapt other UNIXes, no real standard to follow, a consequent # don't adapt other UNIXes, no real standard to follow, a consequent
# programming of column handling may change the GNU pr concept. # 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-a', '-tn2 -N98', "y\ny\ny\ny\ny\n",
['ncut-b', '-tn:2 -N98', "y\ny\ny\ny\ny\n", "98:y\n99:y\n00:y\n01:y\n02:y\n", 0], "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], ['margin-0', '-o 0', '', '', 0],
# BUG fixed: that leading space on 3rd line of output should not be there # 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. # This test failed with 1.22e and earlier.
['dbl-sp-b', '-d -t', "1\n2\n", "1\n\n2\n\n", 0], ['dbl-sp-b', '-d -t', "1\n2\n", "1\n\n2\n\n", 0],

View File

@@ -31,7 +31,10 @@ touch a/b || framework_failure
# Try to ensure that $NON_ROOT_USERNAME can access # Try to ensure that $NON_ROOT_USERNAME can access
# the required version of rm. # 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 case $rm_version in
$PACKAGE_VERSION) ;; $PACKAGE_VERSION) ;;
*) skip_test_ "cannot access just-built rm as user $NON_ROOT_USERNAME";; *) skip_test_ "cannot access just-built rm as user $NON_ROOT_USERNAME";;

View File

@@ -68,15 +68,15 @@ test -f file4-1 || fail=1
cat <<\EOF > expout || fail=1 cat <<\EOF > expout || fail=1
EOF EOF
cat <<\EOF > experr || fail=1 sed 's/@remove_empty/rm: remove regular empty file/g' <<\EOF > experr || fail=1
no WHEN 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=never
. .
WHEN=once WHEN=once
rm: remove all arguments recursively? . rm: remove all arguments recursively? .
WHEN=always 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 -f overrides --interactive
. .
--interactive overrides -f --interactive overrides -f