Subject: Re: Vi still can't remove its own vi-recover files from NFS /var/tmp
To: NetBSD-current Discussion List <current-users@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-users
Date: 01/25/2004 00:49:11
--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Greg A. Woods wrote:
> Note the file in question is (and was) "/etc/nsswitch.conf".

This file was probably used because /var/tmp or the file to be edited
was on NFS-mounted partition, right?

> As far as I can tell from the code nsdispatch(3) is just using fopen()
> and (since it uses lex & yacc), fread().

Well, flex(3) uses isatty() without checking for a character special
device. So, gethostbyname() etc. will trigger a TIOCGETA for
/etc/nsswitch.conf. Try this for example:

#include <netdb.h>

int main(void)
{
  return gethostbyname("localhost") =3D=3D NULL;
}
=20
> As for reproducing the main subject issue, yes that still happens too:
=20
>   4446 vi       CALL  unlink(0xa61e0)
>   4446 vi       NAMI  "/var/tmp/vi.recover/vi.04446b"
>   4446 vi       RET   unlink 0
>   4446 vi       CALL  unlink(0xad440)
>   4446 vi       NAMI  "/var/tmp/vi.recover/recover.04446d"
>   4446 vi       RET   unlink -1 errno 13 Permission denied
=20
> as before the recover.* file can be removed after 'vi' has exited....

Well, vi uses locks for the recover files which might interfere in
some way NFS.

--=20
Christian

--k1lZvvs/B4yU6o8G
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iD8DBQFAEwR30KQix3oyIMcRAhmAAJ4gxmI5+zUiAwbAVh3ZIjHZtkwZ0ACeMcy3
pAnvio26snciQGksHn7ooyM=
=oNKZ
-----END PGP SIGNATURE-----

--k1lZvvs/B4yU6o8G--