scandirat return dirents of parent dir

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Jul 5 08:02:00 GMT 2017


On Jul  5 05:38, comic fans wrote:
> I've already submitted a patch for this but your fix is much
> quicker... confirmed this snapshot resolved the problem. Thank you.
> >> Hello:
> >>      I've found this problem when compile
> >> casync(https://github.com/systemd/casync.git) in cygwin,workflow to
> >> trigger this :
> >>     rootfd=open(".",O_CLOEXEC|O_RDONLY|O_NOCTTY);
> >>     scandirat(rootfd,".", firstLevelDirEnts......);
> >>     foreach dirent in firstLevelDirEnts:
> >>          if dirent is dir:
> >>              subdirfd=openat(rootfd,
> >>                   dirent->d_name,O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
> >>              scandirat(subdirfd,".",  secondLevelDirEnts......);
> >>
> >>      at this time, secondLevelDirEnts should be files in subdir, but
> >> in cygwin, secondLevelDirEnts is just same as firstLevelDirEnts.
> >>
> >>       This problem didn't happen in linux , nor win10 WSL,  but
> >> happens in both cygwin/msys2.
> >
> >First I thought you stumbled over the problem that the first two entries
> >returned by scandirat are "." and "..", but on closer investigation I
> >saw the problem.
> >
> >I pushed a fix to the git repo and uploaded new developer snapshots
> >to https://cygwin.com/snapshots/  Please try.

I only saw your patch on cygwin-patches hours later, sorry.

Thanks for testing!


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20170705/b0da27ed/attachment.sig>


More information about the Cygwin mailing list