Hi Iwamoto san,

I believe I have fixed them.


(Fixed method)

strbuf_sprintf(sb, "%s -d %s > %s", common(), quote_shell(pattern), ...

|

v

strbuf_puts(sb, common());

strbuf_sprintf(sb, " -d %s > %s", quote_shell(pattern), ...


Thank you the report.


Regards,

Shigio

2017-12-29 22:58 GMT+09:00 Hideki IWAMOTO <[email protected]>:

> Hi. Yamaguchi san.
>
> Your changes made gtags-cscope unusable in my environment.
> Before the return value of quote_shell is used
> string pointed to by the return value is changed by another call.
> Since the order in which arguments to functions are evaluated is
> an unspecified behavior,
> You can not assume that "quote_shell(global_command) in common()
> will be executed before quote_shell(pattern)".
>
>
> ====== gdb output====
> Breakpoint 2, 0x00000035eb03ac10 in system () from /lib64/libc.so.6
> (gdb) bt
> #0  0x00000035eb03ac10 in system () from /lib64/libc.so.6
> #1  0x0000000000406a4f in findsymbol (pattern=0x510a60 "main") at find.c:66
> #2  0x0000000000405611 in search () at display.c:456
> #3  0x0000000000403e7f in command (commandc=109) at command.c:555
> #4  0x0000000000402c2f in main (argc=0, argv=0x7fffffad7998) at
> gtags-cscope.c:532
> (gdb) up
> #1  0x0000000000406a4f in findsymbol (pattern=0x510a60 "main") at find.c:66
> 66              status = mysystem("findsymbol_2", strbuf_value(sb));
> (gdb) p sb[0]
> $3 = {name = 0x0,
>   sbuf = 0x54c4c0 "'global' --encode-path=\" \t\" --result=cscope -rs
> 'global' >> /tmp/cscope.10808/cscope.1",
>   endp = 0x54c560 "", curp = 0x54c516 "", sbufsize = 160}
> (gdb) l
> 61                      strbuf_close(sb);
> 62                      return FAILED;
> 63              }
> 64              strbuf_reset(sb);
> 65              strbuf_sprintf(sb, "%s -rs %s >> %s", common(),
> quote_shell(pattern), temp1);
> 66              status = mysystem("findsymbol_2", strbuf_value(sb));
> 67              strbuf_close(sb);
> 68              if (status != 0)
> 69                      return FAILED;
> 70              return NULL;
> ====================
>
>
> On Fri, 29 Dec 2017 00:41:02 -0500 (EST)
> [email protected] (Shigio YAMAGUCHI) wrote:
>
> > CVSROOT:      /sources/global
> > Module name:  global
> > Changes by:   Shigio YAMAGUCHI <shigio>       17/12/29 00:41:02
> >
> > Modified files:
> >       gtags-cscope   : build.c command.c find.c gtags-cscope.c
> >
> > Log message:
> >       Rewrote code to make it safer.
> >
> > CVSWeb URLs:
> > http://cvs.savannah.gnu.org/viewcvs/global/gtags-cscope/
> build.c?cvsroot=global&r1=1.5&r2=1.6
> > http://cvs.savannah.gnu.org/viewcvs/global/gtags-cscope/
> command.c?cvsroot=global&r1=1.12&r2=1.13
> > http://cvs.savannah.gnu.org/viewcvs/global/gtags-cscope/
> find.c?cvsroot=global&r1=1.9&r2=1.10
> > http://cvs.savannah.gnu.org/viewcvs/global/gtags-cscope/
> gtags-cscope.c?cvsroot=global&r1=1.32&r2=1.33
> >
> > _______________________________________________
> > Global-commit mailing list
> > [email protected]
> > https://lists.gnu.org/mailman/listinfo/global-commit
>
> --
> Hideki IWAMOTO <[email protected]>
>
>


-- 
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global

Reply via email to