From owner-freebsd-stable@freebsd.org Sun Nov 22 13:04:36 2015 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDA37A32CD1 for ; Sun, 22 Nov 2015 13:04:36 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AC771B09 for ; Sun, 22 Nov 2015 13:04:35 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 43FAD2842B; Sun, 22 Nov 2015 14:04:27 +0100 (CET) Received: from illbsd.quip.test (ip-86-49-16-209.net.upcbroadband.cz [86.49.16.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id BE3A328431; Sun, 22 Nov 2015 14:04:25 +0100 (CET) Message-ID: <5651BD59.8070203@quip.cz> Date: Sun, 22 Nov 2015 14:04:25 +0100 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:35.0) Gecko/20100101 Firefox/35.0 SeaMonkey/2.32 MIME-Version: 1.0 To: "Michael B. Eichorn" , freebsd-stable Stable Subject: Re: su on 10.2: TERM: Undefined variable References: <5650642B.5030707@quip.cz> <1448138525.10590.18.camel@michaeleichorn.com> <5651A102.8050106@quip.cz> In-Reply-To: <5651A102.8050106@quip.cz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Nov 2015 13:04:36 -0000 Miroslav Lachman wrote on 11/22/2015 12:03: > Michael B. Eichorn wrote on 11/21/2015 21:42: >> On Sat, 2015-11-21 at 13:31 +0100, Miroslav Lachman wrote: >>> I noticed some weird behavior of "su" command in shell scripts >>> running >>> from cron after upgrade from FreeBSD 8.4 to 10.2. >>> >>> If I have this in script >>> >>> su -m www -c 'ls -l' >>> >>> then I get "TERM: Undefined variable" on the stderr if this script is >>> run from cron. >>> It works fine on FreeBSD 8.4 >>> >>> Is it intentional behavior? >>> >>> Miroslav Lachman >> >> I cannot reproduce your problem. I used the following script: >> >> #!/bin/sh >> >> echo "BEGIN TEST" >> echo $TERM >> >> su -m www -c 'ls -l' >> >> echo $TERM >> echo "END TEST" >> >> crontab is: >> * * * * * /root/test.sh >> >> and the result is: >> >> BEGIN TEST >> >> total 520765 >> -rw-r--r-- 1 root wheel 724002816 Aug 12 11:45 FreeBSD-10.2- >> RELEASE-amd64-disc1.iso >> -rwxr-xr-x 1 root wheel 90 Nov 21 15:33 test.sh >> >> END TEST >> >> # freebsd-version >> 10.2-RELEASE-p7 >> > > It's a strange. I tried it on another machine which was installed as > 10.1 and upgraded to 10.2-p5 - and I got Undefined variable again: > > BEGIN TEST > > TERM: Undefined variable. > total 8984 > drwxr-xr-x 2 root wheel 1536 Aug 12 13:48 bin > -rw------- 1 root wheel 9134080 Nov 22 00:06 dns-terror.core > -rw-r--r-- 1 root wheel 836 Nov 5 10:39 extensions.ini > drwxr-xr-x 3 root wheel 512 Jul 29 17:49 settings > drwxr-xr-x 8 root wheel 512 Aug 9 04:59 settings_atago > drwxr-xr-x 2 root wheel 512 Aug 9 03:12 skel_devel > -rwxr--r-- 1 root wheel 90 Nov 22 11:52 term_test.sh > > END TEST > > Miroslav Lachman The only workaround I found is adding export TERM="" at the top of the script.