From owner-freebsd-bugs@FreeBSD.ORG Tue Feb 26 11:56:33 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA7D81066154 for ; Tue, 26 Feb 2008 11:56:33 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 67AD113C51A for ; Tue, 26 Feb 2008 11:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m1QBo7MC087634 for ; Tue, 26 Feb 2008 11:50:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m1QBo7ej087629; Tue, 26 Feb 2008 11:50:07 GMT (envelope-from gnats) Date: Tue, 26 Feb 2008 11:50:07 GMT Message-Id: <200802261150.m1QBo7ej087629@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jaakko Heinonen Cc: Subject: Re: bin/89410: [PATCH] sh(1) missing \u interpolation and bug/fix in \W X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jaakko Heinonen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2008 11:56:34 -0000 The following reply was made to PR bin/89410; it has been noted by GNATS. From: Jaakko Heinonen To: stefanf@FreeBSD.org Cc: bug-followup@FreeBSD.org Subject: Re: bin/89410: [PATCH] sh(1) missing \u interpolation and bug/fix in \W Date: Tue, 26 Feb 2008 11:18:16 +0200 --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Stefan, Here's a bug fix isolated from the patch in bin/89410. Could you commit this patch if you think it's OK? The patch fixes \W handling in prompt string for root direcrory. Thanks. -- Jaakko --Nq2Wo0NMKNjxTN9z Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="sh-prompt-W.diff" PR: bin/89410 before: $ PS1="\W \$ " jaakko $ cd / whoami jaakko after: $ PS1="\W \$ " jaakko $ cd / / $ whoami jaakko / $ Index: parser.c =================================================================== RCS file: /home/ncvs/src/bin/sh/parser.c,v retrieving revision 1.58 diff -p -u -r1.58 parser.c --- parser.c 5 Nov 2006 18:36:05 -0000 1.58 +++ parser.c 25 Feb 2008 16:52:37 -0000 @@ -1621,7 +1621,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++) --Nq2Wo0NMKNjxTN9z--