Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 17660
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Fabian Groffen <grobian@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Joseph Tucek <jat2@cec.wustl.edu>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 17660 depends on: Show dependency tree
Bug 17660 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2003-03-16 21:10 0000
After emerging the new tcsh, less stopped working.  After a lot of poking
around, I found that less runs the script specified by the LESSOPEN command
(default in Gentoo is lesspipe.sh) as an input filter.  It uses some non-obvious
code to determine exactly what command to pass to system(...), but it appears to
run 
$SHELL -c "lesspipe.sh <file>"
If $SHELL is /bin/tcsh, this results in cwdcmd to be aliased to something (it's
intended to update the titlebar of GUI terminals, and varies with $TERM), and
then tcsh being instantiated.  tcsh will run cwdcmd, which will print something
out (usually of the form <CONTROL CHARACTERS>$cwd), which gets in the input
stream of less (as if lesspipe.sh put it there), thereby mucking up less.

less doesn't produce any output other then the output of cwdcmd on ordinary
files, and outputs the cwdcmd output and then the output of lesspipe.sh on
"special" files (*.gz, *.bz2, and other extensions).

Reproducible: Always
Steps to Reproduce:
1.Have $SHELL be /bin/tcsh (probably needs to be exported as well).

2.Have /etc/profile.d/tcsh-settings alias cwdcmd to output something non-null. 
The default of the new tcsh ebuild should be fine.

3.Run "less foo.txt".  Also try "less foo.txt.gz".

Actual Results:  
On an ordinary VC, the output of "less foo.txt" is "Directory: $cwd".

With KDE's konsole, the output of "less foo.txt" is "^G".

On an ordinary VC, the output of "less foo.txt.gz" is "Directory: $cwd" followed
by what one would expect (gzip -dc foo.txt.gz|less).

With konsole, the output is as with a VC, but with "^G" instead of "Directory..."

Expected Results:  
Try it with a stock bash.

A fix is to just not use cwdcmd.  Most other distro's set GUI terminal titlebars
by playing with the prompt.  This is arguably much much more correct then
aliasing cwdcmd.

'emerge info' follows

Portage 2.0.47-r10 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r2)
=================================================================
System uname: 2.4.19-gentoo-r10 i686 AMD Athlon(tm) processor
GENTOO_MIRRORS="ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/ 
http://gentoo.oregonstate.edu/
ftp://sunsite.doc.ic.ac.uk/packages/linux/sunsite.unc-mirror/distributions/gentoo
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config
/usr/kde/2/share/config /usr/kde/3/share/config
/usr/X11R6/lib/X11/xkb:/usr/kde/3.1/share/config:/usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY=""
USE="libg++ mikmod libwww motif 3dnow aalib acpi afs also apm arts avi berkdb
bonobo cdr crypt cups dga doc dvd encode esd evo gb gd gdbm ggz gif gnome gpm
gtk gtkhtml guile imap imlib java jpeg junit kde kerberos leim mbox mmx mozilla
mpeg ncurses nls oggvorbis opengl oss pam pdflib perl pic plotutils png python
qt qtmt quicktime readline samba sdl slang spell ssl svga tcltk tcpd tetex tiff
truetype X xml xml2 xmms xv zlib x86"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-tbird -O3 -pipe -fforce-addr -fomit-frame-pointer
-funroll-loops -falign-functions=4 -maccumulate-outgoing-args"
CXXFLAGS="-march=athlon-tbird -O3 -pipe -fforce-addr -fomit-frame-pointer
-funroll-loops -falign-functions=4 -maccumulate-outgoing-args"
ACCEPT_KEYWORDS="x86"
MAKEOPTS="-j1"
AUTOCLEAN="yes"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
FEATURES="sandbox ccache"

------- Comment #1 From Wayne Davison 2003-04-06 06:35:37 0000 -------
I'm curious what the value of $LESSOPEN is on your system.  It is set to
"|lesspipe.sh %s" on my system, which causes the script to be run by /bin/sh
(since the first line of the script is #!/bin/sh).  Is $LESSOPEN different
on your system?  If not, I don't see how tcsh is getting involved in this
situation.  I run zsh, and the $SHELL setting is not entering into the
equation when less calls out to lesspipe.sh.  (I didn't try using tcsh,
however.)

------- Comment #2 From Wayne Davison 2003-04-06 14:47:06 0000 -------
After checking the less source code (which I should have done before the last
comment) I see now where the $SHELL usage is coming in.  One easy fix for tcsh
users is to add "SHELL=/bin/sh" into their ~/.lesskey file so that less uses
/bin/sh to run the LESSOPEN command rather than using tcsh.

------- Comment #3 From MKI 2004-08-21 17:07:15 0000 -------
Also, the cwdcmd alias causes tcsh to print Directory: $pwd twice on simple
operations that one could care less about the current directory location.

eg.

Password:
Last login: Sat Aug 21 16:57:27 2004 from [...]
Directory: /home/brad
Directory: /home/brad
5:09pm /home/brad> cd
Directory: /home/brad
5:09pm /home/brad>


If someone could please remove cwdcmd alias, it sure would be appreciated.

------- Comment #4 From Fabian Groffen 2005-09-13 11:23:25 0000 -------
I think it should be gone, including the cd . that is done afterwards to print
the current directory.  In my proposed patch on bug #89295 both are replaced by
a prompt setting

------- Comment #5 From Fabian Groffen 2005-09-27 11:49:04 0000 -------
note to self: done

------- Comment #6 From Fabian Groffen 2005-09-30 12:33:01 0000 -------
Fixed in 6.14-r1

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug