zsh-workers
 help / color / mirror / code / Atom feed
* Re: _bison -vV<TAB> dumps core.
@ 1999-10-15 10:29 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-10-15 10:29 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> > Thank you for helping me debugging `computil'. Is it fast enough for
> > you? And is the speed difference to the shell code noticeable?
> 
> It's good.  I can feel the difference on Sun Ultra5.
> Unfortunately, it is not general enough to be used by _apt.
> 
> I think the idea of general command line parsing builtin mentioned in
> 7956 is very good.  _regex_arguments (used by _apt) is too slow.

The problem which I hadn't thought about before is caching. To allow
(aggressive) caching and avoid having to give the definitions more
than once and avoid using some sort of tag passing back and forth
(between C- and shell-code) argument and command line parsing have to
be done together (of course, this also simplifies the C-code but that
shouldn't matter too much). Anyway, the parsing stuff is nicely
separated in C, so it wouldn't be too hard to re-use some of the
functions for other helper builtin (in fact, `compvalues' already uses 
code originally written for `comparguments'). But `regex_arguments'
(which I was thinking about, too) is different enough to justify its
own builtin, I think.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: _bison -vV<TAB> dumps core.
  1999-10-15  8:37 Sven Wischnowsky
@ 1999-10-15 10:14 ` Tanaka Akira
  0 siblings, 0 replies; 4+ messages in thread
From: Tanaka Akira @ 1999-10-15 10:14 UTC (permalink / raw)
  To: zsh-workers

In article <199910150837.KAA17572@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

> Yes. That was the test if there is an argument after the option. Also, 
> mixing single-letter options and long ones had a bug (after strings
> with only one option). Finally, the matches for single-letter option
> (containing the `PREFIX') weren't correctly built in `_arguments'.

The problem is fixed. Thanks.

> Thank you for helping me debugging `computil'. Is it fast enough for
> you? And is the speed difference to the shell code noticeable?

It's good.  I can feel the difference on Sun Ultra5.
Unfortunately, it is not general enough to be used by _apt.

I think the idea of general command line parsing builtin mentioned in
7956 is very good.  _regex_arguments (used by _apt) is too slow.
-- 
Tanaka Akira


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

* Re: _bison -vV<TAB> dumps core.
@ 1999-10-15  8:37 Sven Wischnowsky
  1999-10-15 10:14 ` Tanaka Akira
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-10-15  8:37 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% bison -vV<TAB>zsh: segmentation fault (core dumped)  Src/zsh -f

Yes. That was the test if there is an argument after the option. Also, 
mixing single-letter options and long ones had a bug (after strings
with only one option). Finally, the matches for single-letter option
(containing the `PREFIX') weren't correctly built in `_arguments'.


Thank you for helping me debugging `computil'. Is it fast enough for
you? And is the speed difference to the shell code noticeable?

Bye
 Sven

diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c	Thu Oct 14 13:41:56 1999
+++ Src/Zle/computil.c	Fri Oct 15 10:29:43 1999
@@ -854,6 +854,8 @@
 		break;
 	    } else if (!p || !p->active || (line[1] && p->args))
 		return NULL;
+	if (end)
+	    *end = line;
 	return p;
     }
     return NULL;
@@ -982,6 +984,9 @@
 	    ddef = state.def = state.curopt->args;
 	    doff = pe - line;
 	    state.optbeg = state.argbeg = state.inopt = cur;
+	    state.singles = (d->single && (!pe || !*pe) &&
+			     state.curopt->name[1] && !state.curopt->name[2]);
+
 	    PERMALLOC {
 		state.oargs[state.curopt->num] = newlinklist();
 	    } LASTALLOC;
@@ -1010,7 +1015,7 @@
 	    ddef = state.def = state.curopt->args;
 	    doff = pe - line;
 	    state.optbeg = state.argbeg = state.inopt = cur;
-	    state.singles = !*pe;
+	    state.singles = (!pe || !*pe);
 
 	    for (p = line + 1; p <= pe; p++) {
 		if ((tmpopt = d->single[STOUC(*p)])) {
@@ -1189,7 +1194,8 @@
 		setsparam(args[1], ztrdup(arg->descr));
 		setsparam(args[2], ztrdup(arg->action));
 
-		ignore_prefix(ca_laststate.doff);
+		if (ca_laststate.doff > 0)
+		    ignore_prefix(ca_laststate.doff);
 		if (arg->type == CAA_RARGS)
 		    restrict_range(ca_laststate.argbeg - 1,
 				   arrlen(compwords) - 1);
diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Fri Oct 15 08:25:17 1999
+++ Completion/Base/_arguments	Fri Oct 15 10:33:34 1999
@@ -247,7 +247,7 @@
 	  compadd "$expl[@]" -QqS= - "${PREFIX}${SUFFIX}"
         else
 	  tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" )
-	  tmp2=( "${PREFIX}${(@)^tmp1%%:*}" )
+	  tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
           _describe -o -c "$cmd" option tmp1 tmp2 -Q -S ''
         fi

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* _bison -vV<TAB> dumps core.
@ 1999-10-15  8:02 Tanaka Akira
  0 siblings, 0 replies; 4+ messages in thread
From: Tanaka Akira @ 1999-10-15  8:02 UTC (permalink / raw)
  To: zsh-workers

Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% bison -vV<TAB>zsh: segmentation fault (core dumped)  Src/zsh -f

The stacktrace is follows:

#0  0xff005910 in ca_parse_line (d=0x151ec8) at computil.c:1013
1013                state.singles = !*pe;
(gdb) print pe
$1 = 0x0
(gdb) where
#0  0xff005910 in ca_parse_line (d=0x151ec8) at computil.c:1013
#1  0xff0069dc in bin_comparguments (nam=0x172580 "comparguments", args=0x172c20, ops=0xffbea208 "", func=0) at computil.c:1177
#2  0x1bdbc in execbuiltin (args=0x172578, bn=0xff019f04) at builtin.c:371
#3  0x350b4 in execcmd (cmd=0x153a10, input=0, output=0, how=2, last1=2) at exec.c:2056
#4  0x30a94 in execpline2 (pline=0x13bae8, how=2, input=0, output=0, last1=0) at exec.c:1062
#5  0x2fbe8 in execpline (l=0x11c8f8, how=2, last1=0) at exec.c:875
#6  0x2f510 in execlist (list=0x13bb00, dont_change_job=1, exiting=0) at exec.c:744
#7  0x604d0 in execif (cmd=0x1539e8, args=0x0, flags=0) at loop.c:397
#8  0x34d24 in execcmd (cmd=0x1539e8, input=0, output=0, how=2, last1=2) at exec.c:2008
#9  0x30a94 in execpline2 (pline=0x13bb30, how=2, input=0, output=0, last1=0) at exec.c:1062
#10 0x2fbe8 in execpline (l=0x11c8d8, how=2, last1=0) at exec.c:875
#11 0x2f510 in execlist (list=0x13bb48, dont_change_job=1, exiting=0) at exec.c:744
#12 0x3857c in execautofn (cmd=0x12fba8, args=0x0, flags=0) at exec.c:2934
#13 0x34d24 in execcmd (cmd=0x12fba8, input=0, output=0, how=2, last1=2) at exec.c:2008
#14 0x30a94 in execpline2 (pline=0x13c600, how=2, input=0, output=0, last1=0) at exec.c:1062
#15 0x2fbe8 in execpline (l=0x13cad0, how=2, last1=0) at exec.c:875
#16 0x2f510 in execlist (list=0x13c618, dont_change_job=1, exiting=0) at exec.c:744
#17 0x38c50 in runshfunc (list=0x13c618, wrap=0x0, name=0x13c630 "_arguments") at exec.c:3060
#18 0xfefdc2e8 in comp_wrapper (list=0x13c618, w=0x0, name=0x13c630 "_arguments") at compctl.c:2529
#19 0x38b98 in runshfunc (list=0x13c618, wrap=0xfefee0a4, name=0x13c630 "_arguments") at exec.c:3048
#20 0x38884 in doshfunc (name=0x13c630 "_arguments", list=0x13c618, doshargs=0x1011e0, flags=8704, noreturnval=0) at exec.c:2996
#21 0x38270 in execshfunc (cmd=0x125968, shf=0x13c570, args=0x1011e0) at exec.c:2887
#22 0x34fb4 in execcmd (cmd=0x125968, input=0, output=0, how=2, last1=2) at exec.c:2045
#23 0x30a94 in execpline2 (pline=0x1264e0, how=2, input=0, output=0, last1=0) at exec.c:1062
#24 0x2fbe8 in execpline (l=0x124868, how=2, last1=0) at exec.c:875
#25 0x2f510 in execlist (list=0x127730, dont_change_job=1, exiting=0) at exec.c:744
#26 0x3857c in execautofn (cmd=0x13f228, args=0x0, flags=0) at exec.c:2934
#27 0x34d24 in execcmd (cmd=0x13f228, input=0, output=0, how=2, last1=2) at exec.c:2008
#28 0x30a94 in execpline2 (pline=0x144e58, how=2, input=0, output=0, last1=0) at exec.c:1062
#29 0x2fbe8 in execpline (l=0x144320, how=2, last1=0) at exec.c:875
#30 0x2f510 in execlist (list=0x144e70, dont_change_job=1, exiting=0) at exec.c:744
#31 0x38c50 in runshfunc (list=0x144e70, wrap=0x0, name=0x143598 "_bison") at exec.c:3060
#32 0xfefdc2e8 in comp_wrapper (list=0x144e70, w=0x0, name=0x143598 "_bison") at compctl.c:2529
#33 0x38b98 in runshfunc (list=0x144e70, wrap=0xfefee0a4, name=0x143598 "_bison") at exec.c:3048
#34 0x38884 in doshfunc (name=0x143598 "_bison", list=0x144e70, doshargs=0xff800, flags=8704, noreturnval=0) at exec.c:2996
#35 0x38270 in execshfunc (cmd=0x121f98, shf=0x144db0, args=0xff800) at exec.c:2887
#36 0x34fb4 in execcmd (cmd=0x121f98, input=0, output=0, how=2, last1=2) at exec.c:2045
#37 0x30a94 in execpline2 (pline=0x127718, how=2, input=0, output=0, last1=0) at exec.c:1062
#38 0x2fbe8 in execpline (l=0x1248e8, how=2, last1=0) at exec.c:875
#39 0x2f534 in execlist (list=0x128ee0, dont_change_job=1, exiting=0) at exec.c:750
#40 0x60650 in execif (cmd=0x125bc0, args=0x0, flags=0) at loop.c:409
#41 0x34d24 in execcmd (cmd=0x125bc0, input=0, output=0, how=2, last1=2) at exec.c:2008
#42 0x30a94 in execpline2 (pline=0x11f4b0, how=2, input=0, output=0, last1=0) at exec.c:1062
#43 0x2fbe8 in execpline (l=0x126fd8, how=2, last1=0) at exec.c:875
#44 0x2f510 in execlist (list=0x123e98, dont_change_job=1, exiting=0) at exec.c:744
#45 0x3857c in execautofn (cmd=0x13f070, args=0x0, flags=0) at exec.c:2934
#46 0x34d24 in execcmd (cmd=0x13f070, input=0, output=0, how=2, last1=2) at exec.c:2008
#47 0x30a94 in execpline2 (pline=0x143d78, how=2, input=0, output=0, last1=0) at exec.c:1062
#48 0x2fbe8 in execpline (l=0x144180, how=2, last1=0) at exec.c:875
#49 0x2f510 in execlist (list=0x143d90, dont_change_job=1, exiting=0) at exec.c:744
#50 0x38c50 in runshfunc (list=0x143d90, wrap=0x0, name=0x143278 "_normal") at exec.c:3060
#51 0xfefdc2e8 in comp_wrapper (list=0x143d90, w=0x0, name=0x143278 "_normal") at compctl.c:2529
#52 0x38b98 in runshfunc (list=0x143d90, wrap=0xfefee0a4, name=0x143278 "_normal") at exec.c:3048
#53 0x38884 in doshfunc (name=0x143278 "_normal", list=0x143d90, doshargs=0xedcc0, flags=8704, noreturnval=0) at exec.c:2996
#54 0x38270 in execshfunc (cmd=0x122100, shf=0x143d00, args=0xedcc0) at exec.c:2887
#55 0x34fb4 in execcmd (cmd=0x122100, input=0, output=0, how=2, last1=2) at exec.c:2045
#56 0x30a94 in execpline2 (pline=0x123800, how=2, input=0, output=0, last1=0) at exec.c:1062
#57 0x2fbe8 in execpline (l=0x127198, how=2, last1=0) at exec.c:875
#58 0x2f510 in execlist (list=0x123758, dont_change_job=1, exiting=0) at exec.c:744
#59 0x60650 in execif (cmd=0x125350, args=0x0, flags=0) at loop.c:409
#60 0x34d24 in execcmd (cmd=0x125350, input=0, output=0, how=2, last1=2) at exec.c:2008
#61 0x30a94 in execpline2 (pline=0x127f48, how=2, input=0, output=0, last1=0) at exec.c:1062
#62 0x2fbe8 in execpline (l=0x124748, how=2, last1=0) at exec.c:875
#63 0x2f510 in execlist (list=0x124e88, dont_change_job=1, exiting=0) at exec.c:744
#64 0x3857c in execautofn (cmd=0x13ee90, args=0x0, flags=0) at exec.c:2934
#65 0x34d24 in execcmd (cmd=0x13ee90, input=0, output=0, how=2, last1=2) at exec.c:2008
#66 0x30a94 in execpline2 (pline=0x146f18, how=2, input=0, output=0, last1=0) at exec.c:1062
#67 0x2fbe8 in execpline (l=0x1413e0, how=2, last1=0) at exec.c:875
#68 0x2f510 in execlist (list=0x146f30, dont_change_job=1, exiting=0) at exec.c:744
#69 0x38c50 in runshfunc (list=0x146f30, wrap=0x0, name=0x146f48 "_complete") at exec.c:3060
#70 0xfefdc2e8 in comp_wrapper (list=0x146f30, w=0x0, name=0x146f48 "_complete") at compctl.c:2529
#71 0x38b98 in runshfunc (list=0x146f30, wrap=0xfefee0a4, name=0x146f48 "_complete") at exec.c:3048
#72 0x38884 in doshfunc (name=0x146f48 "_complete", list=0x146f30, doshargs=0xe7898, flags=8704, noreturnval=0) at exec.c:2996
#73 0x38270 in execshfunc (cmd=0xe22b8, shf=0x146ea0, args=0xe7898) at exec.c:2887
#74 0x34fb4 in execcmd (cmd=0xe22b8, input=0, output=0, how=2, last1=2) at exec.c:2045
#75 0x30a94 in execpline2 (pline=0x128008, how=2, input=0, output=0, last1=0) at exec.c:1062
#76 0x2fbe8 in execpline (l=0x11fd40, how=2, last1=0) at exec.c:875
#77 0x2f510 in execlist (list=0x122e08, dont_change_job=1, exiting=0) at exec.c:744
#78 0x604d0 in execif (cmd=0x121818, args=0x0, flags=0) at loop.c:397
#79 0x34d24 in execcmd (cmd=0x121818, input=0, output=0, how=2, last1=2) at exec.c:2008
#80 0x30a94 in execpline2 (pline=0x1217b8, how=2, input=0, output=0, last1=0) at exec.c:1062
#81 0x2fbe8 in execpline (l=0x11fc80, how=2, last1=0) at exec.c:875
#82 0x2f510 in execlist (list=0x121218, dont_change_job=1, exiting=0) at exec.c:744
#83 0x5f06c in execfor (cmd=0x128518, args=0xe7858, flags=0) at loop.c:117
#84 0x34d24 in execcmd (cmd=0x128518, input=0, output=0, how=2, last1=2) at exec.c:2008
#85 0x30a94 in execpline2 (pline=0x121500, how=2, input=0, output=0, last1=0) at exec.c:1062
#86 0x2fbe8 in execpline (l=0x122618, how=2, last1=0) at exec.c:875
#87 0x2f510 in execlist (list=0x121518, dont_change_job=1, exiting=0) at exec.c:744
#88 0x3857c in execautofn (cmd=0x13efa8, args=0x0, flags=0) at exec.c:2934
#89 0x34d24 in execcmd (cmd=0x13efa8, input=0, output=0, how=2, last1=2) at exec.c:2008
#90 0x30a94 in execpline2 (pline=0x143bc8, how=2, input=0, output=0, last1=0) at exec.c:1062
#91 0x2fbe8 in execpline (l=0x1440e0, how=2, last1=0) at exec.c:875
#92 0x2f510 in execlist (list=0x143be0, dont_change_job=1, exiting=0) at exec.c:744
#93 0x38c50 in runshfunc (list=0x143be0, wrap=0x0, name=0x13c3f0 "_main_complete") at exec.c:3060
#94 0xfefdc2e8 in comp_wrapper (list=0x143be0, w=0x0, name=0x13c3f0 "_main_complete") at compctl.c:2529
#95 0x38b98 in runshfunc (list=0x143be0, wrap=0xfefee0a4, name=0x13c3f0 "_main_complete") at exec.c:3048
#96 0x38884 in doshfunc (name=0x13c3f0 "_main_complete", list=0x143be0, doshargs=0x0, flags=0, noreturnval=0) at exec.c:2996
#97 0xff05ae58 in callcompfunc (s=0xd4d78 "-vV", fn=0x13c3f0 "_main_complete") at zle_tricky.c:5162
#98 0xff05b884 in makecomplist (s=0xd4d78 "-vV", incmd=0, lst=0) at zle_tricky.c:5326
#99 0xff0596ec in docompletion (s=0x121060 "-vV", lst=0, incmd=0) at zle_tricky.c:4783
#100 0xff04b17c in docomplete (lst=0) at zle_tricky.c:1147
#101 0xff048278 in expandorcomplete (args=0xff08d5e8) at zle_tricky.c:529
#102 0xff047d08 in completecall (args=0xff08d5e8) at zle_tricky.c:428
#103 0xff038efc in execzlefunc (func=0xff08b544, args=0xff08d5e8) at zle_main.c:628
#104 0xff0389f0 in zleread (lp=0xcfd80 "%m%# ", rp=0x0, flags=3) at zle_main.c:547
#105 0x5194c in inputline () at input.c:265
#106 0x51718 in ingetc () at input.c:210
#107 0x47518 in ihgetc () at hist.c:242
#108 0x59770 in gettok () at lex.c:545
#109 0x58ad4 in yylex () at lex.c:308
#110 0x774a4 in parse_event () at parse.c:105
#111 0x4e144 in loop (toplevel=1, justonce=0) at init.c:113
#112 0x1aea0 in main (argc=2, argv=0xffbef48c) at ./main.c:89
-- 
Tanaka Akira


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

end of thread, other threads:[~1999-10-15 10:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-15 10:29 _bison -vV<TAB> dumps core Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-10-15  8:37 Sven Wischnowsky
1999-10-15 10:14 ` Tanaka Akira
1999-10-15  8:02 Tanaka Akira

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).