The term "clobber" is well-known in computing in general.
The --no-clobber
/-n
option for cp
was only added on 2009-01-14 by Kamil Dudka <kdudka@redhat.com> (commit on github).
Specifically within the GNU project, it's also used in GCC to describe when a CPU instruction or inline asm statement destroys the contents of a register. So it's not a random choice English word, and it's not unlikely that people working on GNU projects written in C would be at least familiar in passing with usage of the term from GCC docs, or from other GNU project developers using it:
(clobber x)
in GCC-internals machine description files that teach GCC what each instruction in an ISA does. (Similar constraints to inline-asm)
- GNU C Extended Asm inline
asm()
statements have a "clobber" section to tell the compiler which registers the inline asm template steps on. Like this useless nonsensical x86 example:
asm("xor %eax,%eax; mfence" ::: "eax", "memory", "cc");
. e.g. an SO Q&A asking about a function-calling convention in those terms.
- GCC docs for
-fcall-used-
reg
describe it as telling the compiler that a given register is "clobbered" by function calls (i.e. tweaks the calling convention). As opposed to -fcall-saved-
reg
or -ffixed-
reg
.
- GCC
-Wclobbered
warning - "Warn for variables that might be changed by longjmp or vfork." (IDK if this existed in 2009, but it demonstrates that this word gets used to describe this sort of thing in various contexts including option names in other programs).
The author of the coreutils commit that added --no-clobber
, Kamil Dudka, is definitely familiar with GCC internals: he (later?) wrote a GCC plugin for formal verification of C programs.
I don't know whether GCC internals influenced his choice of name, or if that came from existing shell options like set noclobber
, or both.
Fun fact: original authors of GNU cp
include Torjorn Granlund, principal author of the gmplib project (GNU Multi-Precision), and who helped invent/implement GCC's multiplicative-inverse optimization for division by a compile-time constant (1994 paper, Stack Overflow Q&A).
--no-clobber
option is not specified in POSIX. It is specific of GNU implementation.noclobber
in the shell'sset
builtin. But I don't know the timeline.-n, --noclobber
option has been introduced in coreutils version 7.1 at the beginning of year 2009.2009-01-14 Kamil Dudka <kdudka@redhat.com>