mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
518b92a5e3 | ||
|
|
b795e60844 | ||
|
|
887d530e62 | ||
|
|
51f60a6237 | ||
|
|
056caf4857 | ||
|
|
a300cfd43c | ||
|
|
7ca55ef3d1 | ||
|
|
960fc61624 | ||
|
|
41159f9604 | ||
|
|
4a423bedea | ||
|
|
5947491895 | ||
|
|
0eaa993ae6 | ||
|
|
e66948c3b5 | ||
|
|
0e181024c0 | ||
|
|
eea8e7530b | ||
|
|
6d488ca041 | ||
|
|
c67a96c4c1 | ||
|
|
561f8be2c9 | ||
|
|
8e81a99c26 | ||
|
|
1b31ce6982 | ||
|
|
f3c584d1e0 | ||
|
|
33a5de5a0e | ||
|
|
14ad7a2550 | ||
|
|
8f40ed634c | ||
|
|
dcb3f60d0a | ||
|
|
0da4d84300 | ||
|
|
6d36bd4c64 | ||
|
|
0c70708db7 | ||
|
|
8351407f87 | ||
|
|
b212633c41 | ||
|
|
45ff91af2e | ||
|
|
ad61335bf8 | ||
|
|
9a9d69e9e4 | ||
|
|
27e997d0eb | ||
|
|
c9db0ac6de | ||
|
|
d1f7003556 | ||
|
|
621876ff44 | ||
|
|
195c455d0a | ||
|
|
a1629ba1ec | ||
|
|
231d8719f1 | ||
|
|
cd00fa6ee1 | ||
|
|
fb282c7b30 | ||
|
|
fb41e82c77 | ||
|
|
f2d977aff1 | ||
|
|
6f4279421d | ||
|
|
f35f4b3396 | ||
|
|
eb989f4b75 | ||
|
|
b6ef652e50 | ||
|
|
b5a25a996d | ||
|
|
038fcfcf1b | ||
|
|
0ec869e8be | ||
|
|
a5207bb139 | ||
|
|
3afda5f007 | ||
|
|
43d1112d01 | ||
|
|
fbb47bf424 | ||
|
|
b8cd747cc8 | ||
|
|
67f7ed3e3a | ||
|
|
013d95af11 | ||
|
|
be107398e5 | ||
|
|
dadca988af | ||
|
|
c2bdd17856 | ||
|
|
a71c22fdf0 | ||
|
|
cf90729e09 | ||
|
|
c1b41c5c3b | ||
|
|
ae5cfc9f12 | ||
|
|
8f9be76b0d | ||
|
|
a8c8484ee1 | ||
|
|
293c37b906 | ||
|
|
5c0275e953 | ||
|
|
11d3389f5a | ||
|
|
fbcc100f5b | ||
|
|
ff7f0ff85c | ||
|
|
f38becab02 | ||
|
|
30b74dfff1 | ||
|
|
01a27b9054 | ||
|
|
79adacc431 | ||
|
|
9ad13ad14a | ||
|
|
c8d570c2b3 | ||
|
|
0d1ba34494 | ||
|
|
f9cfda6ad2 | ||
|
|
b19733bb42 | ||
|
|
f70c7b785b | ||
|
|
ee6f187b18 |
2
.mailmap
2
.mailmap
@@ -8,3 +8,5 @@ Paul R. Eggert <eggert@cs.ucla.edu> <eggert@CS.UCLA.EDU>
|
||||
Evan Hunt <ethanol@armory.com> Evan Hunt <jim@meyering.net>
|
||||
<P@draigBrady.com> <P@draigBrady.com (trivial change)>
|
||||
Pádraig Brady <p@draigbrady.com> <p@draigBrady.com>
|
||||
<chen.guo.0625@gmail.com> <chenguo4@yahoo.com>
|
||||
<chen.guo.0625@gmail.com> <chenguo4@ucla.edu>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.6
|
||||
8.7
|
||||
|
||||
46
NEWS
46
NEWS
@@ -1,5 +1,43 @@
|
||||
GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release 8.8 (2010-12-22) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
cp -u no longer does unnecessary copying merely because the source
|
||||
has finer-grained time stamps than the destination.
|
||||
|
||||
od now prints floating-point numbers without losing information, and
|
||||
it no longer omits spaces between floating-point columns in some cases.
|
||||
|
||||
sort -u with at least two threads could attempt to read through a
|
||||
corrupted pointer. [bug introduced in coreutils-8.6]
|
||||
|
||||
sort with at least two threads and with blocked output would busy-loop
|
||||
(spinlock) all threads, often using 100% of available CPU cycles to
|
||||
do no work. I.e., "sort < big-file | less" could waste a lot of power.
|
||||
[bug introduced in coreutils-8.6]
|
||||
|
||||
sort with at least two threads no longer segfaults due to use of pointers
|
||||
into the stack of an expired thread. [bug introduced in coreutils-8.6]
|
||||
|
||||
sort --compress no longer mishandles subprocesses' exit statuses,
|
||||
no longer hangs indefinitely due to a bug in waiting for subprocesses,
|
||||
and no longer generates many more than NMERGE subprocesses.
|
||||
|
||||
sort -m -o f f ... f no longer dumps core when file descriptors are limited.
|
||||
|
||||
** Changes in behavior
|
||||
|
||||
sort will not create more than 8 threads by default due to diminishing
|
||||
performance gains. Also the --parallel option is no longer restricted
|
||||
to the number of available processors.
|
||||
|
||||
** New features
|
||||
|
||||
split accepts the --number option to generate a specific number of files.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.7 (2010-11-13) [stable]
|
||||
|
||||
** Bug fixes
|
||||
@@ -23,10 +61,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
stat's %X, %Y, and %Z directives once again print only the integer
|
||||
part of seconds since the epoch. This reverts a change from
|
||||
coreutils-8.6, that was deemed unnecessarily disruptive. To obtain
|
||||
a nanosecond-precision floating point time stamp for %X use %.X;
|
||||
if you want (say) just 3 fractional digits, use %.3X. Likewise
|
||||
for %Y and %Z.
|
||||
coreutils-8.6, that was deemed unnecessarily disruptive.
|
||||
To obtain a nanosecond-precision time stamp for %X use %.X;
|
||||
if you want (say) just 3 fractional digits, use %.3X.
|
||||
Likewise for %Y and %Z.
|
||||
|
||||
stat's new %W format directive would print floating point seconds.
|
||||
However, with the above change to %X, %Y and %Z, we've made %W work
|
||||
|
||||
@@ -16,26 +16,34 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
# Convert Makefile.am files:
|
||||
# find tests -name Makefile.am | xargs grep -wl PATH|xargs perl -pi -e \
|
||||
# 's,src(\$\(PATH_SEPARATOR\)\$\$PATH),src/vg$1,'
|
||||
# find tests -name check.mk | xargs grep -wl PATH |
|
||||
# xargs perl -pi -e 's,src(\$\(PATH_SEPARATOR\)),src/vg$1,'
|
||||
# To restore:
|
||||
# find tests -name Makefile.am|xargs grep -wl PATH|xargs perl -pi -e 's,src/vg,src,'
|
||||
# find tests -name check.mk | xargs grep -wl PATH |
|
||||
# xargs perl -pi -e 's,src/vg,src,'
|
||||
#
|
||||
# Create this symlink for suppressions (this is no longer necessary,
|
||||
# with Linux kernel 2.6.9 and valgrind-2.2.0):
|
||||
# ln -s $PWD/.vg-suppressions /tmp/cu-vg
|
||||
|
||||
|
||||
# Create src/vg:
|
||||
|
||||
coreutils=$(echo 'spy:;@echo $(all_programs)' | (cd src; make -f Makefile -f - spy | tr -s '\n ' ' '))
|
||||
coreutils=$(echo 'spy:;@echo $(all_programs) $(noinst_PROGRAMS)' |
|
||||
(cd src; make -f Makefile -f - spy | tr -s '\n ' ' '))
|
||||
mkdir -p src/vg
|
||||
pwd=`pwd`
|
||||
srcdir=$pwd/src
|
||||
_path='export PATH='$srcdir':${PATH#*:}'
|
||||
pre='#!/bin/sh\n'"$_path"'\n'
|
||||
n=15
|
||||
vg='exec /usr/bin/valgrind --suppressions=/tmp/cu-vg --log-fd=3 --leak-check=yes --track-fds=yes --leak-check=full --num-callers='$n
|
||||
n=15 # stack trace depth
|
||||
log_fd=3 # One can redirect this to file like 3>vg.log
|
||||
test -e /tmp/cu-vg && suppressions='--supressions=/tmp/cu-vg'
|
||||
vg="exec /usr/bin/valgrind $suppressions --log-fd=$log_fd \
|
||||
--leak-check=yes --track-fds=yes --leak-check=full --num-callers=$n"
|
||||
cat <<EOF > src/vg/gen
|
||||
for i in $coreutils; do
|
||||
printf "$pre$vg -- \$i"' "\$@"\n' > \$i
|
||||
|
||||
3
THANKS
3
THANKS
@@ -62,6 +62,7 @@ Arnold Robbins arnold@skeeve.com
|
||||
Arthur Pool pool@commerce.uq.edu.au
|
||||
Arun Sharma arun.sharma@intel.com
|
||||
Arvind Autar Autar022@planet.nl
|
||||
Assaf Gordon assafgordon@gmail.com
|
||||
Augey Mikus mikus@dqc.org
|
||||
Aurelien Jarno aurel32@debian.org
|
||||
Austin Donnelly Austin.Donnelly@cl.cam.ac.uk
|
||||
@@ -105,6 +106,7 @@ Carlos Canau Carlos.Canau@relay.puug.pt
|
||||
Charles Karney karney@pppl.gov
|
||||
Charles Randall crandall@matchlogic.com
|
||||
Chas. Owens chas.owens@gmail.com
|
||||
Chen Guo chen.guo.0625@gmail.com
|
||||
Chip Salzenberg chip@valinux.com
|
||||
Chris Clayton chris2553@googlemail.com
|
||||
Chris Faylor cgf@cygnus.com
|
||||
@@ -362,6 +364,7 @@ M. P. Suzuki mpsuzuki@hiroshima-u.ac.jp
|
||||
Maciej Kwapulinski pikpok@univ.gda.pl
|
||||
Manas Garg manas@cygsoft.com
|
||||
Manfred Hollstein manfred@s-direktnet.de
|
||||
Марк Коренберг socketpair@gmail.com
|
||||
Marc Boucher marc@mbsi.ca
|
||||
Marc Haber mh+debian-bugs@zugschlus.de
|
||||
Marc Lehman schmorp@schmorp.de
|
||||
|
||||
@@ -88,6 +88,7 @@ gnulib_modules="
|
||||
fsusage
|
||||
fsync
|
||||
ftello
|
||||
ftoastr
|
||||
fts
|
||||
getgroups
|
||||
gethrxtime
|
||||
@@ -315,6 +316,7 @@ git 1.4.4
|
||||
gperf -
|
||||
gzip -
|
||||
makeinfo -
|
||||
patch -
|
||||
perl 5.5
|
||||
rsync -
|
||||
tar -
|
||||
|
||||
15
cfg.mk
15
cfg.mk
@@ -27,7 +27,7 @@ bootstrap-tools = autoconf,automake,gnulib,bison
|
||||
# Now that we have better tests, make this the default.
|
||||
export VERBOSE = yes
|
||||
|
||||
old_NEWS_hash = 594c508078596fb65a3db2c0f4437386
|
||||
old_NEWS_hash = e2a254a0d4c81397994ea10a15663ac3
|
||||
|
||||
# Add an exemption for sc_makefile_at_at_check.
|
||||
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
|
||||
@@ -164,6 +164,13 @@ sc_man_file_correlation:
|
||||
@$(MAKE) -s -C src all_programs
|
||||
@$(MAKE) -s -C man $@
|
||||
|
||||
# Ensure that the end of each release's section is marked by two empty lines.
|
||||
sc_NEWS_two_empty_lines:
|
||||
@sed -n 4,/Noteworthy/p $(srcdir)/NEWS \
|
||||
| perl -n0e '/(^|\n)\n\n\* Noteworthy/ or exit 1' \
|
||||
|| { echo '$(ME): use two empty lines to separate NEWS sections' \
|
||||
1>&2; exit 1; } || :; \
|
||||
|
||||
# Perl-based tests used to exec perl from a #!/bin/sh script.
|
||||
# Now they all start with #!/usr/bin/perl and the portability
|
||||
# infrastructure is in tests/Makefile.am. Make sure no old-style
|
||||
@@ -244,6 +251,12 @@ sc_prohibit_sleep:
|
||||
halt='prefer xnanosleep over other sleep interfaces' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Use print_ver_ (from init.cfg), not open-coded $VERBOSE check.
|
||||
sc_prohibit_verbose_version:
|
||||
@prohibit='test "\$$VERBOSE" = yes && .* --version' \
|
||||
halt='use the print_ver_ function instead...' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
###########################################################
|
||||
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
|
||||
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
|
||||
|
||||
@@ -98,7 +98,6 @@ if test "$gl_gcc_warnings" = yes; then
|
||||
done
|
||||
gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
|
||||
gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
|
||||
gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
|
||||
|
||||
# In spite of excluding -Wlogical-op above, it is enabled, as of
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
* shuf: (coreutils)shuf invocation. Shuffling text files.
|
||||
* sleep: (coreutils)sleep invocation. Delay for a specified time.
|
||||
* sort: (coreutils)sort invocation. Sort text files.
|
||||
* split: (coreutils)split invocation. Split into fixed-size pieces.
|
||||
* split: (coreutils)split invocation. Split into pieces.
|
||||
* stat: (coreutils)stat invocation. Report file(system) status.
|
||||
* stdbuf: (coreutils)stdbuf invocation. Modify stdio buffering.
|
||||
* stty: (coreutils)stty invocation. Print/change terminal settings.
|
||||
@@ -2624,7 +2624,7 @@ These commands output pieces of the input.
|
||||
@menu
|
||||
* head invocation:: Output the first part of files.
|
||||
* tail invocation:: Output the last part of files.
|
||||
* split invocation:: Split a file into fixed-size pieces.
|
||||
* split invocation:: Split a file into pieces.
|
||||
* csplit invocation:: Split a file into context-determined pieces.
|
||||
@end menu
|
||||
|
||||
@@ -2821,6 +2821,7 @@ Historical implementations of @command{tail} have required that
|
||||
@var{number} be an integer. However, GNU @command{tail} accepts
|
||||
an arbitrary floating point number (using a period before any
|
||||
fractional digits).
|
||||
When @command{tail} uses inotify, this polling-related option is ignored.
|
||||
|
||||
@itemx --pid=@var{pid}
|
||||
@opindex --pid
|
||||
@@ -2855,7 +2856,8 @@ still associated with the same device/inode-number pair as before.
|
||||
When following a log file that is rotated, this is approximately the
|
||||
number of seconds between when tail prints the last pre-rotation lines
|
||||
and when it prints the lines that have accumulated in the new log file.
|
||||
This option is meaningful only when following by name.
|
||||
This option is meaningful only when polling (i.e., without inotify)
|
||||
and when following by name.
|
||||
|
||||
@itemx -n @var{k}
|
||||
@itemx --lines=@var{k}
|
||||
@@ -2920,15 +2922,15 @@ mean either @samp{tail ./+4} or @samp{tail -n +4}.
|
||||
|
||||
|
||||
@node split invocation
|
||||
@section @command{split}: Split a file into fixed-size pieces
|
||||
@section @command{split}: Split a file into pieces.
|
||||
|
||||
@pindex split
|
||||
@cindex splitting a file into pieces
|
||||
@cindex pieces, splitting a file into
|
||||
|
||||
@command{split} creates output files containing consecutive sections of
|
||||
@var{input} (standard input if none is given or @var{input} is
|
||||
@samp{-}). Synopsis:
|
||||
@command{split} creates output files containing consecutive or interleaved
|
||||
sections of @var{input} (standard input if none is given or @var{input}
|
||||
is @samp{-}). Synopsis:
|
||||
|
||||
@example
|
||||
split [@var{option}] [@var{input} [@var{prefix}]]
|
||||
@@ -2941,10 +2943,9 @@ left over for the last section), into each output file.
|
||||
The output files' names consist of @var{prefix} (@samp{x} by default)
|
||||
followed by a group of characters (@samp{aa}, @samp{ab}, @dots{} by
|
||||
default), such that concatenating the output files in traditional
|
||||
sorted order by file name produces
|
||||
the original input file. If the output file names are exhausted,
|
||||
@command{split} reports an error without deleting the output files
|
||||
that it did create.
|
||||
sorted order by file name produces the original input file (except
|
||||
@option{-r}). If the output file names are exhausted, @command{split}
|
||||
reports an error without deleting the output files that it did create.
|
||||
|
||||
The program accepts the following options. Also see @ref{Common options}.
|
||||
|
||||
@@ -2976,6 +2977,41 @@ possible without exceeding @var{size} bytes. Individual lines longer than
|
||||
@var{size} bytes are broken into multiple files.
|
||||
@var{size} has the same format as for the @option{--bytes} option.
|
||||
|
||||
@item -n @var{chunks}
|
||||
@itemx --number=@var{chunks}
|
||||
@opindex -n
|
||||
@opindex --number
|
||||
|
||||
Split @var{input} to @var{chunks} output files where @var{chunks} may be:
|
||||
|
||||
@example
|
||||
@var{n} generate @var{n} files based on current size of @var{input}
|
||||
@var{k}/@var{n} only output @var{k}th of @var{n} to stdout
|
||||
l/@var{n} generate @var{n} files without splitting lines
|
||||
l/@var{k}/@var{n} likewise but only output @var{k}th of @var{n} to stdout
|
||||
r/@var{n} like @samp{l} but use round robin distribution
|
||||
r/@var{k}/@var{n} likewise but only output @var{k}th of @var{n} to stdout
|
||||
@end example
|
||||
|
||||
Any excess bytes remaining after dividing the @var{input}
|
||||
into @var{n} chunks, are assigned to the last chunk.
|
||||
Any excess bytes appearing after the initial calculation are discarded
|
||||
(except when using @samp{r} mode).
|
||||
|
||||
All @var{n} files are created even if there are fewer than @var{n} lines,
|
||||
or the @var{input} is truncated.
|
||||
|
||||
For @samp{l} mode, chunks are approximately @var{input} size / @var{n}.
|
||||
The @var{input} is partitioned into @var{n} equal sized portions, with
|
||||
the last assigned any excess. If a line @emph{starts} within a partition
|
||||
it is written completely to the corresponding file. Since lines
|
||||
are not split even if they overlap a partition, the files written
|
||||
can be larger or smaller than the partition size, and even empty
|
||||
if a line is so long as to completely overlap the partition.
|
||||
|
||||
For @samp{r} mode, the size of @var{input} is irrelevant,
|
||||
and so can be a pipe for example.
|
||||
|
||||
@item -a @var{length}
|
||||
@itemx --suffix-length=@var{length}
|
||||
@opindex -a
|
||||
@@ -2988,6 +3024,23 @@ Use suffixes of length @var{length}. The default @var{length} is 2.
|
||||
@opindex --numeric-suffixes
|
||||
Use digits in suffixes rather than lower-case letters.
|
||||
|
||||
@item -e
|
||||
@itemx --elide-empty-files
|
||||
@opindex -e
|
||||
@opindex --elide-empty-files
|
||||
Suppress the generation of zero-length output files. This can happen
|
||||
with the @option{--number} option if a file is (truncated to be) shorter
|
||||
than the number requested, or if a line is so long as to completely
|
||||
span a chunk. The output file sequence numbers, always run consecutively
|
||||
even when this option is specified.
|
||||
|
||||
@item -u
|
||||
@itemx --unbuffered
|
||||
@opindex -u
|
||||
@opindex --unbuffered
|
||||
Immediately copy input to output in @option{--number r/...} mode,
|
||||
which is a much slower mode of operation.
|
||||
|
||||
@itemx --verbose
|
||||
@opindex --verbose
|
||||
Write a diagnostic just before each output file is opened.
|
||||
@@ -2996,6 +3049,67 @@ Write a diagnostic just before each output file is opened.
|
||||
|
||||
@exitstatus
|
||||
|
||||
Here are a few examples to illustrate how the
|
||||
@option{--number} (@option{-n}) option works:
|
||||
|
||||
Notice how, by default, one line may be split onto two or more:
|
||||
|
||||
@example
|
||||
$ seq -w 6 10 > k; split -n3 k; head xa?
|
||||
==> xaa <==
|
||||
06
|
||||
07
|
||||
==> xab <==
|
||||
|
||||
08
|
||||
0
|
||||
==> xac <==
|
||||
9
|
||||
10
|
||||
@end example
|
||||
|
||||
Use the "l/" modifier to suppress that:
|
||||
|
||||
@example
|
||||
$ seq -w 6 10 > k; split -nl/3 k; head xa?
|
||||
==> xaa <==
|
||||
06
|
||||
07
|
||||
|
||||
==> xab <==
|
||||
08
|
||||
09
|
||||
|
||||
==> xac <==
|
||||
10
|
||||
@end example
|
||||
|
||||
Use the "r/" modifier to distribute lines in a round-robin fashion:
|
||||
|
||||
@example
|
||||
$ seq -w 6 10 > k; split -nr/3 k; head xa?
|
||||
==> xaa <==
|
||||
06
|
||||
09
|
||||
|
||||
==> xab <==
|
||||
07
|
||||
10
|
||||
|
||||
==> xac <==
|
||||
08
|
||||
@end example
|
||||
|
||||
You can also extract just the Kth chunk.
|
||||
This extracts and prints just the 7th "chunk" of 33:
|
||||
|
||||
@example
|
||||
$ seq 100 > k; split -nl/7/33 k
|
||||
20
|
||||
21
|
||||
22
|
||||
@end example
|
||||
|
||||
|
||||
@node csplit invocation
|
||||
@section @command{csplit}: Split a file into context-determined pieces
|
||||
@@ -4076,10 +4190,11 @@ disks and controllers.
|
||||
@item --parallel=@var{n}
|
||||
@opindex --parallel
|
||||
@cindex multithreaded sort
|
||||
Limit the number of sorts run in parallel to @var{n}. By default,
|
||||
@var{n} is set to the number of available processors, and values
|
||||
greater than that are reduced to that limit. Also see
|
||||
@ref{nproc invocation}.
|
||||
Set the number of sorts run in parallel to @var{n}. By default,
|
||||
@var{n} is set to the number of available processors, but limited
|
||||
to 8, as there are diminishing performance gains after that.
|
||||
Note also that using @var{n} threads increases the memory usage by
|
||||
a factor of log @var{n}. Also see @ref{nproc invocation}.
|
||||
|
||||
@item -u
|
||||
@itemx --unique
|
||||
@@ -10721,7 +10836,7 @@ precision preceded by a period to specify the number of digits to
|
||||
print after the decimal point. For example, @samp{%.3X} outputs the
|
||||
last access time to millisecond precision. If a period is given but no
|
||||
precision, @command{stat} uses 9 digits, so @samp{%.X} is equivalent to
|
||||
@samp{%.9X} When discarding excess precision, time stamps are truncated
|
||||
@samp{%.9X}. When discarding excess precision, time stamps are truncated
|
||||
toward minus infinity.
|
||||
|
||||
@example
|
||||
|
||||
10
gl/modules/fadvise-tests
Normal file
10
gl/modules/fadvise-tests
Normal file
@@ -0,0 +1,10 @@
|
||||
Files:
|
||||
tests/test-fadvise.c
|
||||
|
||||
Depends-on:
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-fadvise
|
||||
check_PROGRAMS += test-fadvise
|
||||
@@ -21,6 +21,13 @@
|
||||
|
||||
#include "fadvise.h"
|
||||
|
||||
/* We ignore any errors as these hints are only advisory.
|
||||
* There is the chance one can pass invalid ADVICE, which will
|
||||
* not be indicated, but given the simplicity of the interface
|
||||
* this is unlikely. Also not returning errors allows the
|
||||
* unconditional passing of descriptors to non standard files,
|
||||
* which will just be ignored if unsupported. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
2
gnulib
2
gnulib
Submodule gnulib updated: a14bd22364...fe2a2304a8
@@ -3,15 +3,18 @@ include gnulib.mk
|
||||
AM_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
# A few tests are inherently warning-evoking.
|
||||
# Since we require -Werror, exempt the few offenders.
|
||||
# In the typical case where we use -Werror, exempt the few offenders.
|
||||
|
||||
# test-xvasprintf.c: In function 'test_xasprintf':
|
||||
# test-xvasprintf.c:100: error: format not a string literal and no \
|
||||
# format arguments [-Wformat-security]
|
||||
test_xvasprintf_CFLAGS = $(AM_CFLAGS) -Wno-format-security
|
||||
test_xvasprintf_CFLAGS = $(AM_CFLAGS) \
|
||||
`test -n '$(WERROR_CFLAGS)' && echo ' -Wno-format-security'`
|
||||
|
||||
# test-lock.c: In function 'lock_mutator_thread':
|
||||
# test-lock.c:148: error: cast from function call of type 'pthread_t' to \
|
||||
# non-matching type 'void *' [-Wbad-function-cast]
|
||||
test_lock_CFLAGS = $(AM_CFLAGS) -Wno-bad-function-cast
|
||||
test_tls_CFLAGS = $(AM_CFLAGS) -Wno-bad-function-cast
|
||||
test_lock_CFLAGS = $(AM_CFLAGS) \
|
||||
`test -n '$(WERROR_CFLAGS)' && echo ' -Wno-bad-function-cast'`
|
||||
test_tls_CFLAGS = $(AM_CFLAGS) \
|
||||
`test -n '$(WERROR_CFLAGS)' && echo ' -Wno-bad-function-cast'`
|
||||
|
||||
@@ -603,6 +603,12 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Improve quality of diagnostic when a nonexistent dst_name
|
||||
ends in a slash and open fails with errno == EISDIR. */
|
||||
if (dest_desc < 0 && dest_errno == EISDIR
|
||||
&& *dst_name && dst_name[strlen (dst_name) - 1] == '/')
|
||||
dest_errno = ENOTDIR;
|
||||
}
|
||||
else
|
||||
omitted_permissions = 0;
|
||||
|
||||
2
src/cp.c
2
src/cp.c
@@ -604,6 +604,8 @@ do_copy (int n_files, char **file, const char *target_directory,
|
||||
error (0, 0, _("extra operand %s"), quote (file[2]));
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
/* Update NEW_DST and SB, which may be checked below. */
|
||||
ignore_value (target_directory_operand (file[n_files -1], &sb, &new_dst));
|
||||
}
|
||||
else if (!target_directory)
|
||||
{
|
||||
|
||||
@@ -1275,7 +1275,7 @@ max_out (char *format)
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("too many %% conversion specifications in suffix"));
|
||||
percent = true;
|
||||
unsigned int flags;
|
||||
int flags;
|
||||
f += get_format_flags (f, &flags);
|
||||
while (ISDIGIT (*f))
|
||||
f++;
|
||||
|
||||
63
src/od.c
63
src/od.c
@@ -24,6 +24,7 @@
|
||||
#include <sys/types.h>
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "ftoastr.h"
|
||||
#include "quote.h"
|
||||
#include "xfreopen.h"
|
||||
#include "xprintf.h"
|
||||
@@ -34,21 +35,9 @@
|
||||
|
||||
#define AUTHORS proper_name ("Jim Meyering")
|
||||
|
||||
#include <float.h>
|
||||
|
||||
/* The default number of input bytes per output line. */
|
||||
#define DEFAULT_BYTES_PER_BLOCK 16
|
||||
|
||||
/* The number of decimal digits of precision in a float. */
|
||||
#ifndef FLT_DIG
|
||||
# define FLT_DIG 7
|
||||
#endif
|
||||
|
||||
/* The number of decimal digits of precision in a double. */
|
||||
#ifndef DBL_DIG
|
||||
# define DBL_DIG 15
|
||||
#endif
|
||||
|
||||
#if HAVE_UNSIGNED_LONG_LONG_INT
|
||||
typedef unsigned long long int unsigned_long_long_int;
|
||||
#else
|
||||
@@ -92,17 +81,15 @@ enum output_format
|
||||
enum
|
||||
{
|
||||
FMT_BYTES_ALLOCATED =
|
||||
MAX ((sizeof "%*.99" - 1
|
||||
(sizeof "%*.99" - 1
|
||||
+ MAX (sizeof "ld",
|
||||
MAX (sizeof PRIdMAX,
|
||||
MAX (sizeof PRIoMAX,
|
||||
MAX (sizeof PRIuMAX,
|
||||
sizeof PRIxMAX))))),
|
||||
sizeof "%*.99Le")
|
||||
sizeof PRIxMAX)))))
|
||||
};
|
||||
|
||||
/* Ensure that our choice for FMT_BYTES_ALLOCATED is reasonable. */
|
||||
verify (LDBL_DIG <= 99);
|
||||
verify (MAX_INTEGRAL_TYPE_SIZE * CHAR_BIT / 3 <= 99);
|
||||
|
||||
/* Each output format specification (from `-t spec' or from
|
||||
@@ -401,10 +388,10 @@ implies 32. By default, od uses -A o -t oS -w16.\n\
|
||||
|
||||
/* Define the print functions. */
|
||||
|
||||
#define PRINT_TYPE(N, T) \
|
||||
#define PRINT_FIELDS(N, T, FMT_STRING, ACTION) \
|
||||
static void \
|
||||
N (size_t fields, size_t blank, void const *block, \
|
||||
char const *fmt_string, int width, int pad) \
|
||||
char const *FMT_STRING, int width, int pad) \
|
||||
{ \
|
||||
T const *p = block; \
|
||||
size_t i; \
|
||||
@@ -412,11 +399,22 @@ N (size_t fields, size_t blank, void const *block, \
|
||||
for (i = fields; blank < i; i--) \
|
||||
{ \
|
||||
int next_pad = pad * (i - 1) / fields; \
|
||||
xprintf (fmt_string, pad_remaining - next_pad + width, *p++); \
|
||||
int adjusted_width = pad_remaining - next_pad + width; \
|
||||
T x = *p++; \
|
||||
ACTION; \
|
||||
pad_remaining = next_pad; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define PRINT_TYPE(N, T) \
|
||||
PRINT_FIELDS (N, T, fmt_string, xprintf (fmt_string, adjusted_width, x))
|
||||
|
||||
#define PRINT_FLOATTYPE(N, T, FTOASTR, BUFSIZE) \
|
||||
PRINT_FIELDS (N, T, fmt_string ATTRIBUTE_UNUSED, \
|
||||
char buf[BUFSIZE]; \
|
||||
FTOASTR (buf, sizeof buf, 0, 0, x); \
|
||||
xprintf ("%*s", adjusted_width, buf))
|
||||
|
||||
PRINT_TYPE (print_s_char, signed char)
|
||||
PRINT_TYPE (print_char, unsigned char)
|
||||
PRINT_TYPE (print_s_short, short int)
|
||||
@@ -424,11 +422,13 @@ PRINT_TYPE (print_short, unsigned short int)
|
||||
PRINT_TYPE (print_int, unsigned int)
|
||||
PRINT_TYPE (print_long, unsigned long int)
|
||||
PRINT_TYPE (print_long_long, unsigned_long_long_int)
|
||||
PRINT_TYPE (print_float, float)
|
||||
PRINT_TYPE (print_double, double)
|
||||
PRINT_TYPE (print_long_double, long double)
|
||||
|
||||
PRINT_FLOATTYPE (print_float, float, ftoastr, FLT_BUFSIZE_BOUND)
|
||||
PRINT_FLOATTYPE (print_double, double, dtoastr, DBL_BUFSIZE_BOUND)
|
||||
PRINT_FLOATTYPE (print_long_double, long double, ldtoastr, LDBL_BUFSIZE_BOUND)
|
||||
|
||||
#undef PRINT_TYPE
|
||||
#undef PRINT_FLOATTYPE
|
||||
|
||||
static void
|
||||
dump_hexl_mode_trailer (size_t n_bytes, const char *block)
|
||||
@@ -586,13 +586,11 @@ decode_one_format (const char *s_orig, const char *s, const char **next,
|
||||
enum size_spec size_spec;
|
||||
unsigned long int size;
|
||||
enum output_format fmt;
|
||||
const char *pre_fmt_string;
|
||||
void (*print_function) (size_t, size_t, void const *, char const *,
|
||||
int, int);
|
||||
const char *p;
|
||||
char c;
|
||||
int field_width;
|
||||
int precision;
|
||||
|
||||
assert (tspec != NULL);
|
||||
|
||||
@@ -772,34 +770,31 @@ this system doesn't provide a %lu-byte floating point type"),
|
||||
}
|
||||
size_spec = fp_type_size[size];
|
||||
|
||||
struct lconv const *locale = localeconv ();
|
||||
size_t decimal_point_len =
|
||||
(locale->decimal_point[0] ? strlen (locale->decimal_point) : 1);
|
||||
|
||||
switch (size_spec)
|
||||
{
|
||||
case FLOAT_SINGLE:
|
||||
print_function = print_float;
|
||||
/* FIXME - should we use %g instead of %e? */
|
||||
pre_fmt_string = "%%*.%de";
|
||||
precision = FLT_DIG;
|
||||
field_width = FLT_STRLEN_BOUND_L (decimal_point_len);
|
||||
break;
|
||||
|
||||
case FLOAT_DOUBLE:
|
||||
print_function = print_double;
|
||||
pre_fmt_string = "%%*.%de";
|
||||
precision = DBL_DIG;
|
||||
field_width = DBL_STRLEN_BOUND_L (decimal_point_len);
|
||||
break;
|
||||
|
||||
case FLOAT_LONG_DOUBLE:
|
||||
print_function = print_long_double;
|
||||
pre_fmt_string = "%%*.%dLe";
|
||||
precision = LDBL_DIG;
|
||||
field_width = LDBL_STRLEN_BOUND_L (decimal_point_len);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
field_width = precision + 8;
|
||||
sprintf (tspec->fmt_string, pre_fmt_string, precision);
|
||||
assert (strlen (tspec->fmt_string) < FMT_BYTES_ALLOCATED);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
|
||||
@@ -37,10 +37,6 @@
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Kaveh Ghazi")
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
# define MAXHOSTNAMELEN 64
|
||||
#endif
|
||||
|
||||
char *ttyname (int);
|
||||
|
||||
/* If true, display the hours:minutes since each user has touched
|
||||
|
||||
687
src/sort.c
687
src/sort.c
File diff suppressed because it is too large
Load Diff
558
src/split.c
558
src/split.c
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
@@ -33,6 +34,7 @@
|
||||
#include "full-read.h"
|
||||
#include "full-write.h"
|
||||
#include "quote.h"
|
||||
#include "safe-read.h"
|
||||
#include "xfreopen.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
@@ -43,8 +45,6 @@
|
||||
proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \
|
||||
proper_name ("Richard M. Stallman")
|
||||
|
||||
#define DEFAULT_SUFFIX_LENGTH 2
|
||||
|
||||
/* Base name of output files. */
|
||||
static char const *outbase;
|
||||
|
||||
@@ -56,7 +56,7 @@ static char *outfile;
|
||||
static char *outfile_mid;
|
||||
|
||||
/* Length of OUTFILE's suffix. */
|
||||
static size_t suffix_length = DEFAULT_SUFFIX_LENGTH;
|
||||
static size_t suffix_length;
|
||||
|
||||
/* Alphabet of characters to use in suffix. */
|
||||
static char const *suffix_alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
@@ -65,17 +65,25 @@ static char const *suffix_alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
static char *infile;
|
||||
|
||||
/* Descriptor on which output file is open. */
|
||||
static int output_desc;
|
||||
static int output_desc = -1;
|
||||
|
||||
/* If true, print a diagnostic on standard error just before each
|
||||
output file is opened. */
|
||||
static bool verbose;
|
||||
|
||||
/* If true, don't generate zero length output files. */
|
||||
static bool elide_empty_files;
|
||||
|
||||
/* If true, in round robin mode, immediately copy
|
||||
input to output, which is much slower, so disabled by default. */
|
||||
static bool unbuffered;
|
||||
|
||||
/* For long options that have no equivalent short option, use a
|
||||
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
|
||||
enum
|
||||
{
|
||||
VERBOSE_OPTION = CHAR_MAX + 1
|
||||
VERBOSE_OPTION = CHAR_MAX + 1,
|
||||
IO_BLKSIZE_OPTION
|
||||
};
|
||||
|
||||
static struct option const longopts[] =
|
||||
@@ -83,14 +91,45 @@ static struct option const longopts[] =
|
||||
{"bytes", required_argument, NULL, 'b'},
|
||||
{"lines", required_argument, NULL, 'l'},
|
||||
{"line-bytes", required_argument, NULL, 'C'},
|
||||
{"number", required_argument, NULL, 'n'},
|
||||
{"elide-empty-files", no_argument, NULL, 'e'},
|
||||
{"unbuffered", no_argument, NULL, 'u'},
|
||||
{"suffix-length", required_argument, NULL, 'a'},
|
||||
{"numeric-suffixes", no_argument, NULL, 'd'},
|
||||
{"verbose", no_argument, NULL, VERBOSE_OPTION},
|
||||
{"-io-blksize", required_argument, NULL,
|
||||
IO_BLKSIZE_OPTION}, /* do not document */
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
set_suffix_length (uintmax_t n_units)
|
||||
{
|
||||
#define DEFAULT_SUFFIX_LENGTH 2
|
||||
|
||||
size_t suffix_needed = 0;
|
||||
size_t alphabet_len = strlen (suffix_alphabet);
|
||||
bool alphabet_slop = (n_units % alphabet_len) != 0;
|
||||
while (n_units /= alphabet_len)
|
||||
suffix_needed++;
|
||||
suffix_needed += alphabet_slop;
|
||||
|
||||
if (suffix_length) /* set by user */
|
||||
{
|
||||
if (suffix_length < suffix_needed)
|
||||
{
|
||||
error (EXIT_FAILURE, 0,
|
||||
_("the suffix length needs to be at least %zu"),
|
||||
suffix_needed);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
suffix_length = MAX (DEFAULT_SUFFIX_LENGTH, suffix_needed);
|
||||
}
|
||||
|
||||
void
|
||||
usage (int status)
|
||||
{
|
||||
@@ -117,7 +156,10 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
-b, --bytes=SIZE put SIZE bytes per output file\n\
|
||||
-C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\
|
||||
-d, --numeric-suffixes use numeric suffixes instead of alphabetic\n\
|
||||
-e, --elide-empty-files do not generate empty output files with `-n'\n\
|
||||
-l, --lines=NUMBER put NUMBER lines per output file\n\
|
||||
-n, --number=CHUNKS generate CHUNKS output files. See below\n\
|
||||
-u, --unbuffered immediately copy input to output with `-n r/...'\n\
|
||||
"), DEFAULT_SUFFIX_LENGTH);
|
||||
fputs (_("\
|
||||
--verbose print a diagnostic just before each\n\
|
||||
@@ -126,6 +168,15 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
||||
emit_size_note ();
|
||||
fputs (_("\n\
|
||||
CHUNKS may be:\n\
|
||||
N split into N files based on size of input\n\
|
||||
K/N output Kth of N to stdout\n\
|
||||
l/N split into N files without splitting lines\n\
|
||||
l/K/N output Kth of N to stdout without splitting lines\n\
|
||||
r/N like `l' but use round robin distribution\n\
|
||||
r/K/N likewise but only output Kth of N to stdout\n\
|
||||
"), stdout);
|
||||
emit_ancillary_info ();
|
||||
}
|
||||
exit (status);
|
||||
@@ -187,6 +238,17 @@ next_file_name (void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Create or truncate a file. */
|
||||
|
||||
static int
|
||||
create (const char* name)
|
||||
{
|
||||
if (verbose)
|
||||
fprintf (stdout, _("creating file %s\n"), quote (name));
|
||||
return open (name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
|
||||
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH));
|
||||
}
|
||||
|
||||
/* Write BYTES bytes at BP to an output file.
|
||||
If NEW_FILE_FLAG is true, open the next output file.
|
||||
Otherwise add to the same output file already in use. */
|
||||
@@ -196,17 +258,12 @@ cwrite (bool new_file_flag, const char *bp, size_t bytes)
|
||||
{
|
||||
if (new_file_flag)
|
||||
{
|
||||
if (!bp && bytes == 0 && elide_empty_files)
|
||||
return;
|
||||
if (output_desc >= 0 && close (output_desc) < 0)
|
||||
error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
|
||||
next_file_name ();
|
||||
if (verbose)
|
||||
fprintf (stdout, _("creating file %s\n"), quote (outfile));
|
||||
output_desc = open (outfile,
|
||||
O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
|
||||
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
|
||||
| S_IROTH | S_IWOTH));
|
||||
if (output_desc < 0)
|
||||
if ((output_desc = create (outfile)) < 0)
|
||||
error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
}
|
||||
if (full_write (output_desc, bp, bytes) != bytes)
|
||||
@@ -217,13 +274,14 @@ cwrite (bool new_file_flag, const char *bp, size_t bytes)
|
||||
Use buffer BUF, whose size is BUFSIZE. */
|
||||
|
||||
static void
|
||||
bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize)
|
||||
bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize, uintmax_t max_files)
|
||||
{
|
||||
size_t n_read;
|
||||
bool new_file_flag = true;
|
||||
size_t to_read;
|
||||
uintmax_t to_write = n_bytes;
|
||||
char *bp_out;
|
||||
uintmax_t opened = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -239,6 +297,7 @@ bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize)
|
||||
if (to_read) /* do not write 0 bytes! */
|
||||
{
|
||||
cwrite (new_file_flag, bp_out, to_read);
|
||||
opened += new_file_flag;
|
||||
to_write -= to_read;
|
||||
new_file_flag = false;
|
||||
}
|
||||
@@ -248,14 +307,21 @@ bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize)
|
||||
{
|
||||
size_t w = to_write;
|
||||
cwrite (new_file_flag, bp_out, w);
|
||||
opened += new_file_flag;
|
||||
new_file_flag = !max_files || (opened < max_files);
|
||||
bp_out += w;
|
||||
to_read -= w;
|
||||
new_file_flag = true;
|
||||
to_write = n_bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (n_read == bufsize);
|
||||
|
||||
/* Ensure NUMBER files are created, which truncates
|
||||
any existing files or notifies any consumers on fifos.
|
||||
FIXME: Should we do this before EXIT_FAILURE? */
|
||||
while (opened++ < max_files)
|
||||
cwrite (true, NULL, 0);
|
||||
}
|
||||
|
||||
/* Split into pieces of exactly N_LINES lines.
|
||||
@@ -361,6 +427,331 @@ line_bytes_split (size_t n_bytes)
|
||||
free (buf);
|
||||
}
|
||||
|
||||
/* -n l/[K/]N: Write lines to files of approximately file size / N.
|
||||
The file is partitioned into file size / N sized portions, with the
|
||||
last assigned any excess. If a line _starts_ within a partition
|
||||
it is written completely to the corresponding file. Since lines
|
||||
are not split even if they overlap a partition, the files written
|
||||
can be larger or smaller than the partition size, and even empty
|
||||
if a line is so long as to completely overlap the partition. */
|
||||
|
||||
static void
|
||||
lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize,
|
||||
off_t file_size)
|
||||
{
|
||||
assert (n && k <= n && n <= file_size);
|
||||
|
||||
const off_t chunk_size = file_size / n;
|
||||
uintmax_t chunk_no = 1;
|
||||
off_t chunk_end = chunk_size - 1;
|
||||
off_t n_written = 0;
|
||||
bool new_file_flag = true;
|
||||
|
||||
if (k > 1)
|
||||
{
|
||||
/* Start reading 1 byte before kth chunk of file. */
|
||||
off_t start = (k - 1) * chunk_size - 1;
|
||||
if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0)
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
n_written = start;
|
||||
chunk_no = k - 1;
|
||||
chunk_end = chunk_no * chunk_size - 1;
|
||||
}
|
||||
|
||||
while (n_written < file_size)
|
||||
{
|
||||
char *bp = buf, *eob;
|
||||
size_t n_read = full_read (STDIN_FILENO, buf, bufsize);
|
||||
n_read = MIN (n_read, file_size - n_written);
|
||||
if (n_read < bufsize && errno)
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
else if (n_read == 0)
|
||||
break; /* eof. */
|
||||
eob = buf + n_read;
|
||||
|
||||
while (bp != eob)
|
||||
{
|
||||
size_t to_write;
|
||||
bool next = false;
|
||||
|
||||
/* Begin looking for '\n' at last byte of chunk. */
|
||||
off_t skip = MIN (n_read, MAX (0, chunk_end - n_written));
|
||||
char *bp_out = memchr (bp + skip, '\n', n_read - skip);
|
||||
if (bp_out++)
|
||||
next = true;
|
||||
else
|
||||
bp_out = eob;
|
||||
to_write = bp_out - bp;
|
||||
|
||||
if (k == chunk_no)
|
||||
{
|
||||
/* We don't use the stdout buffer here since we're writing
|
||||
large chunks from an existing file, so it's more efficient
|
||||
to write out directly. */
|
||||
if (full_write (STDOUT_FILENO, bp, to_write) != to_write)
|
||||
error (EXIT_FAILURE, errno, "%s", _("write error"));
|
||||
}
|
||||
else
|
||||
cwrite (new_file_flag, bp, to_write);
|
||||
n_written += to_write;
|
||||
bp += to_write;
|
||||
n_read -= to_write;
|
||||
new_file_flag = next;
|
||||
|
||||
/* A line could have been so long that it skipped
|
||||
entire chunks. So create empty files in that case. */
|
||||
while (next || chunk_end <= n_written - 1)
|
||||
{
|
||||
if (!next && bp == eob)
|
||||
break; /* replenish buf, before going to next chunk. */
|
||||
chunk_no++;
|
||||
if (k && chunk_no > k)
|
||||
return;
|
||||
if (chunk_no == n)
|
||||
chunk_end = file_size - 1; /* >= chunk_size. */
|
||||
else
|
||||
chunk_end += chunk_size;
|
||||
if (chunk_end <= n_written - 1)
|
||||
cwrite (true, NULL, 0);
|
||||
else
|
||||
next = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure NUMBER files are created, which truncates
|
||||
any existing files or notifies any consumers on fifos.
|
||||
FIXME: Should we do this before EXIT_FAILURE? */
|
||||
while (!k && chunk_no++ <= n)
|
||||
cwrite (true, NULL, 0);
|
||||
}
|
||||
|
||||
/* -n K/N: Extract Kth of N chunks. */
|
||||
|
||||
static void
|
||||
bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize,
|
||||
off_t file_size)
|
||||
{
|
||||
off_t start;
|
||||
off_t end;
|
||||
|
||||
assert (k && n && k <= n && n <= file_size);
|
||||
|
||||
start = (k - 1) * (file_size / n);
|
||||
end = (k == n) ? file_size : k * (file_size / n);
|
||||
|
||||
if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0)
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
|
||||
while (start < end)
|
||||
{
|
||||
size_t n_read = full_read (STDIN_FILENO, buf, bufsize);
|
||||
n_read = MIN (n_read, end - start);
|
||||
if (n_read < bufsize && errno)
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
else if (n_read == 0)
|
||||
break; /* eof. */
|
||||
if (full_write (STDOUT_FILENO, buf, n_read) != n_read)
|
||||
error (EXIT_FAILURE, errno, "%s", quote ("-"));
|
||||
start += n_read;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct of_info
|
||||
{
|
||||
char *of_name;
|
||||
int ofd;
|
||||
FILE* ofile;
|
||||
} of_t;
|
||||
|
||||
enum
|
||||
{
|
||||
OFD_NEW = -1,
|
||||
OFD_APPEND = -2
|
||||
};
|
||||
|
||||
/* Rotate file descriptors when we're writing to more output files than we
|
||||
have available file descriptors.
|
||||
Return whether we came under file resource pressure.
|
||||
If so, it's probably best to close each file when finished with it. */
|
||||
|
||||
static bool
|
||||
ofile_open (of_t *files, size_t i_check, size_t nfiles)
|
||||
{
|
||||
bool file_limit = false;
|
||||
|
||||
if (files[i_check].ofd <= OFD_NEW)
|
||||
{
|
||||
int fd;
|
||||
size_t i_reopen = i_check ? i_check - 1 : nfiles - 1;
|
||||
|
||||
/* Another process could have opened a file in between the calls to
|
||||
close and open, so we should keep trying until open succeeds or
|
||||
we've closed all of our files. */
|
||||
while (true)
|
||||
{
|
||||
if (files[i_check].ofd == OFD_NEW)
|
||||
fd = create (files[i_check].of_name);
|
||||
else /* OFD_APPEND */
|
||||
{
|
||||
/* Attempt to append to previously opened file.
|
||||
We use O_NONBLOCK to support writing to fifos,
|
||||
where the other end has closed because of our
|
||||
previous close. In that case we'll immediately
|
||||
get an error, rather than waiting indefinitely.
|
||||
In specialised cases the consumer can keep reading
|
||||
from the fifo, terminating on conditions in the data
|
||||
itself, or perhaps never in the case of `tail -f`.
|
||||
I.E. for fifos it is valid to attempt this reopen. */
|
||||
fd = open (files[i_check].of_name,
|
||||
O_WRONLY | O_BINARY | O_APPEND | O_NONBLOCK);
|
||||
}
|
||||
|
||||
if (-1 < fd)
|
||||
break;
|
||||
|
||||
if (!(errno == EMFILE || errno == ENFILE))
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_check].of_name);
|
||||
|
||||
file_limit = true;
|
||||
|
||||
/* Search backwards for an open file to close. */
|
||||
while (files[i_reopen].ofd < 0)
|
||||
{
|
||||
i_reopen = i_reopen ? i_reopen - 1 : nfiles - 1;
|
||||
/* No more open files to close, exit with E[NM]FILE. */
|
||||
if (i_reopen == i_check)
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_check].of_name);
|
||||
}
|
||||
|
||||
if (fclose (files[i_reopen].ofile) != 0)
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_reopen].of_name);
|
||||
files[i_reopen].ofd = OFD_APPEND;
|
||||
}
|
||||
|
||||
files[i_check].ofd = fd;
|
||||
if (!(files[i_check].ofile = fdopen (fd, "a")))
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_check].of_name);
|
||||
}
|
||||
|
||||
return file_limit;
|
||||
}
|
||||
|
||||
/* -n r/[K/]N: Divide file into N chunks in round robin fashion.
|
||||
When K == 0, we try to keep the files open in parallel.
|
||||
If we run out of file resources, then we revert
|
||||
to opening and closing each file for each line. */
|
||||
|
||||
static void
|
||||
lines_rr (uintmax_t k, uintmax_t n, char *buf, size_t bufsize)
|
||||
{
|
||||
bool file_limit;
|
||||
size_t i_file;
|
||||
of_t *files;
|
||||
uintmax_t line_no;
|
||||
|
||||
if (k)
|
||||
line_no = 1;
|
||||
else
|
||||
{
|
||||
if (SIZE_MAX < n)
|
||||
error (exit_failure, 0, "%s", _("memory exhausted"));
|
||||
files = xnmalloc (n, sizeof *files);
|
||||
|
||||
/* Generate output file names. */
|
||||
for (i_file = 0; i_file < n; i_file++)
|
||||
{
|
||||
next_file_name ();
|
||||
files[i_file].of_name = xstrdup (outfile);
|
||||
files[i_file].ofd = OFD_NEW;
|
||||
files[i_file].ofile = NULL;
|
||||
}
|
||||
i_file = 0;
|
||||
file_limit = false;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
char *bp = buf, *eob;
|
||||
/* Use safe_read() rather than full_read() here
|
||||
so that we process available data immediately. */
|
||||
size_t n_read = safe_read (STDIN_FILENO, buf, bufsize);
|
||||
if (n_read == SAFE_READ_ERROR)
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
else if (n_read == 0)
|
||||
break; /* eof. */
|
||||
eob = buf + n_read;
|
||||
|
||||
while (bp != eob)
|
||||
{
|
||||
size_t to_write;
|
||||
bool next = false;
|
||||
|
||||
/* Find end of line. */
|
||||
char *bp_out = memchr (bp, '\n', eob - bp);
|
||||
if (bp_out)
|
||||
{
|
||||
bp_out++;
|
||||
next = true;
|
||||
}
|
||||
else
|
||||
bp_out = eob;
|
||||
to_write = bp_out - bp;
|
||||
|
||||
if (k)
|
||||
{
|
||||
if (line_no == k && unbuffered)
|
||||
{
|
||||
if (full_write (STDOUT_FILENO, bp, to_write) != to_write)
|
||||
error (EXIT_FAILURE, errno, "%s", _("write error"));
|
||||
}
|
||||
else if (line_no == k && fwrite (bp, to_write, 1, stdout) != 1)
|
||||
{
|
||||
clearerr (stdout); /* To silence close_stdout(). */
|
||||
error (EXIT_FAILURE, errno, "%s", _("write error"));
|
||||
}
|
||||
if (next)
|
||||
line_no = (line_no == n) ? 1 : line_no + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Secure file descriptor. */
|
||||
file_limit |= ofile_open (files, i_file, n);
|
||||
if (unbuffered)
|
||||
{
|
||||
/* Note writing to fd, rather than flushing the FILE gives
|
||||
an 8% performance benefit, due to reduced data copying. */
|
||||
if (full_write (files[i_file].ofd, bp, to_write) != to_write)
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_file].of_name);
|
||||
}
|
||||
else if (fwrite (bp, to_write, 1, files[i_file].ofile) != 1)
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_file].of_name);
|
||||
if (file_limit)
|
||||
{
|
||||
if (fclose (files[i_file].ofile) != 0)
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_file].of_name);
|
||||
files[i_file].ofd = OFD_APPEND;
|
||||
}
|
||||
if (next && ++i_file == n)
|
||||
i_file = 0;
|
||||
}
|
||||
|
||||
bp = bp_out;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure all files created, so that any existing files are truncated,
|
||||
and to signal any waiting fifo consumers.
|
||||
Also, close any open file descriptors.
|
||||
FIXME: Should we do this before EXIT_FAILURE? */
|
||||
for (i_file = 0; !k && !elide_empty_files && i_file < n; i_file++)
|
||||
{
|
||||
file_limit |= ofile_open (files, i_file, n);
|
||||
if (fclose (files[i_file].ofile) != 0)
|
||||
error (EXIT_FAILURE, errno, "%s", files[i_file].of_name);
|
||||
}
|
||||
}
|
||||
|
||||
#define FAIL_ONLY_ONE_WAY() \
|
||||
do \
|
||||
{ \
|
||||
@@ -369,21 +760,41 @@ line_bytes_split (size_t n_bytes)
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Parse K/N syntax of chunk options. */
|
||||
|
||||
static void
|
||||
parse_chunk (uintmax_t *k_units, uintmax_t *n_units, char *slash)
|
||||
{
|
||||
*slash = '\0';
|
||||
if (xstrtoumax (slash+1, NULL, 10, n_units, "") != LONGINT_OK
|
||||
|| *n_units == 0)
|
||||
error (EXIT_FAILURE, 0, _("%s: invalid number of chunks"), slash+1);
|
||||
if (slash != optarg /* a leading number is specified. */
|
||||
&& (xstrtoumax (optarg, NULL, 10, k_units, "") != LONGINT_OK
|
||||
|| *k_units == 0 || *n_units < *k_units))
|
||||
error (EXIT_FAILURE, 0, _("%s: invalid chunk number"), optarg);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
enum
|
||||
{
|
||||
type_undef, type_bytes, type_byteslines, type_lines, type_digits
|
||||
type_undef, type_bytes, type_byteslines, type_lines, type_digits,
|
||||
type_chunk_bytes, type_chunk_lines, type_rr
|
||||
} split_type = type_undef;
|
||||
size_t in_blk_size; /* optimal block size of input file device */
|
||||
size_t in_blk_size = 0; /* optimal block size of input file device */
|
||||
char *buf; /* file i/o buffer */
|
||||
size_t page_size = getpagesize ();
|
||||
uintmax_t k_units = 0;
|
||||
uintmax_t n_units;
|
||||
|
||||
static char const multipliers[] = "bEGKkMmPTYZ0";
|
||||
int c;
|
||||
int digits_optind = 0;
|
||||
off_t file_size;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
set_program_name (argv[0]);
|
||||
@@ -395,15 +806,16 @@ main (int argc, char **argv)
|
||||
|
||||
/* Parse command line options. */
|
||||
|
||||
infile = bad_cast ( "-");
|
||||
infile = bad_cast ("-");
|
||||
outbase = bad_cast ("x");
|
||||
|
||||
while (1)
|
||||
while (true)
|
||||
{
|
||||
/* This is the argv-index of the option we will read next. */
|
||||
int this_optind = optind ? optind : 1;
|
||||
char *slash;
|
||||
|
||||
c = getopt_long (argc, argv, "0123456789C:a:b:dl:", longopts, NULL);
|
||||
c = getopt_long (argc, argv, "0123456789C:a:b:del:n:u", longopts, NULL);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
@@ -432,6 +844,13 @@ main (int argc, char **argv)
|
||||
error (0, 0, _("%s: invalid number of bytes"), optarg);
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
/* If input is a pipe, we could get more data than is possible
|
||||
to write to a single file, so indicate that immediately
|
||||
rather than having possibly future invocations fail. */
|
||||
if (OFF_T_MAX < n_units)
|
||||
error (EXIT_FAILURE, EFBIG,
|
||||
_("%s: invalid number of bytes"), optarg);
|
||||
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
@@ -456,6 +875,38 @@ main (int argc, char **argv)
|
||||
error (0, 0, _("%s: invalid number of bytes"), optarg);
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
if (OFF_T_MAX < n_units)
|
||||
error (EXIT_FAILURE, EFBIG,
|
||||
_("%s: invalid number of bytes"), optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
if (split_type != type_undef)
|
||||
FAIL_ONLY_ONE_WAY ();
|
||||
/* skip any whitespace */
|
||||
while (isspace (to_uchar (*optarg)))
|
||||
optarg++;
|
||||
if (strncmp (optarg, "r/", 2) == 0)
|
||||
{
|
||||
split_type = type_rr;
|
||||
optarg += 2;
|
||||
}
|
||||
else if (strncmp (optarg, "l/", 2) == 0)
|
||||
{
|
||||
split_type = type_chunk_lines;
|
||||
optarg += 2;
|
||||
}
|
||||
else
|
||||
split_type = type_chunk_bytes;
|
||||
if ((slash = strchr (optarg, '/')))
|
||||
parse_chunk (&k_units, &n_units, slash);
|
||||
else if (xstrtoumax (optarg, NULL, 10, &n_units, "") != LONGINT_OK
|
||||
|| n_units == 0)
|
||||
error (EXIT_FAILURE, 0, _("%s: invalid number of chunks"), optarg);
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
unbuffered = true;
|
||||
break;
|
||||
|
||||
case '0':
|
||||
@@ -491,6 +942,22 @@ main (int argc, char **argv)
|
||||
suffix_alphabet = "0123456789";
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
elide_empty_files = true;
|
||||
break;
|
||||
|
||||
case IO_BLKSIZE_OPTION:
|
||||
{
|
||||
uintmax_t tmp_blk_size;
|
||||
if (xstrtoumax (optarg, NULL, 10, &tmp_blk_size,
|
||||
multipliers) != LONGINT_OK
|
||||
|| tmp_blk_size == 0 || SIZE_MAX - page_size < tmp_blk_size)
|
||||
error (0, 0, _("%s: invalid IO block size"), optarg);
|
||||
else
|
||||
in_blk_size = tmp_blk_size;
|
||||
}
|
||||
break;
|
||||
|
||||
case VERBOSE_OPTION:
|
||||
verbose = true;
|
||||
break;
|
||||
@@ -513,10 +980,12 @@ main (int argc, char **argv)
|
||||
|
||||
if (n_units == 0)
|
||||
{
|
||||
error (0, 0, _("invalid number of lines: 0"));
|
||||
error (0, 0, _("%s: invalid number of lines"), "0");
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
set_suffix_length (n_units);
|
||||
|
||||
/* Get out the filename arguments. */
|
||||
|
||||
if (optind < argc)
|
||||
@@ -537,18 +1006,36 @@ main (int argc, char **argv)
|
||||
error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
|
||||
quote (infile));
|
||||
|
||||
/* Binary I/O is safer when bytecounts are used. */
|
||||
/* Binary I/O is safer when byte counts are used. */
|
||||
if (O_BINARY && ! isatty (STDIN_FILENO))
|
||||
xfreopen (NULL, "rb", stdin);
|
||||
|
||||
/* No output file is open now. */
|
||||
output_desc = -1;
|
||||
|
||||
/* Get the optimal block size of input device and make a buffer. */
|
||||
|
||||
if (fstat (STDIN_FILENO, &stat_buf) != 0)
|
||||
error (EXIT_FAILURE, errno, "%s", infile);
|
||||
in_blk_size = io_blksize (stat_buf);
|
||||
if (in_blk_size == 0)
|
||||
in_blk_size = io_blksize (stat_buf);
|
||||
file_size = stat_buf.st_size;
|
||||
|
||||
if (split_type == type_chunk_bytes || split_type == type_chunk_lines)
|
||||
{
|
||||
off_t input_offset = lseek (STDIN_FILENO, 0, SEEK_CUR);
|
||||
if (input_offset < 0)
|
||||
error (EXIT_FAILURE, 0, _("%s: cannot determine file size"),
|
||||
quote (infile));
|
||||
file_size -= input_offset;
|
||||
/* Overflow, and sanity checking. */
|
||||
if (OFF_T_MAX < n_units)
|
||||
{
|
||||
char buffer[INT_BUFSIZE_BOUND (uintmax_t)];
|
||||
error (EXIT_FAILURE, EFBIG, _("%s: invalid number of chunks"),
|
||||
umaxtostr (n_units, buffer));
|
||||
}
|
||||
/* increase file_size to n_units here, so that we still process
|
||||
any input data, and create empty files for the rest. */
|
||||
file_size = MAX (file_size, n_units);
|
||||
}
|
||||
|
||||
buf = ptr_align (xmalloc (in_blk_size + 1 + page_size - 1), page_size);
|
||||
|
||||
@@ -560,13 +1047,30 @@ main (int argc, char **argv)
|
||||
break;
|
||||
|
||||
case type_bytes:
|
||||
bytes_split (n_units, buf, in_blk_size);
|
||||
bytes_split (n_units, buf, in_blk_size, 0);
|
||||
break;
|
||||
|
||||
case type_byteslines:
|
||||
line_bytes_split (n_units);
|
||||
break;
|
||||
|
||||
case type_chunk_bytes:
|
||||
if (k_units == 0)
|
||||
bytes_split (file_size / n_units, buf, in_blk_size, n_units);
|
||||
else
|
||||
bytes_chunk_extract (k_units, n_units, buf, in_blk_size, file_size);
|
||||
break;
|
||||
|
||||
case type_chunk_lines:
|
||||
lines_chunk_split (k_units, n_units, buf, in_blk_size, file_size);
|
||||
break;
|
||||
|
||||
case type_rr:
|
||||
/* Note, this is like `sed -n ${k}~${n}p` when k > 0,
|
||||
but the functionality is provided for symmetry. */
|
||||
lines_rr (k_units, n_units, buf, in_blk_size);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
@@ -286,7 +286,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
with --follow=name, reopen a FILE which has not\n\
|
||||
changed size after N (default %d) iterations\n\
|
||||
to see if it has been unlinked or renamed\n\
|
||||
(this is the usual case of rotated log files)\n\
|
||||
(this is the usual case of rotated log files).\n\
|
||||
With inotify, this option is rarely useful.\n\
|
||||
"),
|
||||
DEFAULT_N_LINES,
|
||||
DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS
|
||||
@@ -300,7 +301,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-s, --sleep-interval=N with -f, sleep for approximately N seconds\n\
|
||||
(default 1.0) between iterations\n\
|
||||
(default 1.0) between iterations.\n\
|
||||
With inotify, this option is rarely useful.\n\
|
||||
-v, --verbose always output headers giving file names\n\
|
||||
"), stdout);
|
||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||
|
||||
@@ -129,8 +129,8 @@ SIZE may also be prefixed by one of the following modifying characters:\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* return 1 on error, 0 on success */
|
||||
static int
|
||||
/* return true on success, false on error. */
|
||||
static bool
|
||||
do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
rel_mode_t rel_mode)
|
||||
{
|
||||
@@ -140,7 +140,7 @@ do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
if ((block_mode || (rel_mode && rsize < 0)) && fstat (fd, &sb) != 0)
|
||||
{
|
||||
error (0, errno, _("cannot fstat %s"), quote (fname));
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
if (block_mode)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
" * %" PRIdMAX " byte blocks for file %s"),
|
||||
(intmax_t) ssize, (intmax_t) blksize,
|
||||
quote (fname));
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
ssize *= blksize;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
if (!S_ISREG (sb.st_mode) && !S_TYPEISSHM (&sb))
|
||||
{
|
||||
error (0, 0, _("cannot get the size of %s"), quote (fname));
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
if (sb.st_size < 0)
|
||||
{
|
||||
@@ -173,7 +173,7 @@ do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
this would ever go negative. */
|
||||
error (0, 0, _("%s has unusable, apparently negative size"),
|
||||
quote (fname));
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
{
|
||||
error (0, 0, _("overflow rounding up size of file %s"),
|
||||
quote (fname));
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
nsize = overflow;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
{
|
||||
error (0, 0, _("overflow extending size of file %s"),
|
||||
quote (fname));
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
nsize = fsize + ssize;
|
||||
}
|
||||
@@ -218,21 +218,22 @@ do_ftruncate (int fd, char const *fname, off_t ssize, off_t rsize,
|
||||
error (0, errno,
|
||||
_("failed to truncate %s at %" PRIdMAX " bytes"), quote (fname),
|
||||
(intmax_t) nsize);
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
bool got_size = false;
|
||||
bool errors = false;
|
||||
off_t size IF_LINT ( = 0);
|
||||
off_t rsize = -1;
|
||||
rel_mode_t rel_mode = rm_abs;
|
||||
mode_t omode;
|
||||
int c, errors = 0, fd = -1, oflags;
|
||||
int c, fd = -1, oflags;
|
||||
char const *fname;
|
||||
|
||||
initialize_main (&argc, &argv);
|
||||
@@ -374,7 +375,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
error (0, errno, _("cannot open %s for writing"),
|
||||
quote (fname));
|
||||
errors++;
|
||||
errors = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -382,11 +383,11 @@ main (int argc, char **argv)
|
||||
|
||||
if (fd != -1)
|
||||
{
|
||||
errors += do_ftruncate (fd, fname, size, rsize, rel_mode);
|
||||
errors |= !do_ftruncate (fd, fname, size, rsize, rel_mode);
|
||||
if (close (fd) != 0)
|
||||
{
|
||||
error (0, errno, _("closing %s"), quote (fname));
|
||||
errors++;
|
||||
errors = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,6 +487,11 @@ tsort (const char *file)
|
||||
|
||||
/* T5. Output front of queue. */
|
||||
puts (head->str);
|
||||
#ifdef lint
|
||||
/* suppress valgrind "definitely lost" warnings. */
|
||||
void *head_str = (void *) head->str;
|
||||
free (head_str);
|
||||
#endif
|
||||
head->str = NULL; /* Avoid printing the same string twice. */
|
||||
n_strings--;
|
||||
|
||||
|
||||
4
src/wc.c
4
src/wc.c
@@ -726,8 +726,8 @@ main (int argc, char **argv)
|
||||
switch (ai_err)
|
||||
{
|
||||
case AI_ERR_READ:
|
||||
error (0, errno, _("%s: read error"), quote (files_from));
|
||||
skip_file = true;
|
||||
error (EXIT_FAILURE, errno, _("%s: read error"),
|
||||
quote (files_from));
|
||||
continue;
|
||||
case AI_ERR_MEM:
|
||||
xalloc_die ();
|
||||
|
||||
@@ -49,10 +49,6 @@
|
||||
proper_name ("David MacKenzie"), \
|
||||
proper_name ("Michael Stone")
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
# define MAXHOSTNAMELEN 64
|
||||
#endif
|
||||
|
||||
#ifdef RUN_LVL
|
||||
# define UT_TYPE_RUN_LVL(U) UT_TYPE_EQ (U, RUN_LVL)
|
||||
#else
|
||||
|
||||
@@ -16,7 +16,6 @@ EXTRA_DIST = \
|
||||
other-fs-tmpdir \
|
||||
require-perl \
|
||||
sample-test \
|
||||
test-lib.sh \
|
||||
$(pr_data)
|
||||
|
||||
root_tests = \
|
||||
@@ -150,6 +149,7 @@ TESTS = \
|
||||
misc/xstrtol \
|
||||
tail-2/pid \
|
||||
misc/od \
|
||||
misc/od-float \
|
||||
misc/mktemp \
|
||||
misc/arch \
|
||||
misc/pr \
|
||||
@@ -228,6 +228,8 @@ TESTS = \
|
||||
misc/sort \
|
||||
misc/sort-benchmark-random \
|
||||
misc/sort-compress \
|
||||
misc/sort-compress-hang \
|
||||
misc/sort-compress-proc \
|
||||
misc/sort-continue \
|
||||
misc/sort-debug-keys \
|
||||
misc/sort-debug-warn \
|
||||
@@ -237,11 +239,17 @@ TESTS = \
|
||||
misc/sort-merge-fdlimit \
|
||||
misc/sort-month \
|
||||
misc/sort-rand \
|
||||
misc/sort-spinlock-abuse \
|
||||
misc/sort-stale-thread-mem \
|
||||
misc/sort-unique \
|
||||
misc/sort-unique-segv \
|
||||
misc/sort-version \
|
||||
misc/split-a \
|
||||
misc/split-bchunk \
|
||||
misc/split-fail \
|
||||
misc/split-l \
|
||||
misc/split-lchunk \
|
||||
misc/split-rchunk \
|
||||
misc/stat-birthtime \
|
||||
misc/stat-fmt \
|
||||
misc/stat-hyphen \
|
||||
|
||||
@@ -49,7 +49,8 @@ built_programs = \
|
||||
# variables to test scripts.
|
||||
TESTS_ENVIRONMENT = \
|
||||
. $(srcdir)/lang-default; \
|
||||
tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
|
||||
tmp__=$${TMPDIR-/tmp}; \
|
||||
test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.; \
|
||||
. $(srcdir)/envvar-check; \
|
||||
TMPDIR=$$tmp__; export TMPDIR; \
|
||||
exec 9>&2; \
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp
|
||||
require_membership_in_two_groups_
|
||||
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp
|
||||
require_membership_in_two_groups_
|
||||
|
||||
set _ $groups; shift
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp
|
||||
require_membership_in_two_groups_
|
||||
|
||||
set _ $groups; shift
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp
|
||||
require_membership_in_two_groups_
|
||||
skip_if_root_
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp
|
||||
require_membership_in_two_groups_
|
||||
|
||||
set _ $groups; shift
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp
|
||||
require_membership_in_two_groups_
|
||||
|
||||
set _ $groups; shift
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
umask 0
|
||||
file=f
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
file=f
|
||||
touch $file || framework_failure
|
||||
|
||||
@@ -18,12 +18,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
touch f || framework_failure
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
mkdir -p d/e || framework_failure
|
||||
chmod 0 d/e d || framework_failure
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
skip_if_root_
|
||||
|
||||
mkdir -p d/no-x/y a/b || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
|
||||
# Before coreutils-5.92, this would mistakenly succeed,
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
umask 0
|
||||
mkdir d || framework_failure
|
||||
|
||||
@@ -16,14 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
chmod --version
|
||||
chown --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp chmod chown
|
||||
|
||||
chmod -f 0 no-such 2> out && fail=1
|
||||
chgrp -f 0 no-such 2>> out && fail=1
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
ln -s non-existent dangle || framework_failure
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
touch file
|
||||
chmod 755 file
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chmod --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chmod
|
||||
|
||||
|
||||
# Each line in this list is a set of arguments, followed by :,
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chgrp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chgrp
|
||||
require_root_
|
||||
|
||||
touch f || framework_failure
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chown --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chown
|
||||
|
||||
ln -s no-such dangle || framework_failure
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chown --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chown
|
||||
skip_if_root_
|
||||
|
||||
mkdir d && ln -s / d/slink-to-root
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
chown --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ chown
|
||||
|
||||
id_u=`id -u` || framework_failure
|
||||
test -n "$id_u" || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir a b c || framework_failure
|
||||
ln -s ../t a/1 || framework_failure
|
||||
|
||||
11
tests/cp/acl
11
tests/cp/acl
@@ -17,16 +17,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make sure we get English translations.
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ mv getfacl setfacl
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
mv --version
|
||||
getfacl --version
|
||||
setfacl --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
require_acl_
|
||||
|
||||
# Skip this test if cp was built without ACL support:
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
suffix=.b
|
||||
file=b1.$$
|
||||
@@ -34,8 +30,8 @@ echo test > $file || fail=1
|
||||
|
||||
# Specify both version control and suffix so the environment variables
|
||||
# (possibly set by the user running these tests) aren't used.
|
||||
cp --force --backup=simple --suffix=$suffix $file $file \
|
||||
|| fail=1
|
||||
cp --force --backup=simple --suffix=$suffix $file $file || fail=1
|
||||
cp -T --force --backup=simple --suffix=$suffix $file $file || fail=1
|
||||
|
||||
test -f $file || fail=1
|
||||
test -f $file_backup || fail=1
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir x y || framework_failure
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
echo a > a || framework_failure
|
||||
echo a-tilde > a~ || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
ls --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ ls
|
||||
require_root_
|
||||
working_umask_or_skip_
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir src-dir dest-dir || framework_failure
|
||||
echo f > f || framework_failure
|
||||
|
||||
@@ -19,12 +19,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
require_root_
|
||||
require_selinux_
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir a b c d || framework_failure
|
||||
ln -s ../c a || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir -p a b/a/c || framework_failure
|
||||
touch a/c || framework_failure
|
||||
|
||||
@@ -16,14 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
# Ensure that ls sorts the same way for everyone.
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
umask 022
|
||||
|
||||
@@ -34,7 +28,7 @@ umask 022
|
||||
actual=actual
|
||||
expected=expected
|
||||
|
||||
exec 1> $actual
|
||||
exec 3>&1 1> $actual
|
||||
|
||||
for prog in cp mv; do
|
||||
for initial_files in 'x' 'x y' 'x y y~' 'x y y.~1~' 'x y y~ y.~1~'; do
|
||||
@@ -91,6 +85,8 @@ EOF
|
||||
|
||||
sed 's/: x/:/' $expected-tmp |cat $expected-tmp - > $expected
|
||||
|
||||
exec 1>&3 3>&-
|
||||
|
||||
compare $expected $actual || fail=1
|
||||
|
||||
Exit $fail
|
||||
|
||||
@@ -18,13 +18,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
mv --version
|
||||
fi
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp mv
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
require_root_
|
||||
|
||||
cwd=`pwd`
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
mv --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ mv
|
||||
|
||||
working_umask_or_skip_
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
touch f slink-target || framework_failure
|
||||
ln -s slink-target slink || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir d e || framework_failure
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir dir1 dir2 || framework_failure
|
||||
touch dir1/file || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir dir || framework_failure
|
||||
touch file || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
require_membership_in_two_groups_
|
||||
|
||||
|
||||
@@ -15,12 +15,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
skip_if_root_
|
||||
|
||||
chmod g-s . || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
|
||||
require_local_dir_
|
||||
|
||||
@@ -21,12 +21,8 @@
|
||||
# Now it gives this:
|
||||
# cp: can't copy a directory `dir' into itself `dir/dir'
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir a dir || framework_failure
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
touch src || framework_failure
|
||||
touch dest || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
expensive_
|
||||
require_ulimit_
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
ln -s no-such-file dangling-slink || framework_failure
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
touch a || framework_failure
|
||||
ln a b || framework_failure
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir a b
|
||||
msg=bar
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir b
|
||||
msg=bar
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
msg=bar
|
||||
echo $msg > a
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
working_umask_or_skip_
|
||||
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
|
||||
require_local_dir_
|
||||
|
||||
@@ -16,13 +16,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
mv --version
|
||||
fi
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp mv
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
very_expensive_
|
||||
|
||||
umask 037
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
# cp -p gives ENOTSUP on NFS on Linux 2.6.9 at least
|
||||
require_local_dir_
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
require_root_
|
||||
|
||||
# Some of the tests expect a umask that grants group and/or world read access.
|
||||
@@ -58,11 +60,6 @@ t1() {
|
||||
"$nameless_uid" "$@"
|
||||
}
|
||||
|
||||
if test "x$VERBOSE" = xyes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
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 }'`
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
grep '^#define HAVE_UTIMENSAT 1' "$CONFIG_HEADER" > /dev/null ||
|
||||
grep '^#define HAVE_LUTIMES 1' "$CONFIG_HEADER" > /dev/null ||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
kall=/proc/kallsyms
|
||||
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
touch empty || framework_failure
|
||||
|
||||
|
||||
@@ -20,12 +20,8 @@
|
||||
# though now such usage evokes a warning:
|
||||
# cp: `slink': WARNING: using -r to copy symbolic links is not portable
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
echo abc > foo || framework_failure
|
||||
ln -s foo slink || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
cleanup_() { rm -rf "$other_partition_tmpdir"; }
|
||||
. "$abs_srcdir/other-fs-tmpdir"
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
|
||||
: > time_check
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
# Unset CDPATH. Otherwise, output from the `cd dir' command
|
||||
# can make this test fail.
|
||||
@@ -46,7 +42,7 @@ test $hard_link_to_symlink_does_the_deref = yes \
|
||||
actual=actual-$$
|
||||
expected=expected-$$
|
||||
|
||||
exec 1> $actual
|
||||
exec 3>&1 1> $actual
|
||||
|
||||
# FIXME: This should be bigger: like more than 8k
|
||||
contents=XYZ
|
||||
@@ -220,6 +216,7 @@ cat <<\EOF | sed "$remove_these_sed" > $expected
|
||||
|
||||
EOF
|
||||
|
||||
exec 1>&3 3>&-
|
||||
|
||||
compare $expected $actual 1>&2 || fail=1
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
touch file || framework_failure
|
||||
ln -s file a || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
require_sparse_support_
|
||||
|
||||
# Create a sparse file.
|
||||
|
||||
@@ -20,12 +20,8 @@
|
||||
# This test would fail due to a bug introduced in 4.0y.
|
||||
# The bug was fixed in 4.0z.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
require_root_
|
||||
|
||||
touch a b c || framework_failure
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkfifo fifo ||
|
||||
skip_test_ "fifos not supported"
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir x y || framework_failure
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
mkdir dir || framework_failure
|
||||
ln -s dir symlink || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
cp --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ cp
|
||||
|
||||
ln -s no-such dangle || framework_failure
|
||||
echo hi > f || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
dd --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ dd
|
||||
|
||||
truncate -s 8192 in || framework_failure
|
||||
dd if=in oflag=direct of=out 2> /dev/null \
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
dd --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ dd
|
||||
|
||||
tmp_in=dd-in.$$
|
||||
tmp_in2=dd-in2.$$
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
dd --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ dd
|
||||
|
||||
|
||||
echo abcde > in
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
dd --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ dd
|
||||
|
||||
# 2 short reads -> 1 full write + 1 partial write
|
||||
cat <<\EOF > exp-reblock || framework_failure
|
||||
|
||||
@@ -16,12 +16,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
dd --version
|
||||
fi
|
||||
|
||||
. $srcdir/test-lib.sh
|
||||
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
print_ver_ dd
|
||||
|
||||
# need write access to local device
|
||||
# (even though we don't actually write anything)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user