mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
* NEWS: dd bs= operands now silently override later ibs= and obs=,
as POSIX requires. * src/dd.c (scanargs): Implement it. * tests/dd/misc (outbytes): Test it. * doc/coreutils.texi (dd invocation): Specify that bs=N overrides later ibs and obs, undoing part of the previous change. (The behavior was wrong.)
This commit is contained in:
committed by
Jim Meyering
parent
699188aa87
commit
f24ff8f42b
10
ChangeLog
10
ChangeLog
@@ -1,6 +1,12 @@
|
||||
2006-12-21 Jim Meyering <jim@meyering.net>
|
||||
2006-12-21 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* Makefile.maint (patch-check): Fix shell quoting.
|
||||
* NEWS: dd bs= operands now silently override later ibs= and obs=,
|
||||
as POSIX requires.
|
||||
* src/dd.c (scanargs): Implement it.
|
||||
* tests/dd/misc (outbytes): Test it.
|
||||
* doc/coreutils.texi (dd invocation): Specify that bs=N
|
||||
overrides later ibs and obs, undoing part of the
|
||||
previous change. (The behavior was wrong.)
|
||||
|
||||
2006-12-20 Jim Meyering <jim@meyering.net>
|
||||
|
||||
|
||||
3
NEWS
3
NEWS
@@ -14,6 +14,9 @@ GNU coreutils NEWS -*- outline -*-
|
||||
more file arguments. This was due to a double-free bug, introduced
|
||||
in coreutils-5.3.0.
|
||||
|
||||
dd bs= operands now silently override any later ibs= and obs=
|
||||
operands, as POSIX and tradition require.
|
||||
|
||||
A cross-partition "mv /etc/passwd ~" (by non-root) now prints
|
||||
a reasonable diagnostic. Before, it would print this:
|
||||
"mv: cannot remove `/etc/passwd': Not a directory".
|
||||
|
||||
@@ -7170,7 +7170,7 @@ This makes @command{dd} write @var{bytes} per block.
|
||||
@cindex block size
|
||||
Set both input and output block sizes to @var{bytes}.
|
||||
This makes @command{dd} read and write @var{bytes} per block,
|
||||
overriding any preceding @samp{ibs} and @samp{obs} settings.
|
||||
overriding any @samp{ibs} and @samp{obs} settings.
|
||||
|
||||
@item cbs=@var{bytes}
|
||||
@opindex cbs
|
||||
|
||||
6
src/dd.c
6
src/dd.c
@@ -873,6 +873,7 @@ static void
|
||||
scanargs (int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
size_t blocksize = 0;
|
||||
|
||||
for (i = optind; i < argc; i++)
|
||||
{
|
||||
@@ -923,7 +924,7 @@ scanargs (int argc, char **argv)
|
||||
else if (STREQ (name, "bs"))
|
||||
{
|
||||
invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (INPUT_BLOCK_SLOP));
|
||||
output_blocksize = input_blocksize = n;
|
||||
blocksize = n;
|
||||
}
|
||||
else if (STREQ (name, "cbs"))
|
||||
{
|
||||
@@ -948,6 +949,9 @@ scanargs (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (blocksize)
|
||||
input_blocksize = output_blocksize = blocksize;
|
||||
|
||||
/* If bs= was given, both `input_blocksize' and `output_blocksize' will
|
||||
have been set to positive values. If either has not been set,
|
||||
bs= was not given, so make sure two buffers are used. */
|
||||
|
||||
@@ -74,6 +74,9 @@ if dd oflag=nolinks if=$tmp_in of=$tmp_out 2> /dev/null; then
|
||||
dd oflag=nolinks < $tmp_in > $tmp_out 2>&1 || fail=1
|
||||
fi
|
||||
|
||||
outbytes=`echo x | dd bs=3 ibs=10 obs=10 conv=sync 2>/dev/null | wc -c`
|
||||
test "$outbytes" -eq 3 || fail=1
|
||||
|
||||
rm -f $tmp_in $tmp_in2 $tmp_sym $tmp_out
|
||||
|
||||
exit $fail
|
||||
|
||||
Reference in New Issue
Block a user