On 2022-10-12, Gary Johnson wrote:
> I started noticing odd behavior from cscope recently, so I ran 'git
> bisect' and found the problem at this commit:
>
> $ git bisect good
> dc21552c9a83413a018a91e61649cc632929d6a1 is the first bad commit
> commit dc21552c9a83413a018a91e61649cc632929d6a1
> Author: Bram Moolenaar <[email protected]>
> Date: Sun Sep 25 17:03:26 2022 +0100
>
> patch 9.0.0584: cscope test with wrong executable name fails
>
> Problem: Cscope test with wrong executable name fails.
> Solution: Use /bin/sh to execute the command. (Yegappan Lakshmanan)
>
> src/if_cscope.c | 27 ++++++++++++++++-----------
> src/testdir/test_cscope.vim | 14 +++++---------
> src/version.c | 2 ++
> 3 files changed, 23 insertions(+), 20 deletions(-)
I had a little time this evening, so I built 9.0.0584 and ran it
with gdb. I found a problem in cs_create_connection(), in
if_cscope.c. That function creates a command line to be executed,
but does so incorrectly, so when that command line is converted to
argc and argv[] for execvp(), the arguments are incorrect.
>From gdb, just before execvp() is to be called:
(gdb) p cmd
$6 = 0x555555f932b0 "/bin/sh -c \"exec gtags-cscope -dl -f
/home/gary/src/vim/vim/GTAGS\" -P/home/gary/src/vim/vim -a"
(gdb) p *argv@5
$8 = {0x555555cbb1c0 "/bin/sh", 0x555555f8d420 "-c",
0x555555f8dcb0 "exec gtags-cscope -dl -f /home/gary/src/vim/vim/GTAGS",
0x555555f8ef60 "-P/home/gary/src/vim/vim", 0x555555f93a40 "-a"}
The problem is that the quotes that close the exec command are
placed after the -f file name instead of at the end of the complete
command. That causes execvp() to get the exec argument as
exec gtags-cscope -dl -f /home/gary/src/vim/vim/GTAGS
followed by two more arguments,
-P/home/gary/src/vim/vim
-a
I haven't thought through the effect of that, but it doesn't seem
right. The fix should be pretty simple, but I have no more time to
work on it tonight.
Someone else can fix it if they wish, or I'll try fixing it
tomorrow.
Regards,
Gary
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221013074928.GJ24999%40phoenix.