You are not logged in.
so last night, i took it upon myself to fix a nagging issue i've been having with urxvt. basically, when first launched, urxvt would mangle the prompt; it would print the first line of my two liner twice, or move the cursor 10 characters to the right, just ugly. hitting clear or any command would fix it but i figured if xterm can get it right, what's wrong with urxvt?
you may be at risk if:
-- you use bash as your shell
-- you use urxvt (any version) as your terminal
-- you use some form of WM (usually tilers) that quickly resizes programs immediately upon launch
-- you use a multi-line PS1
why this is happening:
basically, urxvt is setup to handle a SIGWINCH differently than other terminals, and bash is setup to send said SIGWINCH at an inconvenient time if the window is resized before the prompt finishes printing. urxvt dev's say it's a bash issue that will be fixed soon... but nonetheless, just commenting out a few lines of urxvt source code solved it for me.
i've tried my hand at creating a patch for this. (it was simple, so i thought it'd be a good first attempt).
rxvt_fixprompt.patch:
--- src/command.C.old 2009-07-06 11:50:09.000000000 -0400
+++ src/command.C 2009-07-06 11:49:10.000000000 -0400
@@ -2205,9 +2205,9 @@
if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT))
{
- if (expect_false (!seen_input))
- {
- seen_input = 1;
+ //if (expect_false (!seen_input))
+ // {
+ // seen_input = 1;
// many badly-written programs (e.g. jed) contain a race condition:
// they first read the screensize and then install a SIGWINCH handler.
// some window managers resize the window early, and these programs
@@ -2215,9 +2215,9 @@
// unfortunately other programs are even more buggy and dislike
// being sent SIGWINCH, so only do it when we were in fact being
// resized.
- if (seen_resize && cmd_pid)
- kill (-cmd_pid, SIGWINCH);
- }
+ // if (seen_resize && cmd_pid)
+ // kill (-cmd_pid, SIGWINCH);
+ // }
/* Read a text string from the input buffer */
wchar_t buf[UBUFSIZ];
a wget'able link can be found here. as i said, this is my first attempt at making a patch so if i screwed it up, please tell me how to fix it and i will.
hope someone else finds this useful.
//github/
Offline
Thanks for the patch brisbin33! There is one problem though - I've tried to create a PKGBUILD including the patch and it won't compile after applying the patch succesfully. So, do you have a viable PKGBUILD including this patch?
Actually I just hacked the PKGBUILD from abs to so it changes directories and applies the patch and cd's back and runs ./configure.
Offline
It is a bash4 bug; urxvt sends the sigwinch to fix some buggy ncurses programs.
Here is the patch that solves the problem:
http://www.mail-archive.com/bug-bash@gn … 05464.html
Last edited by arkham (2009-07-06 22:16:43)
"I'm Winston Wolfe. I solve problems."
~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~
Offline
Thanks very much for your efforts, brisbin
Offline
Thanks for the patch brisbin33! There is one problem though - I've tried to create a PKGBUILD including the patch and it won't compile after applying the patch succesfully. So, do you have a viable PKGBUILD including this patch?
Actually I just hacked the PKGBUILD from abs to so it changes directories and applies the patch and cd's back and runs ./configure.
sorry ashren, i didn't make a PKGBUILD (i actually commented the lines by hand before building, then made the patch later as an exercise). i used the naming convention from the gcc patch in the rxvt-unicode-256color PKGBUILD (src/command.C.old, src/command.C) i figured that would work? i guess not.
thanks for the bash patch arkam, that's probably the more legit fix for this issue.
edit/ so you're not left out... thanks for the thanks ranguvar
Last edited by brisbin33 (2009-07-06 22:48:21)
//github/
Offline
Has anyone thought of just making a 256 color urxvt with this patch included in the AUR? It doesnt sound like it would effect urxvt in any other WM.
pink
Even a broken clock is right twice a day.
Diplomacy without force is like music without instruments.
Offline
It is a bash4 bug; urxvt sends the sigwinch to fix some buggy ncurses programs.
Here is the patch that solves the problem:
http://www.mail-archive.com/bug-bash@gn … 05464.html
This is not a bash4 bug. This issue has been around for quite some time for me and I use zsh.
brisbin33, I'll try this out as soon as I get a chance. Thanks!
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
This is not a bash4 bug. This issue has been around for quite some time for me and I use zsh.
brisbin33, I'll try this out as soon as I get a chance. Thanks!
Yup, same here, the problem happens with Zsh for me too and urxvt, so I'll give the patch a go too once I get to my Arch system again. Thanks for the patch! (this issue has been bugging me for a long time).
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
I also use ZSH, and am plagued by this bug. However, urxvt does not compile with the patch applied.
Cthulhu For President!
Offline
No, it does not seem to compile. Which version of rxvt-unicode are you compiling brisbin33?
Offline
I can't get urxvt to compile before this patch, I dont think this is his issue. (I'm using rxvt-unicode-256color from the AUR though)
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
urxvt needs a patch for gcc 4.4: http://cvs.fedoraproject.org/viewvc/dev … vision=1.1
@brisbin33: thanks for the patch, works fine here.
Offline
urxvt needs a patch for gcc 4.4: http://cvs.fedoraproject.org/viewvc/dev … vision=1.1
Ah, thanks.
ZSH still has the bug, though. Looks like this patch fixes Bash's issue only.
Cthulhu For President!
Offline
just be clear...
i hand edited command.C from rxvt-unicode-256color 9.06-3 in the AUR. after this, it compiled fine for me (64 bit). i then took a diff and called them src/command.C.old and src/command.C and called that the patch.
it simply comments lines 2208-2220 of command.C
i'm glad it's working for some.
Last edited by brisbin33 (2009-07-07 15:01:04)
//github/
Offline
Thanks for that brisbin.
I just downloaded the patch file, adjusted the PKGBUILD and didn't notice the problem so far.
It was just a small issue, but as you said nagging.
Offline