screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [screen-devel] Regarding bug #34200: Log misses first character


From: Juergen Weigert
Subject: Re: [screen-devel] Regarding bug #34200: Log misses first character
Date: Thu, 15 Sep 2011 00:07:59 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Sep 13, 11 23:59:05 -0700, hiren panchasara wrote:
>    Hi All,
> 
>    This is my first attempt to look into this (for that matter any open
>    source) code so please tolerate my stupidity.
> 
>    Firstly, I tried to browse through code to understand it but that didnt
>    help much so I thought its a good idea to try to solve any existing bug.
>    So I started looking into this one: https://savannah.gnu.org/bugs/?34200.
> 
>    I drill down to the piece of code causing it (IMO) and following diffs
>    _seem_ to fix it:
> 
>    diff --git a/src/window.c b/src/window.c
>    index 8509b7d..56c18de 100644
>    --- a/src/window.c
>    +++ b/src/window.c
>    @@ -1905,8 +1905,6 @@ char *data;
>    A A A A A A A A A  if (buf[0] & TIOCPKT_DOSTOP)
>    A A A A A A A A A A A  WNewAutoFlow(p, 1);
>    A A A A A A A  }
>    -A A A A A  bp++;
>    -A A A A A  len--;
>    A A A A  }
>    A #endif
>    A #ifdef BUILTIN_TELNET
> 
>    IMO, here, buf[] holds the data to be logged and bp++ skips the first
>    char. I want to understand if this is correct assumption. Why was bp++ and
>    len-- there in the first place.

When the terminal is in packet mode, skipping the first byte is the right
thing. The reporter apparently got bitten by this code without having the
terminal in packet mode.

>    If someone could help me understand what this piece of code is doing, that
>    will be great.
>    What is TIOCPKT?

man 4 tty_ioctl has this:
   Psuedoterminal ioctls
   TIOCPKT   const int *argp
       Enable  (when  *argp is nonzero) or disable packet mode.  Can be
       applied to the master side of a pseudoterminal only (and will return
       ENOTTY otherwise).   In  packet  mode, each  subsequent  read(2)  will
       return a packet that either contains a single nonzero control byte, or 
has
       a single byte containing zero (' ') followed by data  written  on
       the  slave  side of the pseudoterminal.

>    I did "git blame window.c" and found this portion of code written by
>    jnweiger.

Hiren, could you reproduce the bug? If so, Id like to know why the terminal
and screen disagree about package mode.

        cheers,
                JW-

-- 
 o \  Juergen Weigert      unix-software __/ _=======.=======_     
<V> | address@hidden         creator    __/        _---|____________\/    
 \  |            0179/2069677      __/          (____/            /\
(/) | ____________________________/              _/ \_ vim:set sw=2 wm=8



reply via email to

[Prev in Thread] Current Thread [Next in Thread]