GNU bug report logs - #19065
dd design bug

Previous Next

Package: coreutils;

Reported by: bt <bdtitus108 <at> yahoo.com>

Date: Sun, 16 Nov 2014 01:48:02 UTC

Severity: normal

Tags: moreinfo, unreproducible

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19065 in the body.
You can then email your comments to 19065 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#19065; Package coreutils. (Sun, 16 Nov 2014 01:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to bt <bdtitus108 <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 16 Nov 2014 01:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: bt <bdtitus108 <at> yahoo.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: dd design bug
Date: Sun, 16 Nov 2014 01:11:54 +0000 (UTC)
[Message part 1 (text/plain, inline)]
The following undocumented behavior of dd is (IMO) a design flaw.

If dd is used to copy one partition to another, as in

#dd if=/dev/sda3 of=/dev/sdb3 ...

and if in fact sdb3 does not exist, then dd will overwrite the first part of
an existing partition *sda1*. 

It doesn't make sense that if the "of=" device doesn't exist, then another
pre-existing device, not mentioned in the command line, is overwritten.
Several websites have incorrect information about the behavior of dd in this
situation. 
At the very least, this should be documented--maybe I'm missing something, but didn't see it in the man pages or the texinfo manual.

Thanks,B. Titus

[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#19065; Package coreutils. (Sun, 16 Nov 2014 06:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 19065 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bt <bdtitus108 <at> yahoo.com>, 19065 <at> debbugs.gnu.org
Subject: Re: bug#19065: dd design bug
Date: Sat, 15 Nov 2014 22:43:41 -0800
bt wrote:
> It doesn't make sense that if the "of=" device doesn't exist, then another
> pre-existing device, not mentioned in the command line, is overwritten.

It doesn't make sense to me, either.  But I doubt whether this is a 'dd' bug. 
It doesn't know anything about devices: it just opens /dev/sda3 for reading and 
/dev/sdb3 for writing, and it doesn't do anything smarter than that.  So if this 
trashes some other partition then it's most likely some problem with your 
partitioning.




Information forwarded to bug-coreutils <at> gnu.org:
bug#19065; Package coreutils. (Sun, 16 Nov 2014 11:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 19065 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: bt <bdtitus108 <at> yahoo.com>, 19065 <at> debbugs.gnu.org
Subject: Re: bug#19065: dd design bug
Date: Sun, 16 Nov 2014 11:55:41 +0000
On 16/11/14 01:11, bt wrote:
> The following undocumented behavior of dd is (IMO) a design flaw.
> 
> If dd is used to copy one partition to another, as in
> 
> #dd if=/dev/sda3 of=/dev/sdb3 ...
> 
> and if in fact sdb3 does not exist, then dd will overwrite the first part of
> an existing partition *sda1*. 
> 
> It doesn't make sense that if the "of=" device doesn't exist, then another
> pre-existing device, not mentioned in the command line, is overwritten.
> Several websites have incorrect information about the behavior of dd in this
> situation. 
> At the very least, this should be documented--maybe I'm missing something, but didn't see it in the man pages or the texinfo manual.

What version of dd are you seeing this with?
What operating system version are you seeing this with?

I'm struggling to see how dd could ever do this itself.
Perhaps you have a dynamic devfs on /dev or something
and when you create /dev/sdb3 it creates a device node
for /dev/sda or something?

That's a major gotcha and I would suggest passing the
conv=nocreat option to dd to avoid that behavior
(yes it would have been better called 'nocreate'
 but not worth changing now after 10 years).

cheers,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#19065; Package coreutils. (Sun, 16 Nov 2014 19:07:01 GMT) Full text and rfc822 format available.

Message #14 received at 19065 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: bt <bdtitus108 <at> yahoo.com>
Cc: 19065 <at> debbugs.gnu.org
Subject: Re: bug#19065: dd design bug
Date: Sun, 16 Nov 2014 12:05:58 -0700
tag 19065 + unreproducible moreinfo
thanks

bt wrote:
> The following undocumented behavior of dd is (IMO) a design flaw.

If dd actually did this then that would be quite annoying.  And I
could see anyone becoming very frustrated with it.  But the reason
this is not documented in dd is that dd doesn't do this.

> If dd is used to copy one partition to another, as in
> 
> #dd if=/dev/sda3 of=/dev/sdb3 ...
> 
> and if in fact sdb3 does not exist, then dd will overwrite the first part of
> an existing partition *sda1*. 

If this is happening then it is a problem with your operating system
filesystem and not the dd command.  Since dd is simply copying from
one file to another file.  If the destination file is somehow
connected to a different partition then that would be an issue for the
filesystem and not a utility using the file system.

> It doesn't make sense that if the "of=" device doesn't exist, then
> another pre-existing device, not mentioned in the command line, is
> overwritten.  Several websites have incorrect information about the
> behavior of dd in this situation.
> At the very least, this should be documented--maybe I'm missing
> something, but didn't see it in the man pages or the texinfo manual.

What you are missing is that dd in the above is acting just like 
'cp /dev/sda3 /dev/sdb3' or 'cat /dev/sda3 > /dev/sdb3' or other
simple copy commands.  Since dd is simply copying a file it doesn't
know anything about your partitioning.

If /dev/sdb3 does not exist then when dd runs it will create a file
/dev/sdb3 in /dev.  That is simply a file from the perspective of dd
or any other utility.  What handles /dev depends upon your system.
You didn't say what system you were using.  What system are you using?
How is it handling /dev?

What is in your partition table?  There are many different ways to
browse the partition table.  I am not the most proficient with parted
but parted is likely the most capable in the face of newer GPT
formats.  I am perhaps not even likely to be able to interpret the
answer but I think this information would be needed and if not me then
perhaps another may be able to interpret it.

  parted /dev/sdb unit s print

Bob




Added tag(s) unreproducible and moreinfo. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Sun, 16 Nov 2014 19:07:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#19065; Package coreutils. (Tue, 23 Oct 2018 23:04:02 GMT) Full text and rfc822 format available.

Message #19 received at 19065 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: 19065 <at> debbugs.gnu.org
Subject: Re: bug#19065: dd design bug
Date: Tue, 23 Oct 2018 17:03:41 -0600
close 19065
stop

(triaging old bugs)

On 16/11/14 12:05 PM, Bob Proulx wrote:
> 
> bt wrote:
>> The following undocumented behavior of dd is (IMO) a design flaw.
> 
> If dd actually did this then that would be quite annoying.  And I
> could see anyone becoming very frustrated with it.  But the reason
> this is not documented in dd is that dd doesn't do this.
> 
[...]
> 
> What is in your partition table?  There are many different ways to
> browse the partition table.  I am not the most proficient with parted
> but parted is likely the most capable in the face of newer GPT
> formats.  I am perhaps not even likely to be able to interpret the
> answer but I think this information would be needed and if not me then
> perhaps another may be able to interpret it.
> 
>    parted /dev/sdb unit s print
> 

With no further follow-ups to Bob's explanation in 4 years,
I'm closing this bug.

-assaf





bug closed, send any further explanations to 19065 <at> debbugs.gnu.org and bt <bdtitus108 <at> yahoo.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 23 Oct 2018 23:04:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 21 Nov 2018 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 207 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.