[klibc] dd doesn't overwrite file when new one is smaller

Martin Michlmayr tbm at cyrius.com
Mon May 15 08:48:25 PDT 2006


I found this while testing 1.3.21 on Alpha but this is a generic bug
(and not new either).  dd doesn't overwrite an existing file when the
new one is smaller:

tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ ls -l /etc/debian_version /etc/hosts
-rw-r--r-- 1 root root  17 Jun  6  2005 /etc/debian_version
-rw-r--r-- 1 root root 262 May 11 21:49 /etc/hosts

tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ cp /etc/hosts x
tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ ls -l x
-rw-r--r-- 1 tbm tbm 262 May 15 15:41 x
tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ ./dd if=/etc/debian_version of=x
0+1 records in
0+1 records out
tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ ls -l x
-rw-r--r-- 1 tbm tbm 262 May 15 15:41 x

tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ cp /etc/debian_version x
tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ ls -l x
-rw-r--r-- 1 tbm tbm 17 May 15 15:42 x
tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ ./dd if=/etc/hosts of=x
0+1 records in
0+1 records out
tbm at juist:~/src/klibc-1.3.21/usr/utils/static$ ls -l x
-rw-r--r-- 1 tbm tbm 262 May 15 15:42 x
tbm at juist:~/src/klibc-1.3.21/usr/utils/static$

-- 
Martin Michlmayr
http://www.cyrius.com/



More information about the klibc mailing list