Endless sftp ls listings on Tru64

From: Lawrence DčOliveiro (ldo_at_geek-central.gen.new_zealand)
Date: 05/30/03


Date: Fri, 30 May 2003 21:36:14 +1200

I wonder if anyone else has come across this problem: when you sftp to
an OpenSSH server (version 3.6.1p2) running on Compaq/HP Tru64 UNIX 5.1
and try the "ls" command on an NFS-mounted volume, either you get an
endless repetition of the same directory listing over and over, or it
seems to hang and return nothing at all.

I managed to track down what the problem was: it's a subtle issue with
the semantics of the readdir call. When readdir returns NULL, that means
you've reached the end of the directory. However, it's not clear to me
what's supposed to happen if you call readdir on the same directory
handle again. Looking at the code for sftp-server.c, it expects
subsequent calls to continue returning NULL. On our Linux boxes, this
works fine for both local volumes and NFS-mounted ones. And on the
Alphas running Tru64, it works for local volumes. But for NFS-mounted
ones, it returns NULL once, then starts returning the directory contents
again from the top.

I came up with a patch to sftp-server.c to work around this, but I'll
hold off submitting a bug report to the OpenSSH folks until I get an
opinion from others on where the bug really lies :).



Relevant Pages

  • Re: Endless sftp ls listings on Tru64
    ... > endless repetition of the same directory listing over and over, ... When readdir returns NULL, that means ... > I came up with a patch to sftp-server.c to work around this, ... I didn't submit a bug report, since I wasn't sure where the ...
    (comp.security.ssh)
  • Re: reading directories
    ... > | command, and reading the output. ... > Linux and IRIX have getdents, and the IRIX manpage specifically ... > says that the call is meant to implement readdir() and should not be ...
    (comp.unix.programmer)
  • Re: open file or directory
    ... What is the command that is both good for file & directory ... (for openning) ... file)....Try opendir(), its returns DIR* for the directory opened. ... This DIR* is passed to readdir() to read the content of directory. ...
    (comp.unix.programmer)
  • Re: reading directories
    ... | command, and reading the output. ... and the IRIX manpage specifically ... says that the call is meant to implement readdir() and should not be ...
    (comp.unix.programmer)
  • error on dmesg
    ... NFS: readdir reply truncated! ... I'm using RH8.0 with 2.4.20-20.8smp kernel. ...
    (RedHat)