DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 1st May 2019
bsdcord bsdcord is offline
Port Guard
 
Join Date: Apr 2019
Posts: 23
Default ps auxww vs ps aux

Hi,
I have a strange thing and I don't how to explain it.
I want know if you can reproduce it or not. And if it's a bug or not.

I have the following command line on a xterm at fullscreen:
Code:
$ ps aux|grep xfconfd
user      62562  0.0  0.2   712  4016 ??  I      4:41PM    0:00.18 /usr/local/lib/xfce4/xfconf/xfconfd
user      80006  0.0  0.0  1076   624 p1  R+p/1  4:54PM    0:00.00 grep xfconfd (ksh)
If I resize the xterm at column at the "xfce4" point, my ps aux output change.
For example I resize in this way:
Code:
user      62562  0.0  0.2   712  4016 ??  I      4:41PM    0:00.18 /usr/local/lib/xfce4
and I do:
Code:
$ ps aux|grep xfconfd 
user      19263  0.0  0.0  1076   624 p1  R+p/0  4:57PM    0:00.00 grep xfconfd (ksh)
the xfconfd process is not grepable.
if I use
Code:
 
$ ps auxww | grep whatiwant
it works

I have the same problem both with xterm and xfce-terminal and in console.. ofcourse in console the line must be long to go "out" of the screen.

can you reproduce it ?
is it normal ?
Reply With Quote
  #2   (View Single Post)  
Old 1st May 2019
dayid dayid is offline
Real Name: Dayid
System Archaeologist
 
Join Date: May 2013
Location: GA
Posts: 3
Default

-w Use 132 columns to display information, instead of the default,
which is the window size. If the -w option is specified more
than once, ps will use as many columns as necessary without
regard for window size.
When you do not use the ws your output width is "window size". This is expected and documented in ps(1).

grep is not matching xfconfd since it is no longer displayed in the output due to the truncated width.
Reply With Quote
  #3   (View Single Post)  
Old 1st May 2019
bsdcord bsdcord is offline
Port Guard
 
Join Date: Apr 2019
Posts: 23
Default

yes, but a guy on irc has told me that he doesn't reproduce the "bug".
I mean, his "ps aux" works properly.

And this means that some script works differently based on the window size!! it's really strange!

Last edited by bsdcord; 1st May 2019 at 08:14 PM.
Reply With Quote
  #4   (View Single Post)  
Old 2nd May 2019
ibara's Avatar
ibara ibara is offline
Real-life IT professor
 
Join Date: Jan 2014
Posts: 709
Default

Not a bug.

ps(1) prints with the following conditions:
1. No -w flags set: truncate output to the number of columns in the COLUMNS environment variable, or 79 if that variable is not set.
2. Exactly 1 -w flag set: truncate output to 132 columns if the COLUMNS environment variable is not set or is set but is less than 132. Otherwise, truncate to the number of columns in the COLUMNS environment variable.
3. More than 1 -w flags set: Never truncate output, even if output requires more columns than the terminal has. Ignore COLUMNS environment variable, if set.

When you resized the terminal to have fewer columns than what was needed to print the complete xfconfd command, then ps(1) did exactly what you told it to do and dutifully truncated output to the number of columns. Then you invoked ps(1) with ww, which never truncates. That's why grep(1) worked in the latter case but not the former.

For reference, see /usr/src/bin/ps/ps.c and /usr/src/bin/ps/print.c, specifically for the variable termwidth.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:36 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick