bin/89410: [PATCH] sh(1) missing \u interpolation and bug/fix
in \W
Jaakko Heinonen
jh at saunalahti.fi
Tue Feb 26 11:56:34 UTC 2008
The following reply was made to PR bin/89410; it has been noted by GNATS.
From: Jaakko Heinonen <jh at saunalahti.fi>
To: stefanf at FreeBSD.org
Cc: bug-followup at 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--
More information about the freebsd-bugs
mailing list