GNU bug report logs - #24244
dd: protect against same file in input,output

Previous Next

Package: coreutils;

Reported by: puggy <puggy.werner <at> gmx.at>

Date: Tue, 16 Aug 2016 15:30:02 UTC

Severity: wishlist

Tags: wontfix

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 24244 in the body.
You can then email your comments to 24244 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#24244; Package coreutils. (Tue, 16 Aug 2016 15:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to puggy <puggy.werner <at> gmx.at>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 16 Aug 2016 15:30:03 GMT) Full text and rfc822 format available.

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

From: puggy <puggy.werner <at> gmx.at>
To: bug-coreutils <at> gnu.org
Subject: bug: dd deletes file
Date: Tue, 16 Aug 2016 15:44:35 +0000
i've just found a bug in "dd".

by mistakes i used the same input and output file.
dd said it wrote 0 bytes, but what it actually did
is overwrite the file and setting it back to zero.
doing so, dd deleted a 4.3G file in a fraction of
a blink.

luckily i can download the file again. but before 
it took me 2 hours to download this file. now i 
have to download it again, wait for another 2 
hours and i can't work for this time. 2 hours for
a little mistake. 4 hours time loss!

this can't happen. mistakes happen. by simple
logics it doesn't make sense to delete a file,
just because input and output file are the same.
also there is barely anything easier to check
for.

please find some solution for it. if it is
intentional, make an option for it. this way
you can also shorten the command. otherwise 
if input and output are the same, warn the user!




Information forwarded to bug-coreutils <at> gnu.org:
bug#24244; Package coreutils. (Tue, 16 Aug 2016 16:04:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: puggy <puggy.werner <at> gmx.at>, 24244 <at> debbugs.gnu.org
Subject: Re: bug#24244: bug: dd deletes file
Date: Tue, 16 Aug 2016 17:03:53 +0100
On 16/08/16 16:44, puggy wrote:
> i've just found a bug in "dd".
> 
> by mistakes i used the same input and output file.
> dd said it wrote 0 bytes, but what it actually did
> is overwrite the file and setting it back to zero.
> doing so, dd deleted a 4.3G file in a fraction of
> a blink.
> 
> luckily i can download the file again. but before 
> it took me 2 hours to download this file. now i 
> have to download it again, wait for another 2 
> hours and i can't work for this time. 2 hours for
> a little mistake. 4 hours time loss!
> 
> this can't happen. mistakes happen. by simple
> logics it doesn't make sense to delete a file,
> just because input and output file are the same.
> also there is barely anything easier to check
> for.
> 
> please find some solution for it. if it is
> intentional, make an option for it. this way
> you can also shorten the command. otherwise 
> if input and output are the same, warn the user!

Well dd is a low level tool so we have to be careful
to not preclude operations which may be valid in some cases.
For example one might definitely want to read/write the same device.
Also conv=notrunc might be useful with regular files
to fully allocate holes etc. Maybe we could:

  if (IS_REG() && conv!=notrunc)
    disallow input==output






Information forwarded to bug-coreutils <at> gnu.org:
bug#24244; Package coreutils. (Sun, 28 Oct 2018 06:32:02 GMT) Full text and rfc822 format available.

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

From: Assaf Gordon <assafgordon <at> gmail.com>
To: 24244 <at> debbugs.gnu.org
Subject: Re: bug#24244: bug: dd deletes file
Date: Sun, 28 Oct 2018 00:30:59 -0600
retitle 24244 dd: protect against same file in input,output
severity 24244 wishlist
tags 24244 wontfix
close 24244
stop

(triaging old bugs)

On 2016-08-16 10:03 a.m., Pádraig Brady wrote:
> On 16/08/16 16:44, puggy wrote:
>> by mistakes i used the same input and output file.
>> dd said it wrote 0 bytes, but what it actually did
>> is overwrite the file and setting it back to zero.
>> doing so, dd deleted a 4.3G file in a fraction of
>> a blink.
[....]
>> please find some solution for it. if it is
>> intentional, make an option for it. this way
>> you can also shorten the command. otherwise
>> if input and output are the same, warn the user!
> 
> Well dd is a low level tool so we have to be careful
> to not preclude operations which may be valid in some cases.
> For example one might definitely want to read/write the same device.

With no further comments in 2 years, I'm closing this bug.
Discussion can continue by replying to this thread.

-assaf





Changed bug title to 'dd: protect against same file in input,output' from 'bug: dd deletes file' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 28 Oct 2018 06:32:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 28 Oct 2018 06:32:02 GMT) Full text and rfc822 format available.

Added tag(s) wontfix. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 28 Oct 2018 06:32:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 24244 <at> debbugs.gnu.org and puggy <puggy.werner <at> gmx.at> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 28 Oct 2018 06:32: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. (Sun, 25 Nov 2018 12:24:07 GMT) Full text and rfc822 format available.

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

Previous Next


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