Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Some problems with menu list.



Andrej Borsenkow wrote:

> I played with porcesses and processes-list and something was wrong with list
> display.

The problem isn't `menu list', but process completion, of course.

> bor@itsrm2% kill 13996
> Completing process ID
>      bor  2921  2548  0 09:52:22 ?        0:00 /usr/dt/bin/Xsession

You must have tweaked _pids to be able to get this list. Something
like the patch below, which I'll commit, even though this isn't the
final answer.

> ...
> 
> bor@itsrm2% kill 12474
>
> ...
>
>     root 14006 14000  0   Jul 31 ?        0:00 telemon
>     root 24038 14006  0   Jul 31 term/tc4p0t2  0:00 /opt/lib/tele/saf/dialer
> 12474   13038
> 
> note two "leftover" numbers. They represent valid processes:
> 
> bor@itsrm2% ps -fp 13038,12474
>      UID   PID  PPID  C    STIME TTY      TIME CMD
>      bor 13038 12559  0 11:17:22 pts/12   0:05 zsh
>      bor 12474 12406  0 10:51:47 pts/10   0:02 info
> 
> May be, it a problem with my style(s); BTW processes and processes-list
> definitely needs better documentation (e.g. processes expects first line to be
> heading and process numbers in the first column). I have full list of current
> processes and can send on request (it is rather large just to include it).

The problem is with calling ps twice, race conditions and whatnot.

I was never really happy with this. Initially I did that to be able to 
list processes without showing their ids. Rather stupid, I admit,
especially because _pids has evolved since then to not be able to show 
lists without the pids.

Question to everyone: should we remove processes-list, i.e. the second 
call to ps? The problem is: how do we replace it. I think it would be
nice if _pids would look at the first line of the output of ps to see
which column gives the pids. If it can't find that out, it uses the
first numeric column (easier to implement: the first number in each
line). For special cases, users should be able to set a style to tell
_pids which column to use.

Would that be ok for everyone?


Bye
 Sven

Index: Completion/Builtins/_pids
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_pids,v
retrieving revision 1.6
diff -u -r1.6 _pids
--- Completion/Builtins/_pids	2000/06/20 07:15:38	1.6
+++ Completion/Builtins/_pids	2000/08/15 07:50:49
@@ -9,11 +9,11 @@
 
 if [[ "$1" = -m ]]; then
   all=()
-  match="[[:blank:]]#${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*[/[:blank:]]${2}*"
+  match="*[[:blank:]]${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*[/[:blank:]]${2}*"
   shift 2
 elif [[ "$PREFIX$SUFFIX" = [0-9]# ]]; then
   all=()
-  match="[[:blank:]]#${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*"
+  match="*[[:blank:]]${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*"
 else
   all=(-U)
   match="*[[:blank:]]*[[/[:blank:]]$PREFIX*$SUFFIX*"

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author