[149] in Moira
rt 7.1D: mkserv vs. sms:/u1/sms/bin/nfs.sh
daemon@ATHENA.MIT.EDU (qjb@ATHENA.MIT.EDU)
Tue Aug 7 12:17:17 1990
From: qjb@ATHENA.MIT.EDU
Date: Tue, 7 Aug 90 12:16:35 -0400
To: testers@ATHENA.MIT.EDU
Cc: bug-moira@ATHENA.MIT.EDU
System name: soup
Type and version: RTPC-ROMPC 7.1D
Display type: apa16
What were you trying to do?
Keep credentials files updated via moira
What's wrong:
mkserv nfs causes /site/server/usr/etc/credentials to be
symbolic link to /site/usr/etc/credentials. The moira
update script, however, puts the new credentials file
in /usr/etc/credentials.new, and then after mkcred,
does mv -f to install the .dir and .pag files. This
obviously blows away the symbolic links generated by
mkserv. The next time mkserv is run, it will remove the
credentials files and the server will be without them
until the next nfs update.
What should have happened:
One of several things. Here are the ones that come to
my mind:
1. Have the moira update scripts canonicalize the path
name of /usr/etc/credentials and use that.new intead
of /usr/etc/credentials.new. That way, after mkserv
is run again, the credentials file will not be
removed.
2. Have mkserv special-case on the credentials files
I think it is clear that 1 is a better solution than 2.
There may be a better way. Following this report are
diffs to nfs.sh that will implement 1.
========== patch to /mit/moiradev/src/gen/nfs.sh ==========
*** /mit/moiradev/src/gen/nfs.sh Mon Apr 9 18:32:20 1990
--- /mit/qjb/tmp/nfs.sh Tue Aug 7 12:14:44 1990
***************
*** 59,79 ****
end
# build new credentials files.
! rm -f /usr/etc/credentials.new
! cp ${uchost}.cred /usr/etc/credentials.new
if ($status) exit $MR_NOCRED
! /usr/etc/mkcred /usr/etc/credentials.new
if ($status) exit $MR_MKCRED
# Try to install the files
foreach e ( "" .dir .pag)
! mv -f /usr/etc/credentials.new$e /usr/etc/credentials$e
end
# If any of them didn't get installed, fail
foreach e ( "" .dir .pag)
! if (! -e /usr/etc/credentials$e) exit $MR_NOCRED
end
--- 59,109 ----
end
# build new credentials files.
!
! set credfile = /usr/etc/credentials
!
! # Determine where the new credentials file should go. If there
! # is currently no credentials file, put it in the location
! # originally contained in $credfile. If $credfile is a link,
! # follow the link.
!
! unset credfound
! while (! $?credfound)
!
! # Warning: This "ls" command will produce output on stderr if the
! # file is not there. ls does not set status if the file
! # doesn't exist...
!
! set ls = (`ls -l $credfile`)
!
! if ($#ls == 0) then
! set credfound
! else
! # This if can't go on the same line as the above else...
! if ("$ls[1]" !~ l?????????) then
! set credfound
! else
! set credfile = $ls[$#ls]
! endif
! endif
! end
! unset credfound ls
!
! rm -f ${credfile}.new
! cp ${uchost}.cred ${credfile}.new
if ($status) exit $MR_NOCRED
! /usr/etc/mkcred ${credfile}.new
if ($status) exit $MR_MKCRED
# Try to install the files
foreach e ( "" .dir .pag)
! mv -f ${credfile}.new$e ${credfile}$e
end
# If any of them didn't get installed, fail
foreach e ( "" .dir .pag)
! if (! -e ${credfile}$e) exit $MR_NOCRED
end