Subject: kern/542: Bug in renaming directories with MSDOSFS
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: None <mikeh@hds.com>
List: netbsd-bugs
Date: 10/31/1994 07:50:05
>Number:         542
>Category:       kern
>Synopsis:       Renaming directories fails under MSDOSFS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 31 07:50:03 1994
>Originator:     Mike Hartman
>Organization:
Human Designed Systems, Inc.
>Release:        current
>Environment:
	
System: SunOS hdssun1 4.1.3 1 sun4m
Architecture: sun4

>Description:
	Renaming a directory when the source and destination parent directories
	are the same fails with MSDOSFS.  In msdosfs_rename(), readep() is
	called to get the directory entry to be renamed.  readep() calls
	deget() which translates directory entries to their canonical form.
	Therefore, readep() returns the '.' entry of the directory being
	renamed, instead of the directory's directory entry in its parent
	directory.	

>How-To-Repeat:
	mkdir subdir
	mv subdir subdir1
	ls -sCF
	1 subdir/

>Fix:
*** src/src/sys/msdosfs/msdosfs_vnops.c	Mon Oct 31 09:14:57 1994
--- src/src/sys/msdosfs/msdosfs_vnops.c	Mon Oct 31 09:16:44 1994
***************
*** 1054,1061 ****
  		/* tddep and fddep point to the same denode here */
  		VOP_LOCK(ap->a_fvp);	/* ap->a_fdvp is already locked */
  		if (error = readep(fddep->de_pmp,
! 				   fdep->de_dirclust,
! 				   fdep->de_diroffset,
  				   &bp, &ep)) {
  			VOP_UNLOCK(ap->a_fvp);
  			goto bad;
--- 1054,1061 ----
  		/* tddep and fddep point to the same denode here */
  		VOP_LOCK(ap->a_fvp);	/* ap->a_fdvp is already locked */
  		if (error = readep(fddep->de_pmp,
! 				   fddep->de_fndclust,
! 				   fddep->de_fndoffset,
  				   &bp, &ep)) {
  			VOP_UNLOCK(ap->a_fvp);
  			goto bad;
>Audit-Trail:
>Unformatted: