I have read this quote (below) several times, most recently here, and am continually puzzled at how dd
can be used to patch anything let alone a compiler:
The Unix system I used at school, 30 years ago, was very limited in RAM and Disk space. Especially, the
/usr/tmp
file system was very small, which led to problems when someone tried to compile a large program. Of course, students weren't supposed to write "large programs" anyway; large programs were typically source codes copied from "somewhere". Many of us copied/usr/bin/cc
to/home/<myname>/cc
, and useddd
to patch the binary to use/tmp
instead of/usr/tmp
, which was bigger. Of course, this just made the problem worse - the disk space occupied by these copies did matter those days, and now/tmp
filled up regularly, preventing other users from even editing their files. After they found out what happened, the sysadmins did achmod go-r /bin/* /usr/bin/*
which "fixed" the problem, and deleted all our copies of the C compiler.
(Emphasis mine)
The dd
man-page says nothing about patching and a don't think it could be re-purposed to do this anyway.
Could binaries really be patched with dd
? Is there any historical significance to this?
od
a file for the byte hex codes, find the offset you need, decide on your edit, andbs=$patchsize count=1 seek=$((offset/bs)) conv=notrunc
your patch right on in.