Re: `cp -l` doesn't work correctly on some macOS versions

Paul Eggert <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 2024-02-02 22:45, Werner LEMBERG wrote:

> I looked into the autoconf info files, section
> 'Limitations of usual tools', and 'cp -l' wasn't explictly mentioned,

Although tt's expecting a bit much for the Autoconf manual to say every 
option that *isn't* portable, as there are so many (and they 
proliferate), the manual could be better about what *is* portable and I 
installed the attached.
0001-Document-cp-limitations-better.patch (text/x-patch, 2 KB)
From 163dade069be64df7cce5c6d48fdcb56188a6f60 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 3 Feb 2024 21:37:49 -0800
Subject: [PATCH] =?UTF-8?q?Document=20=E2=80=98cp=E2=80=99=20limitations?=
 =?UTF-8?q?=20better?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* doc/autoconf.texi (Limitations of Usual Tools):
Modernize discussion of ‘cp’.
---
 doc/autoconf.texi | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index bcd35195..186c033b 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -19288,28 +19288,9 @@ newline encoding.
 @item @command{cp}
 @c ---------------
 @prindex @command{cp}
-Avoid the @option{-r} option, since Posix 1003.1-2004 marks it as
-obsolescent and its behavior on special files is implementation-defined.
-Use @option{-R} instead.  On GNU hosts the two options
-are equivalent, but on Solaris hosts (for example) @code{cp -r}
-reads from pipes instead of replicating them.  AIX 5.3 @code{cp -R} may
-corrupt its own memory with some directory hierarchies and error out or
-dump core:
-
-@example
-@kbd{mkdir -p 12345678/12345678/12345678/12345678}
-@kbd{touch 12345678/12345678/x}
-@kbd{cp -R 12345678 t}
-cp: 0653-440 12345678/12345678/: name too long.
-@end example
-
-Some @command{cp} implementations (e.g., BSD/OS 4.2) do not allow
-trailing slashes at the end of nonexistent destination directories.  To
-avoid this problem, omit the trailing slashes.  For example, use
-@samp{cp -R source /tmp/newdir} rather than @samp{cp -R source
-/tmp/newdir/} if @file{/tmp/newdir} does not exist.
-
-The @option{-f} option is portable nowadays.
+The @option{-i}, @option{-f}, @option{-p} and @option{-R} options are
+widely used.  POSIX also specifies @option{-H}, @option{-L}, and
+@option{-P}.  Avoid other options in portable scripts.
 
 @cindex timestamp resolution
 Traditionally, file timestamps had 1-second resolution, and @samp{cp
-- 
2.40.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.