zsh-workers
 help / color / mirror / code / Atom feed
* Pasting of long lines to ZLE is buggy under Mac OS X
@ 2008-10-02  6:55 Vincent Lefevre
  2008-10-02  8:17 ` Stephane Chazelas
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Lefevre @ 2008-10-02  6:55 UTC (permalink / raw)
  To: zsh-workers

It seems that zsh 4.3.6 suffers from a buffering problem when pasting
long lines under Mac OS X (at least 10.4.11). Other software, such as
bash and emacs (running in a terminal), does not seem to have such a
problem.

For instance, when I paste

/usr/bin/gcc-4.0 -DHAVE_CONFIG_H -I. -I.. -DGNOMELOCALEDIR=\"/opt/local/share/locale\" -DGNOME_DESKTOP_SYSCONFDIR=\"/opt/local/etc\" -DGNOME_DESKTOP_PIXMAPDIR=\"/opt/local/share/pixmaps\" -DGNOME_DESKTOP_ICONDIR=\"/opt/local/share/icons\" -DGNOME_CORE_INTERNAL -DDATADIR=\"/opt/local/share/gnome-desktop\" -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -I/usr/X11R6/include -DXTHREADS -DORBIT2=1 -D_REENTRANT -I/opt/local/include/libxml2 -I/opt/local/include/gtk-2.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng12 -I/usr/X11R6/include -I/opt/local/include/libgnomeui-2.0 -I/opt/local/include/libart-2.0 -I/opt/local/include/gconf/2 -I/opt/local/include/gnome-keyring-1 -I/opt/local/include/libgnome-2.0 -I/opt/local/include/libbonoboui-2.0 -I/opt/local/include/libgnomecanvas-2.0 -I/opt/local/include/gnome-vfs-2.0 -I/opt/local/lib/gnome-vfs-2.0/include -I/opt/local/include/orbit-2.0 -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include/libbonobo-2.0 -I/opt/local/include/bonobo-activation-2.0 -I/opt/local/include/gail-1.0 -I/opt/local/include/startup-notification-1.0 -I/opt/local/include -O2 -MT gnome-rr.lo -MD -MP -MF .deps/gnome-rr.Tpo -c gnome-rr.c  -fno-common -DPIC -o .libs/gnome-rr.o

(1507 characters) to iTerm running zsh, I get:

/usr/bin/gcc-4.0 -DHAVE_CONFIG_H -I. -I.. -DGNOMELOCALEDIR=\"/opt/local/share/locale\" -DGNOME_DESKTOP_SYSCONFDIR=\"/opt/local/etc\" -DGNOME_DESKTOP_PIXMAPDIR=\"/opt/local/share/pixmaps\" -DGNOME_DESKTOP_ICONDIR=\"/opt/local/share/icons\" -DGNOME_CORE_INTERNAL -DDATADIR=\"/opt/local/share/gnome-desktop\" -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -I/usr/X11R6/include -DXTHREADS -DORBIT2=1 -D_REENTRANT -I/opt/local/include/libxml2 -I/opt/local/include/gtk-2.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng12 -I/usr/X11R6/include -I/opt/local/include/libgnomeui-2.0 -I/opt/local/include/libart-2.0 -I/opt/local/include/gconf/2 -I/opt/local/include/gnome-keyring-1 -I/opt/local/include/libgnome-2.0 -I/opt/local/include/libbonoboui-2.0 -I/o

which corresponds to the first 1024 characters. If I paste to xterm
(also running zsh), I get something like:

/usr/bin/gcc-4.0 -DHAVE_CONFIG_H -I. -I.. -DGNOMELOCALEDIR=\"/opt/local/share/locale\" -DGNOME_DESKTOP_SYSCONFDIR=\"/opt/local/etc\" -DGNOME_DESKTOP_PIXMAPDIR=\"/opt/local/share/pixmaps\" -DGNOME_DESKTOP_ICONDIR=\"/opt/local/share/icons\" -DGNOME_CORE_INTERNAL -DDATADIR=\"/opt/local/share/gnome-desktop\" -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -I/usr/X11R6/include -DXTHREADS -DORBIT2=1 -D_REENTRANT -I/opt/local/include/libxml2 -I/opt/local/include/gtk-2.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pango-1.0 -I/opt/local/include/pixman-1 -I/opt/local/include/freetype2 -I/opt/local/include/libpng12 -I/usr/X11R6/include -I/opt/local/include/libgnomeui-2.0 -I/opt/local/include/libart-2.0 -I/opt/local/include/gconf/2 -I/opt/local/include/gnome-keyring-1 -I/opt/local/include/libgnome-2.0 -I/opt/local/include/libbonoboui-2.0 -I/opt/local/include/libgnomecanvas-2.0 -I/opt/local/include/gnome-vfs-2.0 -I/opt/local/lib/gnome-vfsde/olu-MT

(here 1130 characters, but this varies).

I don't know if this is related, but I've just discovered that
"cooked mode" (e.g. after typing "cat") is limited to 1024 characters
(including the final newline) under Mac OS X!

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pasting of long lines to ZLE is buggy under Mac OS X
  2008-10-02  6:55 Pasting of long lines to ZLE is buggy under Mac OS X Vincent Lefevre
@ 2008-10-02  8:17 ` Stephane Chazelas
  2008-10-02 15:36   ` Bart Schaefer
  2008-10-03  8:36   ` Vincent Lefevre
  0 siblings, 2 replies; 6+ messages in thread
From: Stephane Chazelas @ 2008-10-02  8:17 UTC (permalink / raw)
  To: zsh-workers

On Thu, Oct 02, 2008 at 08:55:25AM +0200, Vincent Lefevre wrote:
> It seems that zsh 4.3.6 suffers from a buffering problem when pasting
> long lines under Mac OS X (at least 10.4.11). Other software, such as
> bash and emacs (running in a terminal), does not seem to have such a
> problem.
[...]

You may want to try "strace" or "truss" or the equivalent on
your system.

Here (4.3.6-dev-0+0925), it seems zsh reads one character at a time, and for
every character, surprisingly, it does:

read(10, "."..., 1)                     = 1
fcntl64(0, F_DUPFD, 10)                 = 11
close(0)                                = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD], 8) = 0
dup2(11, 0)                             = 0
close(11)                               = 0
write(10, "."..., 1.)                    = 1

It doesn't do that on another machine with 4.3.6-dev-0+0925
(debian x86 as well) where it just does:

read(10, "f"..., 1)                     = 1
write(10, "f"..., 1f)                    = 1

But if zsh reads one character at a time, it's difficult to
explain how big copy pastes cause problems.

-- 
Stéphane


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pasting of long lines to ZLE is buggy under Mac OS X
  2008-10-02  8:17 ` Stephane Chazelas
@ 2008-10-02 15:36   ` Bart Schaefer
  2008-10-03  8:36   ` Vincent Lefevre
  1 sibling, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2008-10-02 15:36 UTC (permalink / raw)
  To: zsh-workers

On Oct 2,  9:17am, Stephane Chazelas wrote:
}
} Here (4.3.6-dev-0+0925), it seems zsh reads one character at a time, and for
} every character, surprisingly, it does:

[ a bunch of signal handling stuff and a dup of stdin ]

} It doesn't do that on another machine with 4.3.6-dev-0+0925

Check whether $BAUD has a value on the first machine but not on the
second.  If it's nonzero then zsh attempts to compensate for an
expected slow terminal by using poll() or select() which might
account for extra activity (though I'd expect those to show up
directly as system calls).

Also remember that every keystroke executes a zle widget.  Normally
that's self-insert that doesn't do anything special, but it could be
overridden with a user-defined widget that does other things.  For
example, if you're running the predictive typing widget on one of
those machines, every keystroke calls the completion system.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pasting of long lines to ZLE is buggy under Mac OS X
  2008-10-02  8:17 ` Stephane Chazelas
  2008-10-02 15:36   ` Bart Schaefer
@ 2008-10-03  8:36   ` Vincent Lefevre
  2008-10-16  5:57     ` Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Vincent Lefevre @ 2008-10-03  8:36 UTC (permalink / raw)
  To: zsh-workers

On 2008-10-02 09:17:58 +0100, Stephane Chazelas wrote:
> You may want to try "strace" or "truss" or the equivalent on
> your system.

Here's what I get for an xterm, after a ssh to my Mac OS X machine.
I pasted the result of a "echo {1..500}", then typed "blah".

prunille:~> ktrace zsh -f
prunille% 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 blah

[...]
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       " "
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "2"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "2"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "8"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "8"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "2"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "2"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       " "
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       " "
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "2"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "2"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "8"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "8"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "3"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "3"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       " "
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       " "
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "b"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "b"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "l"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "l"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "a"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "a"
 25036 zsh      RET   write 1
 25036 zsh      CALL  read(0xa,0xbfffda28,0x1)
 25036 zsh      GIO   fd 10 read 1 byte
       "h"
 25036 zsh      RET   read 1
 25036 zsh      CALL  write(0xa,0x8353c,0x1)
 25036 zsh      GIO   fd 10 wrote 1 byte
       "h"
 25036 zsh      RET   write 1
[...]

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pasting of long lines to ZLE is buggy under Mac OS X
  2008-10-03  8:36   ` Vincent Lefevre
@ 2008-10-16  5:57     ` Bart Schaefer
  2008-10-19 22:18       ` Vincent Lefevre
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2008-10-16  5:57 UTC (permalink / raw)
  To: Vincent Lefevre, zsh-workers

On Oct 3, 10:36am, Vincent Lefevre wrote:
} Subject: Re: Pasting of long lines to ZLE is buggy under Mac OS X
}
} Here's what I get for an xterm, after a ssh to my Mac OS X machine.
} I pasted the result of a "echo {1..500}", then typed "blah".

I'm able to reproduce this on the iMac to which I have access, but
only when ZLE is *not* active.  This suggests that it has something
to do with the tty driver.

Darwin Kernel Version 9.5.0: Wed Sep  3 11:29:43 PDT 2008


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Pasting of long lines to ZLE is buggy under Mac OS X
  2008-10-16  5:57     ` Bart Schaefer
@ 2008-10-19 22:18       ` Vincent Lefevre
  0 siblings, 0 replies; 6+ messages in thread
From: Vincent Lefevre @ 2008-10-19 22:18 UTC (permalink / raw)
  To: zsh-workers

On 2008-10-15 22:57:28 -0700, Bart Schaefer wrote:
> I'm able to reproduce this on the iMac to which I have access, but
> only when ZLE is *not* active.  This suggests that it has something
> to do with the tty driver.

I get this whether ZLE is active or not. But the kernel on my machine
is 8.11.0.

BTW, ksh and tcsh have the same problem, but not bash. Perhaps there's
some limitation in the tty driver and bash works in some way that it is
not affected by this limitation.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-19 22:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-02  6:55 Pasting of long lines to ZLE is buggy under Mac OS X Vincent Lefevre
2008-10-02  8:17 ` Stephane Chazelas
2008-10-02 15:36   ` Bart Schaefer
2008-10-03  8:36   ` Vincent Lefevre
2008-10-16  5:57     ` Bart Schaefer
2008-10-19 22:18       ` Vincent Lefevre

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).