bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dd duplicated option bug (or is it a feature?)


From: Bob Proulx
Subject: Re: dd duplicated option bug (or is it a feature?)
Date: Sun, 7 Aug 2005 23:57:35 -0600
User-agent: Mutt/1.5.9i

Fabrício Barros Cabral wrote:
> I don't know if I found a bug or if it is a feature. The problema is
> related to duplicated name of options. See:
> 
> address@hidden:~$ dd of=me of=you
> 
> dd stay in a infinite loop, until I press ctrl + d. The result is a only
> file named "you" with nothing inside it.

Thanks for the report and the patch.  But what you are seeing is not a
bug.  It is normal behavior.

The default behavior of dd is to copy files from standard input to
standard output.  Since you only specified an option for the output,
two different options actually with the last one overriding the first
one, the dd program is reading standard input.  It is not in an
infinite loop.  When you type in ctrl-d this is processed as an end of
file by the tty driver.  The tty driver is simulating an end of file
on standard input to the dd program.

You can verify this by redirecting the input from a file such as
/dev/null.  There is no infinite loop, even with two file output
options.

  dd of=me of=you < /dev/null
  0+0 records in
  0+0 records out
  0 bytes transferred in 0.000041 seconds (0 bytes/sec)

  echo | dd of=me of=you
  0+1 records in
  0+1 records out
  1 bytes transferred in 0.000126 seconds (7929 bytes/sec)

This is the same as grep, awk, sed and most unix filtering commands.
They all read standard input if no other input file is specified.

> So, if is it a bug, please consider my patch.

Thanks for the patch.  However looking at it I don't think it does
what you think it does.  Fortunately I don't think a patch is really
needed since the behavior is normal.  So it does not really matter.
Just either give the filename as an option or as a shell redirection
or as a pipe from a command.

Thanks
Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]