Commit Graph

98 Commits

Author SHA1 Message Date
Jilles Tjoelker
7bb3697b4e mv: Improve message when moving two or more files to non-directory.
The message text is from cp, which has had a nicer message for this since
2007 (PR bin/50656).

As with cp, the exit status changes from 64 to 1.

PR:		201083
MFC after:	1 week
2015-06-28 21:36:00 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Jilles Tjoelker
347b9f6de0 cp,mv: Use futimens() instead of utimensat() if possible. 2015-03-23 17:35:05 +00:00
Jilles Tjoelker
5faf2ae160 cp,mv,touch: Set timestamps with nanosecond precision.
This uses utimensat().
2015-01-24 13:50:13 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Xin LI
c15455feb3 Check if fchflags() is needed by fstat'ing before and check
the results.

Reviewed by:	jilles
X-MFC-With:	r267977
2014-07-01 22:46:39 +00:00
Xin LI
e6683f19dd Always set UF_ARCHIVE on target (because they are by definition new files
and should be archived) and ignore error when we can't set it (e.g. NFS).

Reviewed by:	ken
MFC after:	2 weeks
2014-06-27 19:57:54 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Julio Merino
f5fd950e35 Make bsd.test.mk the only public mk fragment for the building of tests.
Change {atf,plain,tap}.test.mk to be internal implementation details of
bsd.test.mk.  Makefiles that build tests should now only include bsd.test.mk
and declaratively specify what they want to build, without worrying about
the internal implementation of the mk files.

The reason for this change is to permit building test programs of different
interfaces from a single directory, which is something I had a need for
while porting tests over from src/tools/regression/.

Additionally, this change makes it possible to perform some other requested
changes to bsd.test.mk in an easier manner.  Coming soon.
2014-03-14 08:56:19 +00:00
Julio Merino
13de33a5dc Migrate tools/regression/bin/ tests to the new layout.
This change is a proof of concept on how to easily integrate existing
tests from the tools/regression/ hierarchy into the /usr/tests/ test
suite and on how to adapt them to the new layout for src.

To achieve these goals, this change:

- Moves tests from tools/regression/bin/<tool>/ to bin/<tool>/tests/.
- Renames the previous regress.sh files to legacy_test.sh.
- Adds Makefiles to build and install the tests and all their supporting
  data files into /usr/tests/bin/.
- Plugs the legacy_test test programs into the test suite using the new
  TAP backend for Kyua (appearing in 0.8) so that the code of the test
  programs does not have to change.
- Registers the new directories in the BSD.test.dist mtree file.

Reviewed by:	freebsd-testing
Approved by:	rpaulo (mentor)
2013-12-11 04:09:17 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Pawel Jakub Dawidek
b4b2596b97 - Make 'flags' argument to chflags(2), fchflags(2) and lchflags(2) of type
u_long. Before this change it was of type int for syscalls, but prototypes
  in sys/stat.h and documentation for chflags(2) and fchflags(2) (but not
  for lchflags(2)) stated that it was u_long. Now some related functions
  use u_long type for flags (strtofflags(3), fflagstostr(3)).
- Make path argument of type 'const char *' for consistency.

Discussed on:	arch
Sponsored by:	The FreeBSD Foundation
2013-03-21 22:44:33 +00:00
Joel Dahl
e9e3a1ab1f Add a few examples.
Obtained from:	OpenBSD
2013-03-15 20:12:54 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Eitan Adler
b7d1b37159 Follow the behavior as specified in POSIX:
if (exists AND (NOT f_option) AND
	((not_writable AND input_is_terminal) OR i_option))
		prompt

in particular, add the test for input_is_terminal

PR:		bin/173039
Submitted by:	Mark Johnston <markjdb@gmail.com>
Approved by:	cperciva
MFC after:	3 days
2012-11-15 15:05:51 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
John Baldwin
6ce6b6c1d4 Add a -h flag similar to the -h flag for ln to force mv(1) to treat a
symbolic link to a directory for the target as a symbolic link instead of
a directory.  This makes it possible to atomically update a symbolic
link using rename().

Reviewed by:	gj
MFC after:	2 weeks
2012-08-31 14:35:01 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Ed Schouten
f9d4afb439 Put some static keywords in the source code.
For these simple utilities, it doesn't harm to make all global variables
static. In fact, this allows the compiler to perform better forms of
optimisation and analysis.
2011-10-31 08:59:17 +00:00
Ivan Voras
a23ffe9673 Don't chop IO into small pieces, follow cp(1) and just use MAXPHYS. 2011-10-03 21:48:10 +00:00
Edward Tomasz Napierala
62efc229e7 Add NFSv4 ACL support to mv(1).
Reviewed by:	rwatson
2009-09-04 21:49:37 +00:00
Xin LI
95aaf2e8a4 Staticify symbols that will not be used in other
places.
2008-07-19 00:13:26 +00:00
Diomidis Spinellis
961fdc4fac - Roll-back attempts to mimic rename(2) atomicity introduced in 1.47,
and follow the letter of the POSIX specification.

- Moving a directory to an existing non-empty directory will now fail,
  as required.

- Improve consistency and remove some style bugs of earlier versions.

This version passes all tests of tools/regression/bin/mv/regress.sh 1.6

Reviewed by:	bde
MFC after:	1 month
2007-12-27 11:33:42 +00:00
Diomidis Spinellis
3db8241bb4 Calling any function from vfork other than exec* and _exit yields
undefined behavior.

Noted by:	alfred
2007-12-17 09:02:42 +00:00
Diomidis Spinellis
2ec43f35f4 Eliminate gcc "variable clobbered" warnings by declaring the variables
living across the vfork as volatile.

Noted by:	kan
2007-12-16 17:47:34 +00:00
Diomidis Spinellis
3a44a28835 When moving a directory across devices to a place where a directory
with the same name exists, delete that directory first, before performing
the copy.  This ensures that mv(1) across devices follows the semantics
of rename(2), as required by POSIX.

This change could introduce the potential of data loss, even if the
copy fails, violating the atomicity properties of rename(2).  This is
(mostly) mitigated by first renaming the destination and obliterating
it only after a succesfull copy.

The above logic also led to the introduction of code that will cleanup
the results of a partial copy, if a cross-device copy fails.

PR:		bin/118367
MFC after:	1 month
2007-12-16 14:14:31 +00:00
Ruslan Ermilov
c930322c40 Bump document date on behalf of previous revision. 2007-11-01 09:49:45 +00:00
Pav Lucistnik
a3f58dae59 Replace a fairly opaque sentence with a much clearer wording from NetBSD.
PR:		docs/101330 (inspired by)
Submitted by:	Peter Gildea <peter@gildea.com>
Obtained from:	NetBSD
2007-05-12 22:18:27 +00:00
Christian S.J. Peron
9b4261c9b4 Attempt to complete the userspace integration of POSIX.1e extended ACLs.
This includes adding support for ACLs into cp(1) and mv(1) userspace
utilities.

For mv(1), if _PC_ACL_EXTENDED is in effect for the source AND destination
operands, the destination file's ACLs shall reflect the source.

For cp(1), if _PC_ACL_EXTENDED is in effect for both source and destination
operands, and -p has been specified, the ACLs from the source shall be
preserved on the destination.

MFC after:	1 month
2005-09-05 04:36:08 +00:00
Maxime Henrion
8835fa2759 Correct a few places where we called warn() when warnx() should have
been used.

Submitted by:	"Liam J. Foy" <liamfoy@sepulcrum.org>
Obtained from:	DragonFlyBSD
2005-05-19 21:33:48 +00:00
Ruslan Ermilov
6fca4c7c3f Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.
2005-01-16 16:41:59 +00:00
Warner Losh
9ddb49cbe4 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Pawel Jakub Dawidek
3184e92100 When symbolic link is pointed onto a mount point, it can't be moved
to a different file system.
Patch in PR was incorrect.

PR:		bin/64430
Submitted by:	Samuel Tardieu
MFC after:	3 days
2004-03-21 13:38:37 +00:00
David E. O'Brien
8d5c19ffbc Centralize _PATH_* definitions.
Submitted by:	Tim Kientzle <kientzle@acm.org> (embellished by me)
2003-05-05 22:49:23 +00:00
David E. O'Brien
09a80d4867 Quiet warnings about copyright[]. 2003-05-01 16:58:57 +00:00
Giorgos Keramidas
99479039bb Grammar fix.
PR:		docs/42021
Submitted by:	Jeff Ito <jeffi@rcn.com>
MFC after:	3 days
2002-08-26 06:16:51 +00:00
Tom Rhodes
7d971bbf29 s/filesystem/file system/ as discussed on -developers 2002-08-21 17:32:44 +00:00
Ruslan Ermilov
ca38f0ddf7 mdoc(7) police: tidy up, bump document date on behalf of the -n option. 2002-08-09 10:46:00 +00:00
Johan Karlsson
0f7109e8c2 Update usage for the addition of -n in rev 1.35 of mv.c.
Approved by:	obrien, sheldonh (mentor).
2002-07-09 17:45:13 +00:00
Tim J. Robbins
9a81395d08 When trying to emulate a cross-device move operation with cp and rm, add
a "--" argument after the options so filenames with leading dashes are
handled correctly.

PR:		39318
Submitted by:	Serge van den Boom <svdb@stack.nl>
MFC after:	1 week
2002-06-16 04:06:58 +00:00
Juli Mallett
71e092d1bb Remove local definition of _PATH_CP, and use <paths.h>, _PATH_CP is in the
CURRENT <paths.h>.
2002-05-17 11:38:48 +00:00