From owner-freebsd-ports@FreeBSD.ORG Fri Jun 15 23:48:30 2007 Return-Path: X-Original-To: ports@FreeBSD.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E56416A46E for ; Fri, 15 Jun 2007 23:48:30 +0000 (UTC) (envelope-from jdc@parodius.com) Received: from mx01.sc1.parodius.com (mx01.sc1.parodius.com [72.20.106.3]) by mx1.freebsd.org (Postfix) with ESMTP id 2B15813C465 for ; Fri, 15 Jun 2007 23:48:30 +0000 (UTC) (envelope-from jdc@parodius.com) Received: by mx01.sc1.parodius.com (Postfix, from userid 1000) id 2047F1CC044; Fri, 15 Jun 2007 16:48:30 -0700 (PDT) Date: Fri, 15 Jun 2007 16:48:30 -0700 From: Jeremy Chadwick To: Daniel =?iso-8859-1?B?RHZvPz/haw==?= Message-ID: <20070615234830.GA89210@eos.sc1.parodius.com> Mail-Followup-To: Daniel =?iso-8859-1?B?RHZvPz/haw==?= , ports@FreeBSD.org References: <001101c7af95$6bd7c840$6508280a@tocnet28.jspoj.czf> <4673076E.7040907@yahoo.com> <000001c7af99$0108cec0$6508280a@tocnet28.jspoj.czf> <20070615230347.GB88372@eos.sc1.parodius.com> <000701c7afa5$12355c20$6508280a@tocnet28.jspoj.czf> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <000701c7afa5$12355c20$6508280a@tocnet28.jspoj.czf> User-Agent: Mutt/1.5.15 (2007-04-06) Cc: ports@FreeBSD.org Subject: Re: FreeBSD Port: ipfw2dshield-0.5 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2007 23:48:30 -0000 On Sat, Jun 16, 2007 at 01:29:50AM +0200, Daniel Dvo??ák wrote: > -----Original Message----- > From: Jeremy Chadwick [mailto:koitsu@FreeBSD.org] > Sent: Saturday, June 16, 2007 1:04 AM > To: Daniel Dvo??ák > Cc: 'John Merryweather Cooper'; ports@FreeBSD.org; frank@dynamical-systems.org > Subject: Re: FreeBSD Port: ipfw2dshield-0.5 > > > FreeBSD by default sets PATH to what you see in the mail from cron. > > That is, /usr/local/bin is not include in the list. This is Normal(tm). > > Yes, I know and so I was surprised when cron showed this: > > X-Cron-Env: > > which is not actualy true because this: > > X# setenv > TERM=cons25 > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin > MAIL=/var/mail/root Actually, it is true. I suppose no one's explained to you the difference between an interactive shell, a non-interactive shell, and a login shell. I guess I'll do that now. An interactive shell is one which allocates a pty; an easy way to remember this is "a shell you plan on typing (interactively) in". A non-interactive shell is a shell where there is no actual pty associated with the shell. A login shell is an interactive shell which is spawned from login(1). On FreeBSD, root's shell is /bin/csh. It's recommended you do not change it. Regardless, if you spawn an interactive (or login) shell (examples: logging in on the console, ssh'ing in as root, telnetting in as root, or logging in as yourself then using su/sudo/su2, etc.) /bin/csh will read will read /root/.cshrc. You'll find a "set path" in that file, which contains /usr/local/bin. This is why you see /usr/local/bin when you do a "setenv". The same concept applies to /bin/sh, except /bin/sh reads /etc/profile and /root/.profile on an interactive shell. You'll find that PATH is set inside of /root/.profile. Now let's talk about cron. cron, by default, uses a shell of /bin/sh. All the shells spawned from cron are non-interactive. Therefore, /root/.profile does not get read, thus the default PATH is used. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |