Date: Tue, 26 Feb 2008 11:50:07 GMT From: Jaakko Heinonen <jh@saunalahti.fi> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/89410: [PATCH] sh(1) missing \u interpolation and bug/fix in \W Message-ID: <200802261150.m1QBo7ej087629@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/89410; it has been noted by GNATS. From: Jaakko Heinonen <jh@saunalahti.fi> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802261150.m1QBo7ej087629>