Subject: Re: Samba 2.0.6 broken on SPARC?
To: None <current-users@netbsd.org>
From: URA Hiroshi <ura@hiru.aoba.yokohama.jp>
List: current-users
Date: 12/14/1999 04:36:30
----Next_Part(Tue_Dec_14_04:36:25_1999_11)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


>> On Mon, 13 Dec 1999 12:06:22 -0600, Dave Barr <barr@visi.com> said:

> I'm surprised nobody has noticed this before, except perhaps
> if this is a SPARC-specific issue.  I'm running -current,
> and trying to run the pkgsrc Samba to do domain logins.

I have the same problem when I run the samba on my sparc running
NetBSD-current (1999/12/05).  

I wrote a attached test code by way of cheking semaphore. I got valid
results on PC running NetBSD-current (1999/12/05), but I got invaild
on sparc.

  case PC:
    pc% ./shmemtest.i386elf
    real user id = 12494
    real group id = 20
    effective user id = 12494
    effective group id = 20
    *** union ***
    semaphore user id = 12494
              group id = 20
              creator user id = 12494
              creator group id = 20
              mode = 1644 (932)
    *** varargs ***
    semaphore user id = 12494
              group id = 20
              creator user id = 12494
              creator group id = 20
              mode = 1644 (932)
    *** sleeping ***
    ^Z
    Suspended
    pc% bg
    [1]    ./shmemtest.i386elf &
    pc% ipcs -a
	<snip>
    Semaphores:
    T     ID     KEY        MODE       OWNER    GROUP  CREATOR   CGROUP \
    NSEMS   OTIME    CTIME
    s 458752    1114482 --rw-r--r--    12494       20    12494       20 \
    16no-entry 14:48:12

  case Sparc:
    sparc{1}% ./shmemtest.sparc 
    real user id = 12494
    real group id = 20
    effective user id = 12494
    effective group id = 20
    *** union ***
    semaphore user id = 20
              group id = 12494
              creator user id = 20
              creator group id = 932
              mode = 2200000 (589824)
    *** varargs ***
    semaphore user id = 12494
              group id = 20
              creator user id = 12494
              creator group id = 20
              mode = 1644 (932)
    *** sleeping ***
    ^Z
    Suspended
    sparc% bg
    [1]    ./shmemtest.sparc &
    sparc% ipcs -a
	<snip>
    Semaphores:
    T     ID     KEY        MODE       OWNER    GROUP  CREATOR   CGROUP \
    NSEMS   OTIME    CTIME
    s 589824    1114482 --rw-r--r--    12494       20    12494       20 \
    16no-entry 14:50:01


--
ura


----Next_Part(Tue_Dec_14_04:36:25_1999_11)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="shmemtest.c"

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>


int
main(argc, argv)
	int argc;
	char *argv[];
{
	int sem_id;
	union {
		int val;
		struct semid_ds *buf;
		unsigned short *array;
	} sem_un;
	struct semid_ds sem_ds;

	printf("real user id = %d\n", getuid());
	printf("real group id = %d\n", getgid());
	printf("effective user id = %d\n", geteuid());
	printf("effective group id = %d\n", getegid());

	if ((sem_id = semget(0x110172, 0, 0)) < 0) {
		if ((sem_id = semget(0x110172, 16,
				     IPC_CREAT | IPC_EXCL | 0644)) < 0) {
			perror("semget");
			exit(EXIT_FAILURE);
		}
	}

	printf("*** union ***\n");
	sem_un.buf = &sem_ds;
	if (semctl(sem_id, 0, IPC_STAT, sem_un) != 0) {
		perror("semctl");
		exit(EXIT_FAILURE);
	}

	printf("semaphore user id = %d\n"
	       "          group id = %d\n"
	       "          creator user id = %d\n"
	       "          creator group id = %d\n"
	       "          mode = %4o (%d)\n",
	       sem_ds.sem_perm.uid, sem_ds.sem_perm.gid,
	       sem_ds.sem_perm.cuid, sem_ds.sem_perm.cgid,
	       sem_ds.sem_perm.mode, sem_ds.sem_perm.mode);

	printf("*** varargs ***\n");
	if (semctl(sem_id, 0, IPC_STAT, &sem_ds) != 0) {
		perror("semctl");
		exit(EXIT_FAILURE);
	}

	printf("semaphore user id = %d\n"
	       "          group id = %d\n"
	       "          creator user id = %d\n"
	       "          creator group id = %d\n"
	       "          mode = %4o (%d)\n",
	       sem_ds.sem_perm.uid, sem_ds.sem_perm.gid,
	       sem_ds.sem_perm.cuid, sem_ds.sem_perm.cgid,
	       sem_ds.sem_perm.mode, sem_ds.sem_perm.mode);

	printf("*** sleeping ***\n");
	sleep(120);

	if (semctl(sem_id, 0, IPC_RMID, sem_un) != 0) {
		perror("semctl");
		exit(EXIT_FAILURE);
	}

	exit(EXIT_SUCCESS);
}

----Next_Part(Tue_Dec_14_04:36:25_1999_11)----