Date: Thu, 3 Apr 2003 19:36:47 +0200 (CEST) From: Andreas Kasparz <andy@interface-projects.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/50569: /bin/sh doesn't handles ${HOME}/.profile correctly Message-ID: <200304031736.h33HalvT057039@wega.interface-business.de> Resent-Message-ID: <200304031740.h33HeAuY084125@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304031736.h33HalvT057039>