On Tue, Jun 1, 2021 at 1:49 PM Bram Moolenaar <[email protected]> wrote:
>
>
> Felipe Contreras wrote:
>
> > > > Clearly the code meant to check for SHELL_SILENT in order to send to
> > > > /dev/null, not SHELL_EXPAND.
> > > >
> > > > This works because all the callers of get_cmd_output that use
> > > > SHELL_SILENT also use SHELL_EXPAND.
> > > >
> > > > This has been there since Vim 5.0.
> > >
> > > I don't think the value should be changed. Unless you can show a
> > > situation where the wrong thing happens.
> > >
> > > There is one call where only SHELL_EXPAND is used in get_cmd_output().
> > > Thus applying the change does have an effect. It's not so easy to see
> > > how though.
> >
> > The only callers of get_cmd_output() are:
> >
> > * get_cmd_output_as_rettv: sets SHELL_SILENT
> > * find_locales: sets SHELL_SILENT
> > * expand_backtick: sets SHELL_SILENT if EW_SILENT
> >
> > All callers of expand_backtick set EW_SILENT, otherwise they might get
> > "shell returned ..." messages.
>
> get_arglist_exp() calls gen_expand_wildcards() without EW_SILENT,
> which calls expand_backtick(). Then SHELL_SILENT won't be set.
The code cannot reach expand_backtick() because SPECIAL_WILDCHAR
contains `, and therefore has_special_wildchar() returns true.
The more we dig, the less likely it seems it will have an impact. And
of course, if get_arglist_exp() wants a silent gen_expand_wildcards()
it probably should set EW_SILENT.
Or better yet:
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -3170,8 +3170,7 @@ expand_backtick(
buffer = eval_to_string(cmd + 1, TRUE);
else
#endif
- buffer = get_cmd_output(cmd, NULL,
- (flags & EW_SILENT) ? SHELL_SILENT : 0, NULL);
+ buffer = get_cmd_output(cmd, NULL, SHELL_SILENT, NULL);
vim_free(cmd);
if (buffer == NULL)
return -1;
Cheers.
--
Felipe Contreras
--
--
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/CAMP44s3u_m1nEaYvD7b1tBirhe8eb%2B5w-F05mecUa6beSY3cug%40mail.gmail.com.