Sorry, this mail was sent to Leon Pollak not to mc@ list.
Now I'm sending it to the list.

On Thu, 22 Jun 2023 13:40:50 +0300 Leon Pollak wrote:
> Thank you, Andrew.
> I have version 4.8.29.
> And the kernel is 6.2.15-100.fc36.x86_64.

mc call rewinddir() when opens a directory:
https://midnight-commander.org/ticket/3987

Some VFSses implement(ed) rewinddir() incorrectly. For example:
sshfs: https://github.com/libfuse/sshfs/issues/278
mergerfs: https://github.com/trapexit/mergerfs/issues/877

I think such bug is in the smbnetfs too or even in FUSE.

Test case for smbnetfs:

$ cat a.c
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    DIR * d;
    struct dirent * e;

    if (argc != 2)
        return -1;

    printf("first read:\n");
    d = opendir(argv[1]);
    while (e = readdir(d)) { printf("e: %s\n", e->d_name); }

    printf("second read:\n");
    rewinddir(d);
    while (e = readdir(d)) { printf("e: %s\n", e->d_name); }

    closedir(d);

    return 0;
}
$ gcc a.c -o a && ./a ~/smb/localhost/Exchange.net
first read:
e: .
e: ..
e: aaa
e: bbb
second read:
e: .
e: ..

-- 
Andrew
-- 
mc mailing list
[email protected]
https://lists.midnight-commander.org/mailman/listinfo/mc

Reply via email to