autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: cp and mv


From: Akim Demaille
Subject: FYI: cp and mv
Date: 30 Nov 2000 10:53:18 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Still flushing some tagged messages from months ago...

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * doc/autoconf.texi (Limitations of Usual Tools): Some about cp
        and mv, thanks to Ian.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.397
diff -u -u -r1.397 autoconf.texi
--- doc/autoconf.texi 2000/11/29 17:44:19 1.397
+++ doc/autoconf.texi 2000/11/30 09:46:43
@@ -5855,11 +5855,32 @@
 
 
 @item @command{cat}
address@hidden ----------------
 @cindex @command{cat}
-Don't rely on any option.
+Don't rely on any option.  The option @option{-v}, which shows
+non printing characters, @emph{seems} portable though.
 
 
address@hidden @command{cp}
address@hidden ---------------
address@hidden @command{cp}
address@hidden This is thanks to Ian.
+SunOS @command{cp} does not support @option{-f}, although its
address@hidden does.  It's possible to deduce why @command{mv} and
address@hidden are different with respect to @option{-f}.  @command{mv}
+prompts by default before overwriting a read-only file.  @command{cp}
+does not.  Therefore, @command{mv} requires a @option{-f} option, but
address@hidden does not.  @command{mv} and @command{cp} behave differently
+with respect to read-only files because the simplest form of
address@hidden cannot overwrite a read-only file, but the simplest form of
address@hidden can.  This is because @command{cp} opens the target for
+write access, whereas @command{mv} simply calls @code{link} (or, in
+newer systems, @code{rename}).
address@hidden Ian said: ``I don't think -p or -r are portable''!!! How can you 
live
address@hidden without -r???
+
 @item @command{dirname}
address@hidden --------------------
 @cindex @command{dirname}
 Not all hosts have @command{dirname}, but it is reasonably easy to
 emulate, e.g.:
@@ -6004,8 +6025,8 @@
 simple work around consists in testing @command{expr} and use a variable
 set to @command{expr} or to @command{false} according to the result.
 
-
 @item @command{grep}
address@hidden -----------------
 @cindex @command{grep}
 Don't use @samp{grep -s} to suppress output, because @samp{grep -s} on
 System V does not suppress output, only error messages.  Instead,
@@ -6019,6 +6040,7 @@
 alternation and @code{egrep}.
 
 @item @command{ln}
address@hidden ---------------
 @cindex @command{ln}
 Don't rely on @command{ln} having a @option{-f} option.  Symbolic links
 are not available on old systems, use @samp{ln} as a fall back.
@@ -6030,7 +6052,22 @@
 @file{dst.exe}. But this feature only works for executables, therefore,
 don't rely on symbolic links on @sc{djgpp}.
 
address@hidden @command{mv}
address@hidden ---------------
address@hidden @command{mv}
+The only portable options are @option{-f} and @option{-i}.
+
+Moving individual files between file systems is portable (it was in V6),
+but it is not always atomic: when doing @samp{mv new existing}, there's
+a critical section where neither the old nor the new version of
address@hidden actually exists.
+
+Moving directories across mount points is not portable, use @command{cp}
+and @command{rm}.
+
+
 @item @command{sed}
address@hidden ----------------
 @cindex @command{sed}
 Patterns should not include the separator (unless escaped), even as part
 of a character class.  In conformance with @sc{posix}, the Cray



reply via email to

[Prev in Thread] Current Thread [Next in Thread]