From owner-svn-src-head@FreeBSD.ORG Wed Feb 24 14:19:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C9C31065674; Wed, 24 Feb 2010 14:19:56 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C1978FC17; Wed, 24 Feb 2010 14:19:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1OEJuW0010877; Wed, 24 Feb 2010 14:19:56 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1OEJug1010875; Wed, 24 Feb 2010 14:19:56 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201002241419.o1OEJug1010875@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 24 Feb 2010 14:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204276 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 14:19:56 -0000 Author: jh Date: Wed Feb 24 14:19:56 2010 New Revision: 204276 URL: http://svn.freebsd.org/changeset/base/204276 Log: Fix expansion of \W in prompt strings when the working directory is "/". The prompt string was truncated after \W when the working directory was "/". PR: bin/89410 Submitted by: Dr Balwinder Singh Dheeman MFC after: 1 week Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Wed Feb 24 13:13:29 2010 (r204275) +++ head/bin/sh/parser.c Wed Feb 24 14:19:56 2010 (r204276) @@ -1641,7 +1641,7 @@ getprompt(void *unused __unused) case 'w': ps[i] = '\0'; getcwd(&ps[i], PROMPTLEN - i); - if (*fmt == 'W') { + if (*fmt == 'W' && ps[i + 1] != '\0') { /* Final path component only. */ trim = 1; for (j = i; ps[j] != '\0'; j++)