From: cwilson AT ee DOT gatech DOT edu (Charles Wilson) Subject: Re: less, misbehaving 7 Oct 1998 14:53:14 -0700 Message-ID: <361A8AB2.1B8772E1.cygnus.gnu-win32@ece.gatech.edu> References: <360FF514 DOT 34EEE46D AT ece DOT gatech DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com Charles Wilson wrote: > Well, I've tried many of the suggestions given concerning this problems, but > the only thing that has changed is the description of the symptoms. Sorry > for the length of this post; you can scan for '------' to get the major > points. > -------- > Recommendation 1 (Earnie Boyd): TERM=linux > I already had this. > -------- > Recommendation 2 (Jeff Sturm & Larry Hall): get latest cygwinb19.dll from > Sergey's site, and recompile ncurses and less myself, as both build easily > OOB. > I already had latest dll, but ncurses didn't compile. I got 4.2 from the > canonical site, ftp://www.clark.net/pub/dickey/ncurses/... Here's a quick > transcript snippet from configure / make: > ------------- > Recommendation 3 (Jan Tomasek): type 'cat file.name | less' > this seems to work without bombing. But why? Other people don't have to > resort to this, so what's wrong with my setup? (and Jan's, too) > ------------- > Recommendation 4 (Earnie Boyd): use a different precompiled port of > ncurses/less > haven't tried this yet, but will do so soon. Tried it. didn't work. Two things did work, however: -------------- Recommendation 5 (Jonathan Storey): use old bash version So, I replaced bash-2.0.2(1) with bash-2.0.1(2) Now less works just fine. The only problem that could crop up (although I haven't seen it) - didn't bash-2.0.1(2) have some wierd problems with random pauses? I seem to remember seeing that on the mailing list archives, but it was before I started using gnu-win (I've been using bash-2.0.2(1) exclusively from the beginning). QUESTION: one of the main changes in these two version of bash was the switch from fork() in the older version to spawn()/exec() in the newer one. (I think) Could that be the difficulty here? I quote part of Jonathan's explanation: "Whats happening here is that the process is requesting input from the terminal i.e END: (less's case) and the shell thinks that the process is in background. Under UNIX the message would be Stopped: (tty input) or similar. Therefore I would conclude that the new version of BASH.EXE is incorrectly flagging processes as being in background albeit intermittently, although using less(1) to output a file that is less than a screen full seems to cause the problem to manifest itself consistently..." ---------------- The following over-engineered bashrc function works with bash-2.0.2(1) # this deals adequately with the less misbehavior problems. # downside: can only "less" one file at a time (I know, that means # the prompts could do without the "file %i of %m" stuff, but I wanted # to keep everything as close to the defaults as I could.) # The +Gg options force less to run down to the end of the file, and back # to the beginning..this allows less to know how many lines are in the # file for displaying "line x of X" and percentage in the prompts. # I don't find this distracting, since my K6-200 is fast enough that I # don't see the display flickering to the end-of-file and back. less() { local fn=$1 shift cat $fn | /usr/local/bin/less -PM"$fn .?n?m(file %i of %m) \ ...?ltline %lt?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: \ %x.:?pB%pB\\%..%t\$ -Pm?n$fn .?m(file %i of %m) ..?e(END) ?x- Next\\: \ %x.:?pB%pB\\%:byte %bB?s/%s...%t\$ -Ps?n$fn .?m(file %i of %m) ..?e(END) \ ?x- Next\\: %x..%t\$" +Gg $* } export LESS="-isMd" --Chuck - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".