Yegappan wrote:
> On Sun, Sep 25, 2022 at 3:22 AM Bram Moolenaar <[email protected]> wrote: > > > > > > > > > > > Patch 9.0.0561 > > > > > Problem: When a test gets stuck it just hangs forever. > > > > > Solution: Set a timeout of 30 seconds. > > > > > Files: src/testdir/runtest.vim > > > > > > > > This is very weird. After including this patch a cscope test started > > > > failing. The error message is confusing, pointing to line 599 of > > > > testdir/runtest.vim, which does not exist. Running "make test_csope" > > > > gets the same error every time. > > > > > > > > Removing the added line makes the test pass again. However, > > > > commenting-out the lines does not! Thus it's not the commands that > > > > cause the problem, but the added text in the function. Deleting some > > > > text, without changing the number of lines, makes it work OK again. > > > > Weird! > > > > > > > > I tried a few other things, but could not find out much more. It does > > > > seem related to the fork/exec that cscope does to run cscope, which > > > > fails because the command name is wrong. Perhaps something with signal > > > > handling? > > > > > > > > If someone likes a puzzle, please have a look at this. > > > > > > > > > > I think the changes made in 8.2.4081 (CodeQL reports problem in > > > if_cscope causing it to fail) > > > are related to this failure. If I copy the latest runtest.vim file to > > > the 8.2.4081 version and > > > run "make test_cscope", I can reproduce the test failure (the test is > > > stuck). > > > > If you do the same before the patch, then there is no problem? > > > > I believe the main change in this patch is that instead of executing a > > shell to run the cscope program it executes cscope directly. It may > > change something in signal handling and what happens if the command > > fails, as it happens in this test. > > > > This, however, does not explain that making a comment shorter or longer > > can make this happen or not... > > > > The following change fixes the test failure: > > ============================================================ > diff --git a/src/if_cscope.c b/src/if_cscope.c > index ccccb518b..96ca8cbf9 100644 > --- a/src/if_cscope.c > +++ b/src/if_cscope.c > @@ -959,7 +959,7 @@ err_closing: > } > > // run the cscope command > - (void)sprintf(cmd, "%s -dl -f %s", prog, csinfo[i].fname); > + (void)sprintf(cmd, "/bin/sh -c \"exec %s -dl -f %s\"", prog, > csinfo[i].fname); > > if (csinfo[i].ppath != NULL) > { > ============================================================ Yes, that works. But this should probably only be done for Unix. And we should use vim_snprintf() to prevent any buffer overflow. I tried to figure out why changing a comment makes it fail or pass, but could not find a reason. Would require digging deeper... -- In Joseph Heller's novel "Catch-22", the main character tries to get out of a war by proving he is crazy. But the mere fact he wants to get out of the war only shows he isn't crazy -- creating the original "Catch-22". /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- 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/20220925160401.ABFE11C0728%40moolenaar.net.
