History log of /netbsd-current/bin/mv/mv.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.46 24-Jun-2020 riastradh

New mv -h option.

`mv -h source target' just issues rename(source, target) without
discriminating on whether target resolves to a directory; this way
you can atomically replace a symlink to a directory.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.45 28-Feb-2016 mrg

branches: 1.45.16;
add SIGINFO for mv(1), largely based upon the support in cp(1).


# 1.44 02-Mar-2015 enami

Don't truncate at microseconds while preserving timestamps.

One of motivation of this change is to make the behavior of test(1)
-nt/ot with preserved copy (like cp -p) closer to the NetBSD 6.
Of course whether full timestamps are kept or not depends also on
underlying file system.

The ifdef added in mv(1) since existing ifdefs was our local change
to compile it on solaris (though I couldn't test it):
http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html


Revision tags: netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 29-Aug-2011 joerg

branches: 1.43.22; 1.43.24;
static + __dead


# 1.42 03-Aug-2011 manu

Make cp -p and mv preverve extended attributes, and complain if they cannot.

Also introduce library functions for copying extended attributes from one
file to another:
- extattr_copy_file, extattr_copy_fd, extattr_copy_link, with FreeBSD style,
where a namespace is to be supplied
- cpxattr, fcpxattr, lcpxattr, with Linux style, where all namespaces
accessible to the caller are copied, and the others are silently ignored.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.41 20-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.40 25-May-2008 christos

PR/38738: murray armfield: Fix type of blen, and reset it on error path. From
OpenBSD.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.39 16-Jan-2008 hubertf

branches: 1.39.4; 1.39.6;
Code cleanup:
- Removed case '?' before default in switch
- Don't forget to close opened decriptors when malloc() fails
- Hold vfork() result in variable with pid_t type (instead of int)

Sent ages ago by Slava Semushin <php-coder@altlinux.ru> in private mail.


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base
# 1.38 15-Feb-2007 rillig

branches: 1.38.4;
Allow files whose name starts with a dash be moved across filesystem
boundaries.

This fix was inspired by the recent -froot zero day exploit for Solaris.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
# 1.37 23-Sep-2006 elad

PR/33396: Christian Biere: Global Warming may be caused by mv(1)
Applied patch, thanks!


# 1.36 21-Aug-2006 christos

- detect buffer overflow.
- if we have a trailing slash, don't add another one.


Revision tags: abandoned-netbsd-4-base
# 1.35 03-Jun-2005 hubertf

branches: 1.35.2;
the case of waitpid() returning an error was already tested, and errno
printed for that case. the tests for the return code don't have errno
set, so don't try to print it.

By Liam J. Foy <liamfoy sepulcrum.org>, posted to tech-userlevel@.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 04-Jan-2004 jschauma

branches: 1.34.6;
remove unused code left from printescaped() backput as pointed out by Jeff
Ito in PR bin/23969 and PR bin/23970.


# 1.33 14-Sep-2003 jschauma

Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''


# 1.32 13-Aug-2003 itojun

use bounded string op


# 1.31 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 1.30 04-Aug-2003 jschauma

As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.


# 1.29 13-Jul-2003 itojun

use bounded string op


Revision tags: fvdl_fs64_base
# 1.28 26-Dec-2002 jrf

Added verbose extension and updated manual pages. Changes approved by Klaus Klein.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 16-Sep-2001 wiz

ANSIfy, KNF, use [gs]etprogname. By Petri Koistinen, slightly modified by me.


# 1.26 16-Jul-2000 darrenr

don't emit a warning message if fchflags() returns EOPNOTSUPP


# 1.25 15-Jul-2000 darrenr

From FreeBSD:
To make inherit file flags when mv(1) moves file between directories
on different file systems.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.24 14-Dec-1999 jdolecek

fix typo


# 1.23 09-Nov-1999 drochner

Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.


Revision tags: comdex-fall-1999-base
# 1.22 16-Aug-1999 christos

branches: 1.22.4;
make this compile on non bsd-4.4 systems


# 1.21 02-Aug-1999 sommerfeld

Fix PR8073:
bogons in mv(1) man page.
don't bother prompting for mv -i if source doesn't exist


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.20 04-Nov-1998 christos

use utimes, if we don't have futimes.


# 1.19 28-Jul-1998 mycroft

Be more retentive about use of NOTREACHED and noreturn.


# 1.18 28-Jul-1998 mycroft

Delint.


# 1.17 28-Jul-1998 mycroft

Delint.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.16 19-Oct-1997 mycroft

If we fail to set ownership, turn off SUID and SGID bits (like cp(1)).
Use futimes(2), and actually fill in the microsecond field.


# 1.15 19-Oct-1997 mikel

use lstat() instead of stat() when determining type of 'from' file;
from John F. Woods in PR bin/4288.
Also fixed a similar check of the 'to' file, so we don't try to
rmdir() symlinks to directories; and fixed typo in a comment.


# 1.14 08-Oct-1997 kleink

* Initialize native locale on startup.
* When using the form "mv src ... dir", strip off trailing slashes from
`src' arguments to provide 1003.2 semantics.


# 1.13 07-Oct-1997 hubertf

Be silend if owner can't be set on cross-device-moved.
Fixes PR bin/1223 by John F. Woods <jfw@jfwhome.funhouse.com>.


# 1.12 20-Jul-1997 christos

include <pwd.h> and <grp.h> to bring prototypes into scope.


# 1.11 20-Jul-1997 christos

Fix compiler warnings.
Add WARNS=1


# 1.10 09-Jan-1997 tls

kill use of register


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.9 21-Mar-1995 cgd

convert to new RCS id conventions.


# 1.8 22-Sep-1994 mycroft

Merge 4.4-Lite version.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.7 09-Nov-1993 jtc

Check user's response against both 'Y' and 'y' --- this is really supposed
to be a locale specific regular expression. This change hard codes POSIX
locale behavior, and will be replaced by a locale independant equivalent
as soon as locales are fully implemented.


# 1.6 22-Sep-1993 jtc

Bring even closer to POSIX.2 compliance. Add comments documenting
the steps outlined in the standards. Steps 1-5 look good, there
may be some work outstanding in the final Step 6.


# 1.5 22-Sep-1993 jtc

Bring closer to POSIX.2 compliance. The latter of any -i or -f options
is the one that is actually effective.


# 1.4 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
# 1.3 23-Mar-1993 cgd

changed "Id" to "Header" for rcsids


# 1.2 22-Mar-1993 cgd

added rcs ids to all files


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.45 28-Feb-2016 mrg

add SIGINFO for mv(1), largely based upon the support in cp(1).


# 1.44 01-Mar-2015 enami

Don't truncate at microseconds while preserving timestamps.

One of motivation of this change is to make the behavior of test(1)
-nt/ot with preserved copy (like cp -p) closer to the NetBSD 6.
Of course whether full timestamps are kept or not depends also on
underlying file system.

The ifdef added in mv(1) since existing ifdefs was our local change
to compile it on solaris (though I couldn't test it):
http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html


Revision tags: netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.43 29-Aug-2011 joerg

branches: 1.43.22; 1.43.24;
static + __dead


# 1.42 02-Aug-2011 manu

Make cp -p and mv preverve extended attributes, and complain if they cannot.

Also introduce library functions for copying extended attributes from one
file to another:
- extattr_copy_file, extattr_copy_fd, extattr_copy_link, with FreeBSD style,
where a namespace is to be supplied
- cpxattr, fcpxattr, lcpxattr, with Linux style, where all namespaces
accessible to the caller are copied, and the others are silently ignored.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.41 19-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
# 1.40 25-May-2008 christos

PR/38738: murray armfield: Fix type of blen, and reset it on error path. From
OpenBSD.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.39 16-Jan-2008 hubertf

branches: 1.39.4; 1.39.6;
Code cleanup:
- Removed case '?' before default in switch
- Don't forget to close opened decriptors when malloc() fails
- Hold vfork() result in variable with pid_t type (instead of int)

Sent ages ago by Slava Semushin <php-coder@altlinux.ru> in private mail.


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-armv6-base matt-mips64-base
# 1.38 15-Feb-2007 rillig

branches: 1.38.4;
Allow files whose name starts with a dash be moved across filesystem
boundaries.

This fix was inspired by the recent -froot zero day exploit for Solaris.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
# 1.37 23-Sep-2006 elad

PR/33396: Christian Biere: Global Warming may be caused by mv(1)
Applied patch, thanks!


# 1.36 21-Aug-2006 christos

- detect buffer overflow.
- if we have a trailing slash, don't add another one.


Revision tags: abandoned-netbsd-4-base
# 1.35 03-Jun-2005 hubertf

branches: 1.35.2;
the case of waitpid() returning an error was already tested, and errno
printed for that case. the tests for the return code don't have errno
set, so don't try to print it.

By Liam J. Foy <liamfoy sepulcrum.org>, posted to tech-userlevel@.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 04-Jan-2004 jschauma

branches: 1.34.6;
remove unused code left from printescaped() backput as pointed out by Jeff
Ito in PR bin/23969 and PR bin/23970.


# 1.33 14-Sep-2003 jschauma

Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''


# 1.32 12-Aug-2003 itojun

use bounded string op


# 1.31 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 1.30 04-Aug-2003 jschauma

As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.


# 1.29 13-Jul-2003 itojun

use bounded string op


Revision tags: fvdl_fs64_base
# 1.28 26-Dec-2002 jrf

Added verbose extension and updated manual pages. Changes approved by Klaus Klein.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.27 16-Sep-2001 wiz

ANSIfy, KNF, use [gs]etprogname. By Petri Koistinen, slightly modified by me.


# 1.26 15-Jul-2000 darrenr

don't emit a warning message if fchflags() returns EOPNOTSUPP


# 1.25 15-Jul-2000 darrenr

From FreeBSD:
To make inherit file flags when mv(1) moves file between directories
on different file systems.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.24 14-Dec-1999 jdolecek

fix typo


# 1.23 09-Nov-1999 drochner

Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.


Revision tags: comdex-fall-1999-base
# 1.22 16-Aug-1999 christos

branches: 1.22.4;
make this compile on non bsd-4.4 systems


# 1.21 01-Aug-1999 sommerfeld

Fix PR8073:
bogons in mv(1) man page.
don't bother prompting for mv -i if source doesn't exist


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.20 04-Nov-1998 christos

use utimes, if we don't have futimes.


# 1.19 28-Jul-1998 mycroft

Be more retentive about use of NOTREACHED and noreturn.


# 1.18 27-Jul-1998 mycroft

Delint.


# 1.17 27-Jul-1998 mycroft

Delint.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.16 18-Oct-1997 mycroft

If we fail to set ownership, turn off SUID and SGID bits (like cp(1)).
Use futimes(2), and actually fill in the microsecond field.


# 1.15 18-Oct-1997 mikel

use lstat() instead of stat() when determining type of 'from' file;
from John F. Woods in PR bin/4288.
Also fixed a similar check of the 'to' file, so we don't try to
rmdir() symlinks to directories; and fixed typo in a comment.


# 1.14 08-Oct-1997 kleink

* Initialize native locale on startup.
* When using the form "mv src ... dir", strip off trailing slashes from
`src' arguments to provide 1003.2 semantics.


# 1.13 06-Oct-1997 hubertf

Be silend if owner can't be set on cross-device-moved.
Fixes PR bin/1223 by John F. Woods <jfw@jfwhome.funhouse.com>.


# 1.12 20-Jul-1997 christos

include <pwd.h> and <grp.h> to bring prototypes into scope.


# 1.11 20-Jul-1997 christos

Fix compiler warnings.
Add WARNS=1


# 1.10 09-Jan-1997 tls

kill use of register


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.9 21-Mar-1995 cgd

convert to new RCS id conventions.


# 1.8 22-Sep-1994 mycroft

Merge 4.4-Lite version.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.7 09-Nov-1993 jtc

Check user's response against both 'Y' and 'y' --- this is really supposed
to be a locale specific regular expression. This change hard codes POSIX
locale behavior, and will be replaced by a locale independant equivalent
as soon as locales are fully implemented.


# 1.6 22-Sep-1993 jtc

Bring even closer to POSIX.2 compliance. Add comments documenting
the steps outlined in the standards. Steps 1-5 look good, there
may be some work outstanding in the final Step 6.


# 1.5 21-Sep-1993 jtc

Bring closer to POSIX.2 compliance. The latter of any -i or -f options
is the one that is actually effective.


# 1.4 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
# 1.3 22-Mar-1993 cgd

changed "Id" to "Header" for rcsids


# 1.2 22-Mar-1993 cgd

added rcs ids to all files


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.44 01-Mar-2015 enami

Don't truncate at microseconds while preserving timestamps.

One of motivation of this change is to make the behavior of test(1)
-nt/ot with preserved copy (like cp -p) closer to the NetBSD 6.
Of course whether full timestamps are kept or not depends also on
underlying file system.

The ifdef added in mv(1) since existing ifdefs was our local change
to compile it on solaris (though I couldn't test it):
http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html


# 1.43 29-Aug-2011 joerg

static + __dead


# 1.42 02-Aug-2011 manu

Make cp -p and mv preverve extended attributes, and complain if they cannot.

Also introduce library functions for copying extended attributes from one
file to another:
- extattr_copy_file, extattr_copy_fd, extattr_copy_link, with FreeBSD style,
where a namespace is to be supplied
- cpxattr, fcpxattr, lcpxattr, with Linux style, where all namespaces
accessible to the caller are copied, and the others are silently ignored.


# 1.41 19-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


# 1.40 25-May-2008 christos

PR/38738: murray armfield: Fix type of blen, and reset it on error path. From
OpenBSD.


# 1.39 16-Jan-2008 hubertf

branches: 1.39.4; 1.39.6;
Code cleanup:
- Removed case '?' before default in switch
- Don't forget to close opened decriptors when malloc() fails
- Hold vfork() result in variable with pid_t type (instead of int)

Sent ages ago by Slava Semushin <php-coder@altlinux.ru> in private mail.


# 1.38 15-Feb-2007 rillig

branches: 1.38.4;
Allow files whose name starts with a dash be moved across filesystem
boundaries.

This fix was inspired by the recent -froot zero day exploit for Solaris.


# 1.37 22-Sep-2006 elad

PR/33396: Christian Biere: Global Warming may be caused by mv(1)
Applied patch, thanks!


# 1.36 21-Aug-2006 christos

- detect buffer overflow.
- if we have a trailing slash, don't add another one.


# 1.35 03-Jun-2005 hubertf

branches: 1.35.2;
the case of waitpid() returning an error was already tested, and errno
printed for that case. the tests for the return code don't have errno
set, so don't try to print it.

By Liam J. Foy <liamfoy sepulcrum.org>, posted to tech-userlevel@.


# 1.34 04-Jan-2004 jschauma

branches: 1.34.6;
remove unused code left from printescaped() backput as pointed out by Jeff
Ito in PR bin/23969 and PR bin/23970.


# 1.33 14-Sep-2003 jschauma

Following private discussion with kleink@ and hubertf@ and public discussion
on tech-userlevel@, back out printescaped() functionality.
kleink: ``We sell rope.''


# 1.32 12-Aug-2003 itojun

use bounded string op


# 1.31 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.


# 1.30 04-Aug-2003 jschauma

As discusses a little while back on tech-userlevel:

If stdout is a tty, use vis(3) to print any filenames to prevent garbage
from being printed if the filename contains control- or other non-printable
characters.

While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.


# 1.29 13-Jul-2003 itojun

use bounded string op


# 1.28 26-Dec-2002 jrf

Added verbose extension and updated manual pages. Changes approved by Klaus Klein.


# 1.27 16-Sep-2001 wiz

ANSIfy, KNF, use [gs]etprogname. By Petri Koistinen, slightly modified by me.


# 1.26 15-Jul-2000 darrenr

don't emit a warning message if fchflags() returns EOPNOTSUPP


# 1.25 15-Jul-2000 darrenr

From FreeBSD:
To make inherit file flags when mv(1) moves file between directories
on different file systems.


# 1.24 13-Dec-1999 jdolecek

fix typo


# 1.23 09-Nov-1999 drochner

Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.


# 1.22 16-Aug-1999 christos

branches: 1.22.4;
make this compile on non bsd-4.4 systems


# 1.21 01-Aug-1999 sommerfeld

Fix PR8073:
bogons in mv(1) man page.
don't bother prompting for mv -i if source doesn't exist


# 1.20 04-Nov-1998 christos

use utimes, if we don't have futimes.


# 1.19 28-Jul-1998 mycroft

Be more retentive about use of NOTREACHED and noreturn.


# 1.18 27-Jul-1998 mycroft

Delint.


# 1.17 27-Jul-1998 mycroft

Delint.


# 1.16 19-Oct-1997 mycroft

If we fail to set ownership, turn off SUID and SGID bits (like cp(1)).
Use futimes(2), and actually fill in the microsecond field.


# 1.15 18-Oct-1997 mikel

use lstat() instead of stat() when determining type of 'from' file;
from John F. Woods in PR bin/4288.
Also fixed a similar check of the 'to' file, so we don't try to
rmdir() symlinks to directories; and fixed typo in a comment.


# 1.14 08-Oct-1997 kleink

* Initialize native locale on startup.
* When using the form "mv src ... dir", strip off trailing slashes from
`src' arguments to provide 1003.2 semantics.


# 1.13 06-Oct-1997 hubertf

Be silend if owner can't be set on cross-device-moved.
Fixes PR bin/1223 by John F. Woods <jfw@jfwhome.funhouse.com>.


# 1.12 20-Jul-1997 christos

include <pwd.h> and <grp.h> to bring prototypes into scope.


# 1.11 20-Jul-1997 christos

Fix compiler warnings.
Add WARNS=1


# 1.10 09-Jan-1997 tls

kill use of register


# 1.9 21-Mar-1995 cgd

convert to new RCS id conventions.


# 1.8 22-Sep-1994 mycroft

Merge 4.4-Lite version.


# 1.7 09-Nov-1993 jtc

Check user's response against both 'Y' and 'y' --- this is really supposed
to be a locale specific regular expression. This change hard codes POSIX
locale behavior, and will be replaced by a locale independant equivalent
as soon as locales are fully implemented.


# 1.6 22-Sep-1993 jtc

Bring even closer to POSIX.2 compliance. Add comments documenting
the steps outlined in the standards. Steps 1-5 look good, there
may be some work outstanding in the final Step 6.


# 1.5 21-Sep-1993 jtc

Bring closer to POSIX.2 compliance. The latter of any -i or -f options
is the one that is actually effective.


# 1.4 01-Aug-1993 mycroft

Add RCS identifiers.


# 1.3 22-Mar-1993 cgd

changed "Id" to "Header" for rcsids


# 1.2 22-Mar-1993 cgd

added rcs ids to all files


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.1.1.2 21-Sep-1994 mycroft

Import original 4.4-Lite version.


# 1.1.1.1 21-Mar-1993 cgd

initial import of 386bsd-0.1 sources


# 1.22.4.1 27-Dec-1999 wrstuden

Pull up to last week's -current.


# 1.34.6.1 30-Jul-2005 tron

Pull up revision 1.35 (requested by hubertf in ticket #619):
the case of waitpid() returning an error was already tested, and errno
printed for that case. the tests for the return code don't have errno
set, so don't try to print it.
By Liam J. Foy <liamfoy sepulcrum.org>, posted to tech-userlevel@.


# 1.35.2.1 26-Aug-2006 riz

Pull up following revision(s) (requested by christos in ticket #53):
bin/df/df.c: revision 1.71
bin/mv/mv.c: revision 1.36
bin/ls/ls.1: revision 1.61
bin/ls/ls.c: revision 1.60
-h and -[mgk] are mutually exclusive. Only use the last specified. [from zafer]
Use one variable instead of 3 flags to hold the scale, so that we don't have
to reset each flag.
from zafer: you can have either -k or -h but not both since it does not make
sense.
- detect buffer overflow.
- if we have a trailing slash, don't add another one.


# 1.38.4.1 22-Mar-2008 matt

sync with HEAD


# 1.39.6.2 17-Sep-2008 wrstuden

Sync with wrstuden-revivesa-base-2.


# 1.39.6.1 22-Jun-2008 wrstuden

Sync w/ -current. 34 merge conflicts to follow.


# 1.39.4.1 03-Jun-2008 yamt

sync with head