public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* scandirat return dirents of parent dir
@ 2017-07-04 11:09 comic fans
  2017-07-04 12:41 ` Thomas Wolff
  2017-07-04 13:27 ` Corinna Vinschen
  0 siblings, 2 replies; 5+ messages in thread
From: comic fans @ 2017-07-04 11:09 UTC (permalink / raw)
  To: cygwin

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.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scandirat return dirents of parent dir
  2017-07-04 11:09 scandirat return dirents of parent dir comic fans
@ 2017-07-04 12:41 ` Thomas Wolff
  2017-07-04 13:27 ` Corinna Vinschen
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Wolff @ 2017-07-04 12:41 UTC (permalink / raw)
  To: cygwin

On 04.07.2017 13:09, comic fans wrote:
> 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.
It would be nice to provide a complete, compilable test case, please.
It is unclear what you mean by "secondLevelDirEnts is just same" because 
that's different things inside a loop.
Did you consider that one of the entries is ".."?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scandirat return dirents of parent dir
  2017-07-04 11:09 scandirat return dirents of parent dir comic fans
  2017-07-04 12:41 ` Thomas Wolff
@ 2017-07-04 13:27 ` Corinna Vinschen
  1 sibling, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2017-07-04 13:27 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]

On Jul  4 19:09, comic fans wrote:
> 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.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scandirat return dirents of parent dir
  2017-07-04 21:38 comic fans
@ 2017-07-05  8:02 ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2017-07-05  8:02 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scandirat return dirents of parent dir
@ 2017-07-04 21:38 comic fans
  2017-07-05  8:02 ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: comic fans @ 2017-07-04 21:38 UTC (permalink / raw)
  To: cygwin

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.
>
>
>Thanks,
>Corinna
>
>--

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-05  8:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-04 11:09 scandirat return dirents of parent dir comic fans
2017-07-04 12:41 ` Thomas Wolff
2017-07-04 13:27 ` Corinna Vinschen
2017-07-04 21:38 comic fans
2017-07-05  8:02 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).