Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 182615

Summary: sys-apps/less-394 doesn't work when user shell not sh compatable
Product: Gentoo Linux Reporter: Jonathan Isom <jeisom>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: VERIFIED NEEDINFO    
Severity: normal CC: grobian
Priority: High    
Version: 2007.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: my tcshrc files

Description Jonathan Isom 2007-06-19 21:44:52 UTC
I use tcsh and less fails to display anything but the time & pwd when i exec 'less FILE' as the lesspipe.sh is executed with tcsh and not a bourne compatible shell.  This used to work until i recently update it a week and a half ago.
Comment 1 SpanKY gentoo-dev 2007-06-21 04:21:43 UTC
updated what ?  works fine for me:
$ tcsh
$ echo asdf > foo
$ less foo

also post `emerge --info`
Comment 2 Jonathan Isom 2007-06-21 15:12:24 UTC
try changing you default shell first then relogin.  it works fine if i do the same as you .  also set the $SHELL env variable to /bin/tcsh  and less won't work in bash

Portage 2.1.2.9 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.5-r3, 2.6.21-suspend2-r5 i686)
=================================================================
System uname: 2.6.21-suspend2-r5 i686 AMD Sempron(TM) 2600+
Gentoo Base System release 1.12.10
Timestamp of tree: Fri, 08 Jun 2007 00:30:08 +0000
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-tbird -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/lib/X11/xkb /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo"
CXXFLAGS="-march=athlon-tbird -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
MAKEOPTS=""
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa apache2 apm arts audiofile avi berkdb bitmap-fonts bzip2 cairo cdr cli composite cpudetection cracklib crypt ctype cups dba dbus dri dvb dvd dvdr dvdread eds emboss encode esd ethereal evo exif expat fam fastbuild firefox foomaticdb force-cgi-redirect fortran ftp gd gdbm gif gimp glitz glut gmp gnome gpm gstreamer gtk gtk2 gtkhtml guile hal iconv idn imlib ipv6 isdnlog jabber jpeg kerberos lcms ldap libg++ libwww lirc lm_sensors mad madwifi matroska memlimit midi mikmod mmap mmx mmxext mng motif mozilla mp3 mpeg mudflap na_dd ncurses new-login nls nptl nptlonly nvidia objc objc++ ogg opengl openmp oss pam pcre pdf pdflib perl png posix pppd pvr python qt qt3 qt3support qt4 quicktime readline reflection samba sdl session simplexml slang soap sockets spell spl sse ssl svg tcltk tcpd tiff tokenizer truetype truetype-fonts type1-fonts udev unicode usb v4l v4l2 vdr vorbis win32codecs wxwindows x264 x86 xinerama xml xml2 xorg xsl xv xvmc yahoo zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIRC_DEVICES="devinput" USERLAND="GNU" VIDEO_CARDS="nv nvidia vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

Comment 3 SpanKY gentoo-dev 2007-06-22 03:57:18 UTC
still works for me ...

$ ssh root@localhost
root@localhost's password:
(G5:~) # echo asdf > f
(G5:~) # less f
(G5:~) # less --version
less 394

perhaps something in your environment is screwing things up ... what does `env` show ?
Comment 4 Jonathan Isom 2007-06-22 08:32:05 UTC
Well it appears to be something on my setup.  Tried another (3rd) user and less indeed works.  nothing in the env appears out of the ordinary.  the thing is less used to work.  it appears to be someting in the .tcshrc files I'm using but 
haven't change them in months.

thanks

env |sort 
--------------------
ANT_HOME=/usr/share/ant-core
BLOCKSIZE=1k
CG_COMPILER_EXE=/usr/bin/cgc
CLASSPATH=.:/home/jisom/GNUstep/Library/Libraries/Java:/opt/GNUstep/Local/Library/Libraries/Java:/opt/GNUstep/Local/Library/Libraries/Java:/opt/GNUstep/System/Library/Libraries/Java
CONFIG_PROTECT=/usr/share/X11/xkb /usr/lib/X11/xkb /usr/kde/3.4/share/config /usr/kde/3.4/env /usr/kde/3.4/shutdown
CONFIG_PROTECT_MASK=/etc/env.d/java/ /etc/php/cli-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/gconf /etc/terminfo /etc/revdep-rebuild /etc/splash
CVS_RSH=ssh
DCCC_PATH=/usr/lib/distcc/bin
DISPLAY=:0.0
DISTCC_LOG=
DISTCC_VERBOSE=0
ECIINI=/usr/lib/ViaVoiceTTS/eci.ini
EDITOR=vi
EXINIT=set autoindent
FLTK_DOCDIR=/usr/share/doc/fltk-1.1.7-r1/html
GCC_PATH=/usr/i686-pc-linux-gnu/gcc-bin/4.1.2
GCC_SPECS=
GDK_USE_XFT=1
GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
GNUSTEP_FLATTENED=yes
GNUSTEP_HOST=i686-pc-linux-gnu
GNUSTEP_HOST_CPU=ix86
GNUSTEP_HOST_OS=linux-gnu
GNUSTEP_HOST_VENDOR=pc
GNUSTEP_IS_FLATTENED=yes
GNUSTEP_LOCAL_ROOT=/opt/GNUstep/Local
GNUSTEP_MAKEFILES=/opt/GNUstep/System/Library/Makefiles
GNUSTEP_NETWORK_ROOT=/opt/GNUstep/Local
GNUSTEP_PATHLIST=/home/jisom/GNUstep:/opt/GNUstep/Local:/opt/GNUstep/Local:/opt/GNUstep/System
GNUSTEP_SYSTEM_ROOT=/opt/GNUstep/System
GNUSTEP_USER_CONFIG_FILE=.GNUstep.conf
GNUSTEP_USER_DEFAULTS_DIR=GNUstep/Defaults
GNUSTEP_USER_DIR=GNUstep
GNUSTEP_USER_ROOT=/home/jisom/GNUstep
GROUP=users
GUILE_LOAD_PATH=/home/jisom/GNUstep/Libraries/Guile:/opt/GNUstep/Local/Libraries/Guile:/opt/GNUstep/Local/Libraries/Guile:/opt/GNUstep/System/Libraries/Guile:/usr/share/guile/1.8
G_BROKEN_FILENAMES=1
G_FILENAME_ENCODING=UTF-8
HOME=/home/jisom
HOST=nx74205
HOSTTYPE=i386-linux
HUSHLOGIN=FALSE
INFOPATH=/usr/share/info:/opt/beryl/share/info:/opt/share/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.17/info:/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/info:/usr/share/info/emacs-21
INPUTRC=/etc/inputrc
JAVAC=/etc/java-config-2/current-system-vm/bin/javac
JAVA_HOME=/etc/java-config-2/current-system-vm
JDK_HOME=/etc/java-config-2/current-system-vm
LD_LIBRARY_PATH=/home/jisom/GNUstep/Library/Libraries:/home/jisom/GNUstep/Library/Libraries:/opt/GNUstep/Local/Library/Libraries:/opt/GNUstep/Local/Library/Libraries:/opt/GNUstep/Local/Library/Libraries:/opt/GNUstep/Local/Library/Libraries:/opt/GNUstep/System/Library/Libraries:/opt/GNUstep/System/Library/Libraries
LESS=-R -M --shift 5
LESSOPEN=|lesspipe.sh %s
LIBRARY_COMBO=gnu-gnu-gnu
LOGNAME=jisom
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mng=01;35:*.pcx=01;35:*.yuv=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.flac=01;35:*.mp3=01;35:*.mpc=00;36:*.ogg=00;36:*.wav=00;36:*.mid=00;36:*.midi=00;36:*.au=00;36:*.flac=00;36:*.aac=00;36:*.ra=01;36:*.mka=01;36:
MACHTYPE=i386
MAIL=/var/mail/jisom
MANPATH=/etc/java-config-2/current-system-vm/man:/usr/local/share/man:/usr/share/man:/opt/beryl/share/man:/usr/share/man:/opt/share/man:/usr/share/man:/usr/share/binutils-data/i686-pc-linux-gnu/2.17/man:/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/man:/etc/java-config/system-vm/man/:/usr/lib/php5/man/:/usr/qt/3/doc/man
OPENGL_PROFILE=nvidia
OSTYPE=linux
PAGER=less -r
PATH=/home/jisom/GNUstep/Tools:/opt/GNUstep/Local/Tools:/opt/GNUstep/Local/Tools:/opt/GNUstep/System/Tools:.:/home/jisom/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/qt/bin:/opt/wine/20070604/bin:/usr/games/bin
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
PRELINK_PATH_MASK=/usr/lib/gstreamer-0.10:/usr/lib/gstreamer-0.8
PWD=/home/jisom
PYTHONPATH=/usr/lib/portage/pym
QMAKESPEC=linux-g++
QTDIR=/usr/qt/3
SANE_CONFIG_DIR=/etc/sane.d
SHELL=/bin/tcsh
SHLVL=1
TERM=linux
USB_DEVFS_PATH=/dev/bus/usb
USER=jisom
VENDOR=intel
XINITRC=/etc/X11/xinit/xinitrc
Comment 5 SpanKY gentoo-dev 2007-06-22 12:30:59 UTC
a quick test would be to move your profile files out of the way and start a new shell ...
Comment 6 SpanKY gentoo-dev 2007-06-22 12:37:12 UTC
you could also try running:
strace -f -o out <the less command giving you problems>

if things are OK, you should see a line like:
19056 execve("/usr/bin/lesspipe.sh", ["lesspipe.sh", .......

when the shell script gets executed directly, the kernel will parse the #! in it and execute the shell specified (which is /bin/bash)
Comment 7 Jonathan Isom 2007-06-22 16:28:03 UTC
tracked it down to tcshrc detecting if its interactive or not.

if ($?USER == 0 || $?prompt == 0) exit

This used to work.  tcsh was updated on my system on June 9th. using 6.14-r33 ,the latest for my last sync.  I'll sync tonight update tcsh to see it that fixes it.

output from strace 

349   execve("/bin/sh", ["sh", "-c", "/bin/tcsh -c lesspipe.sh\\ at.scr"...], [/* 90 vars */]) = 0

Comment 8 Jonathan Isom 2007-06-23 07:56:06 UTC
Well tracked down the problem to the /etc/csh.cshrc file line 24 :
set prompt = "%{\033[0;1;34m%}(%{\033[0;1;32m%}%m%{\033[0m%}:%{\033[0;1;34m%}%c3%{\033[0;1;34m%}) %{\033[0;1;32m%}%n%{\033[0;1;32m%}%#%{\033[0m%} "

and  the following from my tcshrc file :
if ($?USER == 0 || $?prompt == 0) exit

can't tell it non-interactive and doesn't exit. so
i guess this is a tcsh problem and not less
Comment 9 Fabian Groffen gentoo-dev 2007-06-24 12:45:01 UTC
I don't understand what the exact problem with the configuration is.

(osiris:gentoo-x86/app-shells/tcsh) % echo $version
tcsh 6.15.00 (Astron) 2007-03-03 (i386-intel-linux) options wide,nls,dl,al,kan,sm,rh,color,filec
(osiris:gentoo-x86/app-shells/tcsh) % echo $SHELL
/bin/tcsh
(osiris:gentoo-x86/app-shells/tcsh) % less /etc/make.conf
[works fine]

if you try to detect an interactive shell in your .tcshrc, then use

  if ( "$?0" == "0" ) then

also see the manpage of tcsh:

       $?0     Substitutes  `1' if the current input filename is known, `0' if
               it is not.  Always `0' in interactive shells.
Comment 10 Jonathan Isom 2007-06-24 15:52:54 UTC
Created attachment 122969 [details]
my tcshrc files

Here is my tcshrc file for my user account.  

 if ( "$?0" == "0" ) then 
doesn't work in either tcsh-6.14-r5 or r33

if ($?USER == 0 || $?prompt == 0) exit
works in r5 but not with r33's /etc init files
Comment 11 Fabian Groffen gentoo-dev 2007-06-24 20:28:37 UTC
"then" and "exit" are completely different things.

I think this is irrelevant for this bug.  Find some help on your personal .tcshrc scripts.  If you believe you find an error in the gentoo default scripts then open a new bug for that.  I consider this bug closed/invalid with regard to the original issue.
Comment 12 Jonathan Isom 2007-06-25 04:40:54 UTC
>        $?0     Substitutes  `1' if the current input filename is known, `0' if
>                it is not.  Always `0' in interactive shells.
> 
if you check /etc/csh.cshrc under gentoo it appears $?0 is always 0
If i track down the bug i'll will open a new bug.  
bye