This blog post is odd because it keeps on hinting about a difference between `-r' and `-R' and links to the source code but never actually says what it is. I'll quote the OpenBSD manual that the post mentions but does not link to for some reason:
> Historic versions of the cp utility had an -r option. This implementation supports that option; however, its use is strongly discouraged, as it does not correctly copy special files, symbolic links or FIFOs.
Only clear to those with a heavy UNIX background-- I understood and correctly interpreted it on first read, but the concept of a "regular file" is a bit in the wonk territory for most users, though the implication on symbolic links is a very practical one that surely lead to the removal (in the implementations where it was removed) of this option, since its very surprising that copying a directory heirarchy would cause symbolic links to become copies of what they linked to, instead of remaining symbolic links in the resulting directory.
You can see it in the code, lstat vs stat and copy_special, copy_fifo vs copy_file. They're all in utils.c.
from the lstat man page:
The lstat() function is identical to stat() except when the named file is
a symbolic link, in which case lstat() returns information about the link
itself, not the file the link references.
bariumbitmap · · focus · HN ↗
> Historic versions of the cp utility had an -r option. This implementation supports that option; however, its use is strongly discouraged, as it does not correctly copy special files, symbolic links or FIFOs.
<a href="https://man.openbsd.org/cp" rel="nofollow">https://man.openbsd.org/cp
embedding-shape · · focus · HN ↗
The snippet of code makes it very clear what the difference is, no?
flag_copy_as_regular = 1 VS flag_copy_as_regular = 0, where regular would be a "regular" and not "special" file.
maxlin · · focus · HN ↗
Modified3019 · · focus · HN ↗
rezonant · · focus · HN ↗
wodenokoto · · focus · HN ↗
rakel_rakel · · focus · HN ↗
from the lstat man page:
symbolic link example: For posterity, -R with added -L