Meta mode in modern XTerm is not configurable in readline library

2009-09-30 Thread werner
Configuration Information [Automatically generated, do not change]:
Machine: i586
OS: linux-gnu
Compiler: gcc -I/usr/src/packages/BUILD/bash-4.0 
-L/usr/src/packages/BUILD/bash-4.0/../readline-6.0
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-suse-linux-gnu' 
-DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O2 -march=i586 -mtune=i686 
-fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables 
-fasynchronous-unwind-tables -g -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 
-D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g -std=gnu89 -Wextra 
-Wno-unprototyped-calls -Wno-switch-enum -Wno-unused-variable 
-Wno-unused-parameter -ftree-loop-linear -pipe -fprofile-use
uname output: Linux boole 2.6.27.19-3.2-pae #1 SMP 2009-02-25 15:40:44 +0100 
i686 i686 i386 GNU/Linux
Machine Type: i586-suse-linux-gnu

Bash Version: 4.0
Patch Level: 24
Release Status: release

Description:
I've got a bug report of a python user which imports the readline
library for command line support.  It apears that if terminfo
includes meta mode support (smm/rmm) the readline library send
ESC [ ? 1034 h
which cause problems if used in network environments.

Repeat-By:
Use XTerm at least version X.Org 6.8.99.903(236)

Fix:
Use the patch below for bind.c from the readline library to
be able to use

set meta-mode off

in /etc/inputrc

--- bind.c
+++ bind.c  2009-09-30 11:25:38.087930034 +0200
@@ -1473,6 +1473,7 @@ static const struct {
 #if defined (VISIBLE_STATS)
   { visible-stats,   rl_visible_stats,  0 },
 #endif /* VISIBLE_STATS */
+  { meta-mode,   _rl_enable_meta,   0 },
   { (char *)NULL, (int *)NULL }
 };
 




Re: Completion: menu-complete from second TAB hit onwards

2009-09-30 Thread Chet Ramey
 I'm trying to get a specific completion behaviour (simple but effective).
 Any help would be greatly appreciated.
 Here is what I'm looking for:
 
 1. When TAB is hit once, complete the command-line with the longest common
 prefix AND list all possible completions (at the same time).
 This can be easily achieved by putting 'set show-all-if-ambiguous' in
 ~/.inputrc.
 
 2. If TAB is hit again after that, then cycle through the possible
 completions (that is insert the next full match each time TAB is pressed).
 Obviously, I cannot bind TAB to menu-complete cause I would lose 1.

Menu-complete in bash-4.0/readline-6.0 does this.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




preventing pipe reader from existing on writer exiting

2009-09-30 Thread Brian J. Murrell
Let's say I have the following (contrived, simplified example):

$ mknod /tmp/fifo
$ cat /dev/zero  /tmp/fifo 
$ cat  /tmp/fifo

When the first cat exits (i.e. is terminated) the second cat stops.  The
problem is that I want to be able to restart the first cat and have the
second cat just keep reading such as:

$ mknod /tmp/fifo
$ (n=; while [ $n -lt 10 ]; do cat /dev/zero  /tmp/fifo; let n=$n+1; done) 
$ pid=$!
$ cat  /tmp/fifo
$ kill $pid

Where $n is a safety valve against an endless loop of cat just exiting
over and over again.

But of course that doesn't work because the second cat exits when the
first iteration of the first subshell exits.  Additionally, the kill
only kills the subshell and not any of it's children.  So to solve the
second cat exiting issue I considered:

$ mknod /tmp/fifo
$ (n=; while [ $n -lt 10 ]; do cat /dev/zero  /tmp/fifo; let n=$n+1; done) 
$ pid=$!
$ (n=; while [ $n -lt 10 ]; do cat  /tmp/fifo; let n=$n+1; done)
$ kill $pid

This has the desired effect except for the issue of not being able to
kill $pid's children.

So now I figure I must just be going about this all the wrong way.

Can anyone help?  Ultimately I need to do I/O through a named pipe and I
need to be able to restart the writer without restarting the reader.

Cheers,
b.





signature.asc
Description: This is a digitally signed message part


Re: preventing pipe reader from existing on writer exiting

2009-09-30 Thread Andreas Schwab
Brian J. Murrell br...@interlinx.bc.ca writes:

 Can anyone help?  Ultimately I need to do I/O through a named pipe and I
 need to be able to restart the writer without restarting the reader.

Just make sure the write side of the pipe is not closed prematurely.

$ (n=0; while [ $n -lt 10 ]; do cat /dev/zero; let n=$n+1; done)  /tmp/fifo 

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.




Re: preventing pipe reader from existing on writer exiting

2009-09-30 Thread John Reiser

Ultimately I need to do I/O through a named pipe and I
need to be able to restart the writer without restarting the reader.


The reader of a fifo will not be terminated as long as there is
at least one writer to the fifo.  Therefore, create a second writer.
For example, to hold the fifo open for one hour:

 sleep 3600   /tmp/fifo  

The shell forks, then opens /tmp/fifo for writing.  The open() waits
until there is a reader.  Then the forked shell execs /bin/sleep,
which waits for 3600 seconds before exiting.  During that 3600
seconds the fifo is open for writing, so the system will not
terminate any reader of the fifo for at least that long.

--