GNU bug report logs -
#24244
dd: protect against same file in input,output
Previous Next
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.
Full log
View this message in rfc822 format
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
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.