Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 75968 - ps sometimes gives a listing of environment variables rather than the process list
Summary: ps sometimes gives a listing of environment variables rather than the process...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-28 17:27 UTC by Damon Smith
Modified: 2006-10-05 00:28 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Damon Smith 2004-12-28 17:27:16 UTC
sometimes, when I run ps, I get a listing of the environment vars instead of the correct process listing.
This happened most recently when running 
ps ax |grep firefox
the output below shows a terminal session with a few working ps commands, then one that failed, then some more that worked. 
It only happens very rarely, and isn't fatal, or even particularly serious.


Reproducible: Always
Steps to Reproduce:
1. run ps a number of times
2.
3.

Actual Results:  
damon@sys04 3delight-3.0.1-Linux-i686 $ ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        S      0:00 init [3]
    2 ?        SWN    0:00 [ksoftirqd/0]
    3 ?        SW<    0:01 [events/0]
    4 ?        SW<    0:00 [khelper]
    5 ?        SW<    0:05 [kblockd/0]
    6 ?        SW     0:00 [khubd]
   31 ?        SW<    0:00 [aio/0]
   30 ?        SW     0:22 [kswapd0]
  124 ?        SW<    0:00 [ata/0]
  130 ?        SW     0:00 [kseriod]
  148 ?        SW     0:06 [kjournald]
  277 ?        S      0:00 /sbin/devfsd /dev
 5144 ?        S      0:00 metalog [MASTER]
 5145 ?        S      0:00 metalog [KERNEL]
 5249 ?        S      0:02 /usr/sbin/cupsd
 5474 ?        S      0:00 /sbin/portmap
 5585 ?        S      8:21 /usr/sbin/famd -T 0 -c /etc/fam.conf
 5614 ?        S      0:00 /usr/sbin/sshd
 5657 ?        S      0:00 /usr/sbin/cron
 5753 ?        S      0:00 /usr/sbin/xinetd -pidfile /var/run/xinetd.pid -stayal
5770 tty1     S      0:00 /sbin/agetty 38400 tty1 linux
 5772 tty2     S      0:00 /sbin/agetty 38400 tty2 linux
 5773 tty3     S      0:00 /sbin/agetty 38400 tty3 linux
 5775 tty4     S      0:00 /sbin/agetty 38400 tty4 linux
 5776 tty5     S      0:00 /sbin/agetty 38400 tty5 linux
 5777 tty6     S      0:00 /sbin/agetty 38400 tty6 linux
 5804 ?        S      0:00 /usr/bin/gdm
 8310 ?        S      0:01 /usr/libexec/bonobo-activation-server --ac-activate -
8567 ?        S      0:00 /usr/libexec/evolution-data-server-1.0 --oaf-activate
8590 ?        S      0:00 /usr/libexec/evolution-data-server-1.0 --oaf-activate
8591 ?        S      0:00 /usr/libexec/evolution-data-server-1.0 --oaf-activate
8601 ?        S      0:00 /usr/libexec/evolution-data-server-1.0
--oaf-activate11077 ?        S      0:00
/usr/libexec/evolution/1.4/evolution-wombat --oaf-act 5727 ?        SW     0:00
[pdflush]
16943 ?        SW     0:00 [pdflush]
 8173 ?        S      0:04 /usr/libexec/gconfd-2 29
 8187 ?        S      0:00 /usr/bin/gdm
 8190 ?        RL     4:07 /usr/X11R6/bin/X :0 -audit 0 -auth
/var/lib/gdm/:0.Xa29479 ?        S      0:01 gnome-session
29497 ?        S      0:00 /usr/bin/ssh-agent -- gnome-session
29500 ?        S      0:00 /usr/bin/gnome-keyring-daemon
29502 ?        S      0:01 gnome-smproxy --sm-config-prefix
/.gnome-smproxy-e3ca29504 ?        S      0:01
/usr/libexec/gnome-settings-daemon --oaf-activate-iid29514 ?        S      0:01
xscreensaver -nosplash
29534 ?        S      1:06 metacity --sm-save-file
1103864448-16804-2233727497.m29540 ?        S      0:04 gnome-panel
--sm-config-prefix /gnome-panel-kNJLDu/ -29542 ?        S      0:06 nautilus
--sm-config-prefix /nautilus-r51gCn/ --sm-cl29544 ?        S      0:03 gaim
--session 117f000001000110377199200000167590011
29548 ?        S      1:17 evolution-2.0 --sm-config-prefix
/evolution-2.0-5NdVm29557 ?        S      0:00
/usr/libexec/evolution/1.4/evolution-alarm-notify --s29559 ?        S      0:00
/usr/libexec/evolution/2.0/evolution-alarm-notify --s29560 ?        S      0:00
nautilus --sm-config-prefix /nautilus-r51gCn/ --sm-cl29561 ?        S      0:00
nautilus --sm-config-prefix /nautilus-r51gCn/ --sm-cl29563 ?        S      0:00
/usr/libexec/gnome-vfs-daemon --oaf-activate-iid=OAFI29564 ?        S      0:00
/usr/libexec/gnome-vfs-daemon --oaf-activate-iid=OAFI29565 ?        S      0:00
/usr/libexec/gnome-vfs-daemon --oaf-activate-iid=OAFI29582 ?        S      0:00
/usr/libexec/evolution/2.0/evolution-alarm-notify --s29583 ?        S      0:00
/usr/libexec/evolution/2.0/evolution-alarm-notify --s29584 ?        S      0:00
nautilus --sm-config-prefix /nautilus-r51gCn/ --sm-cl29586 ?        S      0:00
/usr/libexec/mapping-daemon
29587 ?        S      0:00 nautilus --sm-config-prefix /nautilus-r51gCn/
--sm-cl29588 ?        S      0:00 nautilus --sm-config-prefix /nautilus-r51gCn/
--sm-cl29590 ?        S      0:00 nautilus --sm-config-prefix /nautilus-r51gCn/
--sm-cl29608 ?        Z      0:00 [netstat] <defunct>
29610 ?        S      0:10 /usr/libexec/wnck-applet
--oaf-activate-iid=OAFIID:GN29624 ?        S      0:00
/usr/libexec/mixer_applet2 --oaf-activate-iid=OAFIID:29642 ?        S      0:00
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm29643 ?        S      0:01
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm29654 ?        S      0:01
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm29656 ?        S      0:01
/usr/libexec/clock-applet --oaf-activate-iid=OAFIID:G29730 ?        S      0:00
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm29732 ?        S      0:01
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm29739 ?        S      0:00
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm29763 ?        S      0:00
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm29764 ?        S      0:00
evolution-2.0 --sm-config-prefix /evolution-2.0-5NdVm30122 ?        R      0:07
/usr/bin/gnome-terminal
30123 ?        S      0:00 gnome-pty-helper
30124 pts/160  S      0:00 -bash
30125 ?        S      0:00 /usr/bin/gnome-terminal
30126 ?        S      0:00 /usr/bin/gnome-terminal
30286 ?        S      0:00 /usr/libexec/evolution-data-server-1.0
--oaf-activate30339 pts/162  S      0:00 -bash
30354 pts/162  S      0:00 ssh root@wayland
30491 pts/160  R      0:00 ps ax
damon@sys04 3delight-3.0.1-Linux-i686 $ ps ax |grep firefox
30497 pts/160  R      0:00 grep firefox INFODIR=/usr/share/info:/usr/X11R6/info
MANPATH=/usr/share/man:/usr/local/share/man:/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man:/usr/X11R6/man::/opt/blackdown-jdk-1.4.2.01/man:/usr/qt/3/doc/man
SSH_AGENT_PID=29497 HOSTNAME=sys04.vpac.org TERM=xterm SHELL=/bin/bash
GLOBUS_LOCATION=/opt/globus
GTK_RC_FILES=/etc/gtk/gtkrc:/home/damon/.gtkrc-1.2-gnome2 WINDOWID=23068719
QTDIR=/usr/qt/3 ANT_HOME=/usr/share/ant-core MOZILLA_FIVE_HOME=/usr/lib/mozilla
USER=damon
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:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=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:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=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:*.xcf=01;35:*.pcx=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.avi=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.mov=01;35:*.qt=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.mp3=00;36:*.wav=00;36:*.mid=00;36:*.midi=00;36:*.au=00;36:*.ogg=00;36:
GDK_USE_XFT=1 GNOME_KEYRING_SOCKET=/tmp/keyring-I4B8AW/socket
SSH_AUTH_SOCK=/tmp/ssh-JyWhA29479/agent.29479 KDEDIR=/usr/kde/3.2
SESSION_MANAGER=local/sys04.vpac.org:/tmp/.ICE-unix/29479 USERNAME=damon
CONFIG_PROTECT_MASK=/etc/gconf /etc/terminfo PAGER=/usr/bin/less
XINITRC=/etc/X11/xinit/xinitrc DESKTOP_SESSION=gnome
PATH=/bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.2.01/bin:/opt/blackdown-jdk-1.4.2.01/jre/bin:/usr/qt/3/bin:/usr/kde/3.2/bin:/usr/games/bin:/opt/globus/bin:/home/damon/bin
GLIBC_SSP_CHECKED=1 PWD=/home/damon/tmp/3delight-3.0.1-Linux-i686
INPUTRC=/etc/inputrc JAVA_HOME=/opt/blackdown-jdk-1.4.2.01
JAVAC=/opt/blackdown-jdk-1.4.2.01/bin/javac EDITOR=/bin/nano KDEDIRS=/usr
QMAKESPEC=linux-g++ PS1=\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]
GDMSESSION=gnome CXX=g++ HOME=/home/damon SHLVL=1
JDK_HOME=/opt/blackdown-jdk-1.4.2.01 GNOME_DESKTOP_SESSION_ID=Default
LOGNAME=damon LESS=-R CVS_RSH=ssh CLASSPATH=/opt/globus/classes:.
LESSOPEN=|lesspipe.sh %s
INFOPATH=/usr/share/info:/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info
DISPLAY=:0.0 CC=gcc CONFIG_PROTECT=/usr/lib/mozilla/defaults/pref
/usr/X11R6/lib/X11/xkb /usr/kde/3.2/share/config
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/xdvi/ /usr/share/config G_BROKEN_FILENAMES=1
COLORTERM=gnome-terminal XAUTHORITY=/home/damon/.Xauthority _=/bin/grep
OLDPWD=/home/damon/tmp /bin/grep
damon@sys04 3delight-3.0.1-Linux-i686 $ ps ax |grep firefox
30504 pts/160  S      0:00 grep firefox
damon@sys04 3delight-3.0.1-Linux-i686 $ ps ax |grep firefox
30511 pts/160  S      0:00 grep firefox
damon@sys04 3delight-3.0.1-Linux-i686 $ ps ax |grep firefox
30518 pts/160  S      0:00 grep firefox



Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.3.4, glibc-2.3.3.20040420-r1,
2.6.7 i686)
=================================================================
System uname: 2.6.7 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.14.90.0.8-r1
Headers:  sys-kernel/linux-headers-2.4.21-r1
Libtools: sys-devel/libtool-1.4.3-r4
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=i686 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref
/usr/share/config /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=i686 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://vpac.org/mirrors/Linux/Gentoo/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://vpac.org/portage"
USE="X alsa apm arts avi berkdb bitmap-fonts cdr crypt cups doc encode esd f77
fam foomaticdb fortran gdbm gif gnome gpm gstreamer gtk gtk2 imlib java jpeg
junit ldap libg++ libwww mad mikmod motif mozilla mpeg mysql ncurses nls
oggvorbis opengl oss pam pdflib perl png python quicktime readline sdl spell ssl
svga tcpd tetex tiff truetype x86 xml xml2 xmms xv zlib"

More info:
ps --version
procps version 3.1.15
Comment 1 Albert Cahalan 2005-01-06 11:23:57 UTC
This is most likely a kernel bug. It may also be
caused by apps modifying argv[] rather crudely.
Comment 2 Stian Skjelstad 2005-03-17 05:16:30 UTC
Is this still an issue?
Comment 3 Stian Skjelstad 2005-06-17 08:57:08 UTC
I have seen the same happens a couple of time on other setups where programs get
strange things glued into there param list and therefor stored into argument
list that ps uses to display process-name.

The example where I have seen this is if you get a broken rc depsys cache-file
and start processes that accept bogus arguments.

The source of your problem can come from a lot of places. Kernel that messes up
with buffers in procfs, ps having a buffer-fault or even grep/glibc having a
problem. If you get a process with this output that is not the |grep process,
can you check in /proc/<PID>/* and see if there any bogus data in the proc
filesystem?
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2006-10-05 00:28:12 UTC
i can't reproduce this myself now.
testcase:
for i in `seq 1 5000`; do  ps ax |grep -v ' PID TTY      STAT   TIME COMMAND' |egrep '[[:upper:]]{3,}' ; done ;