From owner-freebsd-questions Mon Jul 26 21:54:55 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by hub.freebsd.org (Postfix) with ESMTP id 93E8B14FC1 for ; Mon, 26 Jul 1999 21:54:52 -0700 (PDT) (envelope-from cjc@cc942873-a.ewndsr1.nj.home.com) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.9.3/8.8.8) id AAA08363; Tue, 27 Jul 1999 00:54:42 -0400 (EDT) (envelope-from cjc) From: "Crist J. Clark" Message-Id: <199907270454.AAA08363@cc942873-a.ewndsr1.nj.home.com> Subject: Re: su segfaults, why? In-Reply-To: <19990727040638.MXRL10688.mail.rdc1.tx.home.com@c74763-a> from "baram@home.com" at "Jul 26, 99 10:06:34 pm" To: baram@home.com Date: Tue, 27 Jul 1999 00:54:37 -0400 (EDT) Cc: freebsd-questions@FreeBSD.ORG Reply-To: cjclark@home.com X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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