Russ Cox is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

rsc / plan9port http://swtch.com/plan9port/

Plan 9 from User Space (aka plan9port) is a port of many Plan 9 programs from their native Plan 9 environment to Unix-like operating systems. See the web site http://swtch.com/plan9port/ for details.

Clone this repository (size: 58.2 MB): HTTPS / SSH
hg clone https://bitbucket.org/rsc/plan9port
hg clone ssh://hg@bitbucket.org/rsc/plan9port

Issues

#42 9term extra echo

Reported anonymously

in cooked mode (e.g. with rc), 9term echoes the intput incorrecrly. e.g.

; echo fu
echo fu
fu
Status: resolved Responsible: nobody Type: bug Priority: major
Milestone: none Component: none Version: none

Attachments

No attachments added for this issue yet.

Comments and changes

  1. #1 Ethan Grammatikidis

    written

    Ditto, except I don't see it all the time. I find it much more common on my older / single core machines (< 500MHz) than on my multi-core.

  2. #2 Anonymous

    written

    stty -echo

  3. #3 Anonymous

    written

    stty -echo disables not only the extra echo, but i also cannot see anything i type. another thing i noticed, under freebsd it does not show the extra echo, but under (arch) linux it does...

  4. #4 Anonymous

    written

    upon further investigation, it looks like a problem in 9term.c after line 515. it seems that

    if(s)
                  setecho(sfd, s);
    

    (which resets the echo setting of the terminal) gets executed before the command has a chance to run. if i insert a sleep statement, the extra echo is not shown anymore.

    --- a/src/cmd/9term/9term.c     Fri Mar 19 13:11:12 2010 -0700
    +++ b/src/cmd/9term/9term.c     Sun Mar 21 11:54:27 2010 +0100
    @@ -514,6 +514,7 @@
                    s = setecho(sfd, 0);
                    if(write(rcfd, pair.s, pair.ns) < 0)
                            threadexitsall(nil);
    +               sleep(50);
                    if(s)
                            setecho(sfd, s);
            }
    
  5. #5 Anonymous

    written

    needed to change sleep(50) to sleep(1) in my previous post, otherwise the echo is not reset on long command output.

  6. #6 Anonymous

    written

    looks like forced cooked mode (via '-c' with latest commit) , followed by 'stty -echo' solves the problem

  7. #7 Russ Cox

    written

    • Changed status from new to resolved.

Add comment / attachment

Verification: Please write the text from the image in the box (letters only)

captcha

Is that you, Humanoid? Is this me?