Treat an EOPNOTSUPP from fchflags() as a non-fatal case. Only warn about
it if flags were explicitly specified on the command line. Do not warn if we were merely trying to preserve flags or remove UF_NODUMP. NFS does not support flags. I'm not sure that this is ideal, but it should do for now. Installing a plain file onto a NFS server must work, we used to silently ignore the attempt. Doing a binary install looses the flags anyway since cpio doens't preserve them with the cdrom/network images. XXX make world should not use flags or chown/chgrp in the obj/tmp area. This is based on a suggestion from Ken Merry <ken@plutotech.com>.
This commit is contained in:
parent
1b53d90e9c
commit
defff80956
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=36586
@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" From: @(#)install.1 8.1 (Berkeley) 6/6/93
|
||||
.\" $Id: install.1,v 1.10 1997/08/27 06:29:23 charnier Exp $
|
||||
.\" $Id: install.1,v 1.11 1998/01/11 11:43:34 peter Exp $
|
||||
.\"
|
||||
.Dd September 22, 1996
|
||||
.Dt INSTALL 1
|
||||
@ -176,3 +176,10 @@ utility appeared in
|
||||
Temporary files may be left in the target directory if
|
||||
.Nm
|
||||
exits abnormally.
|
||||
.Pp
|
||||
File flags cannot be set by
|
||||
.Xr fchflags 8
|
||||
over a NFS file system.
|
||||
.Nm
|
||||
will only warn when flags could not be set on a file system
|
||||
that does not support them.
|
||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "From: @(#)xinstall.c 8.1 (Berkeley) 7/21/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: xinstall.c,v 1.30 1998/01/13 02:12:43 alex Exp $";
|
||||
"$Id: xinstall.c,v 1.31 1998/01/20 13:52:32 bde Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*-
|
||||
@ -430,16 +430,15 @@ install(from_name, to_name, fset, flags)
|
||||
fprintf(stderr,
|
||||
"install: renaming for %s: %s to %s\n",
|
||||
from_name, to_name, old_to_name);
|
||||
if (verbose != 0)
|
||||
printf("install: %s -> %s\n",
|
||||
from_name, old_to_name);
|
||||
if (dopreserve && stat(from_name, ×tamp_sb) == 0) {
|
||||
utb.actime = from_sb.st_atime;
|
||||
utb.modtime = from_sb.st_mtime;
|
||||
(void)utime(to_name, &utb);
|
||||
}
|
||||
moveit:
|
||||
if (verbose) {
|
||||
printf("install: %s -> %s\n",
|
||||
from_name, old_to_name);
|
||||
}
|
||||
if (rename(to_name, old_to_name) < 0) {
|
||||
serrno = errno;
|
||||
unlink(to_name);
|
||||
@ -496,13 +495,22 @@ install(from_name, to_name, fset, flags)
|
||||
/*
|
||||
* If provided a set of flags, set them, otherwise, preserve the
|
||||
* flags, except for the dump flag.
|
||||
* NFS does not support flags. Ignore EOPNOTSUPP flags if we're just
|
||||
* trying to turn off UF_NODUMP. If we're trying to set real flags,
|
||||
* then warn if the the fs doesn't support it, otherwise fail.
|
||||
*/
|
||||
if (fchflags(to_fd,
|
||||
flags & SETFLAGS ? fset : from_sb.st_flags & ~UF_NODUMP)) {
|
||||
serrno = errno;
|
||||
(void)unlink(to_name);
|
||||
errno = serrno;
|
||||
err(EX_OSERR, "%s: chflags", to_name);
|
||||
if (flags & SETFLAGS) {
|
||||
if (errno == EOPNOTSUPP)
|
||||
warn("%s: chflags", to_name);
|
||||
else {
|
||||
serrno = errno;
|
||||
(void)unlink(to_name);
|
||||
errno = serrno;
|
||||
err(EX_OSERR, "%s: chflags", to_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(void)close(to_fd);
|
||||
|
Loading…
Reference in New Issue
Block a user