bug-coreutils
[Top][All Lists]
Advanced

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

bug#24244: bug: dd deletes file


From: Pádraig Brady
Subject: bug#24244: bug: dd deletes file
Date: Tue, 16 Aug 2016 17:03:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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







reply via email to

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