Subject: Re: bug#20999: 24.4; Inconsistent UID vs USER resolution between emacsclient and emacs daemon

From: Wolfgang Jenkner <[email-masked]>
Date: Wed, 08 Jul 2015 20:03:20 +0200

On Tue, Jul 07 2015, Mike Alexander wrote:

> I get a
> connection refused from the command "emacsclient -c -s $EMACS_DAEMON_NAME"
> after starting and confirming the daemon is running via the command "emacs
> --daemon=$EMACS_DAEMON_NAME".  

Since connect() is a syscall you could run emacsclient under strace to
easily find out with which arguments it is called.  In my case (using
truss under FreeBSD) I see the following syscalls leading up to the
connect() call

socket(PF_LOCAL,SOCK_STREAM,0)                  = 3 (0x3)
geteuid()                                       = 1002 (0x3ea)
mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34380709888 (0x801400000)
stat("/tmp/emacs1002/foobar",{ mode=srwx------ ,inode=23,size=0,blksize=4096 }) = 0 (0x0)
geteuid()                                       = 1002 (0x3ea)
madvise(0x801406000,0x1000,0x5,0xaaaaaaaaaaaaaaab,0x801400030,0x800de29e0) = 0 (0x0)
connect(3,{ AF_UNIX "/tmp/emacs1002/foobar" },23) = 0 (0x0)