[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: readdir extension on windows with getline
From: |
Andrew J. Schorr |
Subject: |
Re: readdir extension on windows with getline |
Date: |
Thu, 26 Jan 2023 15:01:28 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi,
On Thu, Jan 26, 2023 at 08:15:51PM +0200, Eli Zaretskii wrote:
> I found the reason: the code in redirect_string relies on devopen to
> succeed when passed a directory name, and only _after_ it succeeds,
> redirect_string tries to find an input parser. But on Windows,
> open'ing a directory always fails, and thus the logic in
> redirect_string doesn't give a chance to registered parsers to try to
> take control of reading directories.
Thanks for chasing this down. Just checking -- did you test this patch? Maybe
I'm being stupid, but it looks to me as if the readdir extension needs the
caller to have succeed in opening a file already that passes the S_ISDIR test.
I don't see how that can work if you're saying that open fails on a directory
name. I'm frankly surprised that it can work with the directory on the command
line. I must be missing something. There does not appear to be any attempt to
call opendir until after the readdir extension has succeeded in taking charge
of the input file; I just don't see how we would ever get there if open(<dir>)
fails.
>From extension/readdir.c:
static awk_bool_t
dir_can_take_file(const awk_input_buf_t *iobuf)
{
if (iobuf == NULL)
return awk_false;
return (iobuf->fd != INVALID_HANDLE && S_ISDIR(iobuf->sbuf.st_mode));
}
How can that test succeed?
Regards,
Andy
- readdir extension on windows with getline, Jim Dailey, 2023/01/25
- Re: readdir extension on windows with getline, Eli Zaretskii, 2023/01/26
- Re: readdir extension on windows with getline, Jim Dailey, 2023/01/26
- Re: readdir extension on windows with getline, Andrew J. Schorr, 2023/01/26
- Re: readdir extension on windows with getline, Andrew J. Schorr, 2023/01/26
- Re: readdir extension on windows with getline, Eli Zaretskii, 2023/01/26
- Re: readdir extension on windows with getline, Eli Zaretskii, 2023/01/26
- Re: readdir extension on windows with getline, Eli Zaretskii, 2023/01/26
- Re: readdir extension on windows with getline,
Andrew J. Schorr <=
- Re: readdir extension on windows with getline, Eli Zaretskii, 2023/01/26
- Re: readdir extension on windows with getline, Andrew J. Schorr, 2023/01/26
- Re: readdir extension on windows with getline, Eli Zaretskii, 2023/01/27
- Re: readdir extension on windows with getline, Jim Dailey, 2023/01/27
- Re: readdir extension on windows with getline, Andrew J. Schorr, 2023/01/26
- Re: readdir extension on windows with getline, Andrew J. Schorr, 2023/01/26