Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rewinddir() does not work as expected #278

Open
el-bart opened this issue Feb 15, 2022 · 2 comments
Open

rewinddir() does not work as expected #278

el-bart opened this issue Feb 15, 2022 · 2 comments
Labels

Comments

@el-bart
Copy link

el-bart commented Feb 15, 2022

sshfs-fuse version 3.7.1 (i.e. latest in Debian Bullseye - aka: stable). the problem is with rewinddir() call, that does not seem to work. example test program:

#include <sys/types.h>
#include <dirent.h>
#include <iostream>

int main(int argc, char** argv)
{
  if(argc!=1+1)
  {
    std::cerr << argv[0] << " </path/to/dir>" << std::endl;
    return 2;
  }

  auto d = opendir(argv[1]);

  std::cout << "#1:" << std::endl;
  while( auto e = readdir(d) )
    std::cout << " >> " << e->d_name << std::endl;

  std::cout << std::endl << "### rewinding" << std::endl << std::endl;
  rewinddir(d);

  std::cout << "#2:" << std::endl;
  while( auto e = readdir(d) )
    std::cout << " >> " << e->d_name << std::endl;
}

output on "regular" directory is (as expected):

#1:
 >> .
 >> ..
 >> some_dir_1
 >> some_dir_2
 >> some_file

### rewinding

#2:
 >> .
 >> ..
 >> some_dir_1
 >> some_dir_2
 >> some_file

actual output on sshfs-mounted directory is:

#1:
 >> .
 >> ..
 >> some_dir_1
 >> some_dir_2
 >> some_file

### rewinding

#2:

it looks like rewinddir() does not have any affect on sshfs.

@el-bart
Copy link
Author

el-bart commented Feb 15, 2022

note that this issue is what makes sshfs mounts unusable under mc (see https://midnight-commander.org/ticket/4289).

@Nikratio
Copy link
Contributor

Yep, that's a known problem. Patches welcome :-).

There is some more information in #211, but I'm keeping this one open because it's more concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants