zsh-workers
 help / color / mirror / code / Atom feed
* Re: Some problems with menu list.
@ 2000-08-15  7:57 Sven Wischnowsky
  2000-08-15  8:35 ` Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-08-15  7:57 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Some problems with menu list.
  2000-08-15  7:57 Some problems with menu list Sven Wischnowsky
@ 2000-08-15  8:35 ` Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 2000-08-15  8:35 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> 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?
>

Yes. Looking at header should be quite robust. Position of pid varies from
system to system, but, hopefully, it is always called PID :-) This would make
_pids usable out of the box on almost every system.

-andrej


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Some problems with menu list.
@ 2000-08-15  7:26 Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 2000-08-15  7:26 UTC (permalink / raw)
  To: ZSH workers mailing list

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

bor@itsrm2% kill 13996
Completing process ID
     bor  2921  2548  0 09:52:22 ?        0:00 /usr/dt/bin/Xsession
     bor  2961     1  0 09:52:26 ?        0:01 /usr/dt/bin/ttsession -s
     bor  2962  2921  0 09:52:27 ?        0:01 /usr/dt/bin/dtsession
     bor  2981  2962  0 09:52:34 ?        0:06 dtwm
     bor  2982  2962  0 09:52:46 ?        0:02 dtfile -session dta0072k
     bor  2987     1  0 09:52:48 ?        0:00
/usr/bin/X11/xmessages -daemon -
     bor 10028     1  0   Aug 03 ?        0:01 /tools/bin/zsh
     bor 10029 10028  0                   0:00 <defunct>
     bor 12354  2569  0 10:48:48 ?        0:01 imapd
     bor 12400  2961  0 10:49:42 ?        0:00 /bin/sh -c dtterm -sdtserver
     bor 12401 12400  1 10:49:42 ?        0:27 dtterm -sdtserver
     bor 12403 12401  0 10:49:46 pts/9    0:03 /tools/bin/zsh
     bor 12406 12401  0 10:49:49 pts/10   0:01 /tools/bin/zsh
     bor 12409     1  0 10:49:56 ?        0:00 /usr/dt/bin/dtexec -open
0 -ttpr
     bor 12410 12409  0 10:49:56 ?        0:03 dtterm -e rsh itsrm1
     bor 12414  2982  0 10:49:58 ?        0:00 dtfile -session dta0072k
     bor 12416 12410  0 10:50:00 pts/11   0:00 rlogin itsrm1
     bor 12474 12406  0 10:51:47 pts/10   0:02 info
     bor 12482     1  0 10:53:18 ?        0:05 vim -g /home/bor/.zcompletion
     bor 12559 12401  0 10:59:21 pts/12   0:01 /tools/bin/zsh
     bor 12951 12403  0 11:13:19 pts/9    0:00 less _pids
     bor 13038 12559 24 11:17:22 pts/12   0:03 zsh

Now key up:

bor@itsrm2% kill 12474
    root  2569  2565  0   Jul 17 ?        0:15 //usr/sbin/inetd
    root  2582  2565  0   Jul 17 ?        0:03 /usr/lib/saf/ttymon
    root  2583  2565  0   Jul 17 ?        0:02 /usr/lib/saf/ttymon
    root  2584  2565  0   Jul 17 ?        0:01 //usr/lib/saf/listen
    root  2585  2565  0   Jul 17 ?        0:02 /usr/lib/saf/ttymon
    root  2964  2584  0 09:52:27 ?        0:05 /usr/dt/bin/rpc.ttdbserverd
    root  3159     1  0   Jul 17 ?        0:01 Xp_daemon
    root  3160  3159  0   Jul 17 ?        0:18 Xp_SV_itsrm2
    root  3161  3160  0   Jul 17 ?        0:06 Xp_SV_itsrm2
    root  3163  3159  0   Jul 17 ?        0:27 Xp_SP_itsrm2
    root  3165  3159  0   Jul 17 ?       16:34 Xp_SV_lprsv_itsrm...
    root  3167  3165  0   Jul 17 ?        0:51 Xp_SV_lprsv_itsrm...
    root  3169  3159  0   Jul 17 ?        0:31 Xp_SP_lprsp_itsrm...
    root  3184     1  0   Jul 17 ?        9:52 /var/spool/Spool/config/bin/xpd
    root  3427  2141  0 10:18:41 ?        0:00 /opt/PCS/bin/psoxsrv
    root 10145     1  0   Jul 20 ?        0:33 /tools/bin/ntpd
    root 12529     1  0   Jul 31 ?        0:00 /opt/nsr/nsrexecd
    root 13028     1  0   Aug 14 ?        0:04 pcmxsrv
    root 13996     1  0   Jul 31 ?        0:00 /opt/lib/tele/saf/tac
    root 14000 13996  0   Jul 31 ?        0:00 telemon
    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).

-andrej

Have a nice DOS!
B >>

bor@itsrm2% zstyle -L
zstyle ':completion:*' completer _oldlist _complete _match
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the
character to insert%s'
zstyle ':completion:*' match-original both
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-z}={A-Z}
r:|[._-]=* r:|=*' 'm:{a-z}={A-Z} r:|[.-]=** r:|=**'
zstyle ':completion:*' menu 'select=long-list' 'select=0'
zstyle ':completion:*' old-list _match
zstyle ':completion:*' verbose true
zstyle :compinstall filename /home/bor/.zcompletion
zstyle ':completion:*:*:configure:*' tag-order 'options:-with:with\ options
options:-other:other\ options' 'options:-without:without\ options'
zstyle ':completion:*:options-with' ignored-patterns '^--with-*'
zstyle ':completion:*:options-without' ignored-patterns '^--without-*'
zstyle ':completion:*:options-other' ignored-patterns '--with(|out)-*'
zstyle ':completion:*' ambiguous true
zstyle ':completion:*:processes' command '
        if (($UID && !${+NUMERIC})); then
            ps -u $USER -o pid
        else
            ps -e -o pid
        fi
'
zstyle ':completion:*:processes-list' command '
        if (($UID && !${+NUMERIC})); then
            ps -fu $USER
        else
            ps -fe
        fi
'


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-08-15  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-15  7:57 Some problems with menu list Sven Wischnowsky
2000-08-15  8:35 ` Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
2000-08-15  7:26 Andrej Borsenkow

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).