[OpenAFS-devel] Windows build problems

Dave Koziol dkoziol@dragonflywireless.com
Tue, 06 Mar 2001 18:20:34 -0500


--On Tuesday, March 6, 2001 2:48 PM +0000 Jason Young 
<jason_young@ncsu.edu> wrote:
>
> Problem #1:  There are a bunch of "del" commands trying to
>              delete files that don't exist (yet or at all)
>
> Workaround #1:  Ignore failing dels,
>                 run nmake /I /f NTMakefile install

Here is a better solution, from an old email I sent to the list.  This 
patch isn't in CVS because I don't have VC 5 to know if this works, and I 
didn't get any feedback, so I haven't submitted it.  If someone could try 
it on VC 5 that would be great!

Apparently, under VC 5, if del failed, it didn't halt the build.  The
problem you are having will happen in lots of places.  I've addressed this
problem with the following change to ntmakefile.i386_nt40

*** c:\openafs\src\config\ntmakefile.i386_nt40	Mon Jan 22 03:36:04 2001
--- c:\afs\openafs\src\config\ntmakefile.i386_nt40	Mon Nov 06 15:49:16 2000
***************
*** 113,119 ****

  # Command macros.
  COPY = copy
! DEL = -2del
  MKDIR = mkdir
  REN = ren
  ECHO = echo
--- 113,119 ----

  # Command macros.
  COPY = copy
! DEL = del
  MKDIR = mkdir
  REN = ren
  ECHO = echo

I'm not sure if this change is compatible with VC 5, since I don't have
access to that version, but if someone could let me know, that would be
great so that we could get something checked in that builds with both
versions.

> a) is this specific to VS 6?  (anybody done a VS6 compile?)

Yes, the version checked in builds with VC 5, not 6.  But I think the above 
change should fixs most of the problems.  The other problem to be aware of 
is with *.et files.  They either need to have unix end of line markers, or 
you need to change the lex script to handle them.  See a post to the list 
in the last 2 days or so.

There is also a Win2K problem with making logins work correctly.  Here is 
the current work in progress patch for that.   I don't think this is in CVS 
either because there are still some potential security issues with this 
change.

*** c:\afs\openafs\src\winnt\afsd\smb.c	Sat Nov 04 10:01:43 2000
--- c:\openafs\src\winnt\afsd\smb.c	Fri Jan 19 00:19:48 2001
***************
*** 548,553 ****
--- 548,569 ----
          return uidp;
  }

+ // Allows you to find an smb_user_t record by the name field
+ smb_user_t *smb_FindUserByName(smb_vc_t *vcp, char *name)
+ {
+ 	smb_user_t *uidp= NULL;
+
+ 	lock_ObtainWrite(&smb_rctLock);
+ 	for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) {
+ 		if (stricmp(uidp->name, name) == 0) {
+ 			uidp->refCount++;
+                 	break;
+ 		}
+         }
+         lock_ReleaseWrite(&smb_rctLock);
+         return uidp;
+ }
+
  void smb_ReleaseUID(smb_user_t *uidp)
  {
  	smb_user_t *up;


*** c:\afs\openafs\src\winnt\afsd\smb.h	Sat Nov 04 10:01:44 2000
--- c:\openafs\src\winnt\afsd\smb.h	Fri Jan 19 00:23:40 2001
***************
*** 307,312 ****
--- 307,314 ----

  extern smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int
flags);

+ extern smb_user_t *smb_FindUserByName(smb_vc_t *vcp, char *name);
+
  extern void smb_ReleaseUID(smb_user_t *uidp);

  extern cm_user_t *smb_GetUser(smb_vc_t *vcp, smb_packet_t *inp);


*** c:\afs\openafs\src\winnt\afsd\smb3.c	Sat Nov 04 10:01:44 2000
--- c:\openafs\src\winnt\afsd\smb3.c	Fri Jan 19 14:38:20 2001
***************
*** 132,150 ****
  	pwd = smb_ParseString(tp, &tp);
  	usern = smb_ParseString(tp, &tp);

! 	/* Create a new UID and cm_user_t structure */
! 	userp = cm_NewUser();
! 	lock_ObtainMutex(&vcp->mx);
! 	newUid = vcp->uidCounter++;
! 	lock_ReleaseMutex(&vcp->mx);

! 	/* Create a new smb_user_t structure and connect them up */
! 	uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
! 	lock_ObtainMutex(&uidp->mx);
! 	uidp->userp = userp;
! 	uidp->name = strdup(usern);
! 	lock_ReleaseMutex(&uidp->mx);
! 	smb_ReleaseUID(uidp);

  	if (dead_vcp) {
  		dead_uidp = dead_vcp->usersp;
--- 132,164 ----
  	pwd = smb_ParseString(tp, &tp);
  	usern = smb_ParseString(tp, &tp);

! 	// On Windows 2000, this function appears to be called more often than
! 	// it is expected to be called. This resulted in multiple smb_user_t
! 	// records existing all for the same user session which results in all
! 	// of the users tokens disappearing.
! 	//
! 	// To avoid this problem, we look for an existing smb_user_t record
! 	// based on the users name, and use that one if we find it.
! 	if (uidp = smb_FindUserByName(vcp, usern)) {
! 		userp = uidp->userp;
! 		newUid = (unsigned short)uidp->userID;	// For some reason these are
different types!
! 		smb_ReleaseUID(uidp);
! 	}
! 	else {
! 		/* Create a new UID and cm_user_t structure */
! 		userp = cm_NewUser();
! 		lock_ObtainMutex(&vcp->mx);
! 		newUid = vcp->uidCounter++;
! 		lock_ReleaseMutex(&vcp->mx);

! 		/* Create a new smb_user_t structure and connect them up */
! 		uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
! 		lock_ObtainMutex(&uidp->mx);
! 		uidp->userp = userp;
! 		uidp->name = strdup(usern);
! 		lock_ReleaseMutex(&uidp->mx);
! 		smb_ReleaseUID(uidp);
! 	}

  	if (dead_vcp) {
  		dead_uidp = dead_vcp->usersp;

> b) has everyone else that has done a successful build
>    had to go through this?

Yes, I've had everything build, and the client stuff work on Win2K.  Again 
this patch

Good luck,

Dave Koziol                    | dkoziol@dragonflymobile.com
Contract Software Development