From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 3 09:40:12 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB39337B401 for ; Thu, 3 Apr 2003 09:40:11 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5976243F93 for ; Thu, 3 Apr 2003 09:40:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h33HeAUp084126 for ; Thu, 3 Apr 2003 09:40:10 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h33HeAuY084125; Thu, 3 Apr 2003 09:40:10 -0800 (PST) Resent-Date: Thu, 3 Apr 2003 09:40:10 -0800 (PST) Resent-Message-Id: <200304031740.h33HeAuY084125@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Andreas Kasparz Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA22837B401 for ; Thu, 3 Apr 2003 09:36:58 -0800 (PST) Received: from innocence.interface-business.de (ns.interface-business.de [193.101.57.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4DFB843FCB for ; Thu, 3 Apr 2003 09:36:57 -0800 (PST) (envelope-from andy@wega.interface-business.de) Received: from rathole (rathole-srv.interface-business.de [193.101.57.204]) $) with SMTP id h33Hau1Q024867 for ; Thu, 3 Apr 2003 19:36:56 +0200 (CEST) (envelope-from andy@wega.interface-business.de) Received: from wega.interface-business.de ([193.101.57.19]) by rathole; Thu, 03 Apr 2003 19:37:32 +0200 (MEST) Received: from wega.interface-business.de (localhost [127.0.0.1]) by wega.interface-business.de (8.12.6/8.12.3) with ESMTP id h33HamE6057040 for ; Thu, 3 Apr 2003 19:36:48 +0200 (CEST) (envelope-from andy@wega.interfaReceived: (from andy@localhost) by wega.interface-business.de (8.12.6/8.12.3/Submit) id h33HalvT057039; Thu, 3 Apr 2003 19:36:47 +0200 (CEST) (envelope-from andy) Message-Id: <200304031736.h33HalvT057039@wega.interface-business.de> Date: Thu, 3 Apr 2003 19:36:47 +0200 (CEST) From: Andreas Kasparz To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/50569: /bin/sh doesn't handles ${HOME}/.profile correctly X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Andreas Kasparz List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Apr 2003 17:40:12 -0000 >Number: 50569 >Category: bin >Synopsis: /bin/sh doesn't handles ${HOME}/.profile correctly >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Apr 03 09:40:07 PST 2003 >Closed-Date: >Last-Modified: >Originator: Andreas Kasparz >Release: FreeBSD 4.7-STABLE i386 >Organization: Interface:projects GmbH, Dresden, Germany >Environment: System: FreeBSD wayo 4.8-RC FreeBSD 4.8-RC #5: Tue Apr 1 12:30:48 CEST 2003 root@wayo:/usr/obj/usr/src/sys/WAYO i386 >Description: Manual entry for sh(1), section 'Invocation': A login shell first reads commands from the files /etc/profile and then .profile if they exist. .profile will not be read, if a login shell is invoked from another point than the directory where the .profile is located. This case occurs if xterm(1) is started with the option '-ls' and the starting directory isn't the directory where .profile is located. >How-To-Repeat: $ cd /tmp $ xterm -ls >Fix: We have to build an full pathname for the .profile. The following patch fixes the problem; but it should be revisited my the maintainer in order to guarantee that there are no side effects (I'm not so familar with the internals of the sources). $ ls -l main.c* -rw-r--r-- 1 root wheel 8192 Apr 3 17:35 main.c -rw-r--r-- 1 root wheel 8032 Jul 19 2002 main.c.orig $ ident main.c.orig main.c.orig: $FreeBSD: src/bin/sh/main.c,v 1.18.2.3 2002/07/19 04:38:51 tjr Exp $ $ diff -c main.c.orig main.c *** main.c.orig Fri Jul 19 06:38:51 2002 --- main.c Thu Apr 3 17:35:59 2003 *************** main(int argc, char *argv[]) *** 177,184 **** read_profile("/etc/profile"); state1: state = 2; ! if (privileged == 0) ! read_profile(".profile"); else read_profile("/etc/suid_profile"); } --- 177,189 ---- read_profile("/etc/profile"); state1: state = 2; ! if (privileged == 0) { ! char userprofile[FILENAME_MAX+1]; ! strcpy( userprofile, lookupvar("HOME") ); ! strcat( userprofile, "/" ); ! strcat( userprofile, ".profile" ); ! read_profile( userprofile ); ! } else read_profile("/etc/suid_profile"); } >Release-Note: >Audit-Trail: >Unformatted: