Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jul 1999 00:54:37 -0400 (EDT)
From:      "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
To:        baram@home.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: su segfaults, why?
Message-ID:  <199907270454.AAA08363@cc942873-a.ewndsr1.nj.home.com>
In-Reply-To: <19990727040638.MXRL10688.mail.rdc1.tx.home.com@c74763-a> from "baram@home.com" at "Jul 26, 99 10:06:34 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
baram@home.com wrote,
> Hello,
> I have tried executing fetchmail as a user from /usr/local/etc/rc.d 
> and noticed that it would segfault. So i tried the following from 
> command line: (writing this from memory..)
> # su user '/usr/local/bin/fetchmail'
> segfault (core dumped) 
> # su user uptime
> segfault (core dumped)
> If user shell is zsh, then the core file is left in ~user directory, 
> otherwise there is none..So, is this an incorrect usage of su on my 
> part? I am running 3.2-STABLE from around July 7th.

Yes, this is an incorrect usage. Look at the su(1) manpage,

SYNOPSIS
     su [-Kflm] [-c class] [login [args]]
.
.
.
     If the optional args are provided on the command line, they are passed to
     the login shell of the target login.

(Wow, this manpage is a mess![*])

So, if you enter,

# su user '/usr/local/bin/fetchmail'

You are essentially doing (assuming 'user's default shell is zsh),

% zsh '/usr/local/bin/fetchmail'

As the user 'user.' 

Now, I'm not a zsh user, but I know both sh and csh would treat
/usr/local/bin/fetchmail as a _shell script._ I assume zsh does the
same. 

What you actually want to do is,

# su -l user -c /usr/local/bin/fetchmail

[*] The docs on the '-c' switch in the description do not match its
    usage in the examples. The switch seems to work like it does in
    the examples. I'll file a PR after I check if this has not already
    been pointed out.
-- 
Crist J. Clark                           cjclark@home.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907270454.AAA08363>