Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-08 Thread David Dyck via Cygwin
Thank you Ken, Corinna, and list members



On Tue, Sep 8, 2020 at 12:32 PM Ken Brown  wrote:

> On 9/8/2020 3:26 PM, Ken Brown via Cygwin wrote:
> > On 9/7/2020 4:35 PM, Ken Brown via Cygwin wrote:
> >> On 9/6/2020 4:28 PM, Ken Brown via Cygwin wrote:
> >>> On 9/6/2020 3:47 PM, Ken Brown via Cygwin wrote:
>  On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:
> > This command triggers an assertion failure
> >"ag" is from the_silver_searcher
> >
> > $ ag 2 <(echo 2)
> > assertion "p >= path" failed: file
> >
> "/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",
>
> >
> > line 3065, function: int symlink_info::check(char*, const
> > suffix_info*, fs_info&, path_conv_handle&)
> > Aborted (core dumped)
> >
> >   3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll
> >  Cygwin DLL version info:
> >  DLL version: 3.1.7
> > bash
> 4.4.12-3OK
> > the_silver_searcher
> 2.2.0-1 OK
>  [...]
> > assertion "p >= path" failed: file
> >
> "/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",
>
> >
> > line 3065, function: int symlink_info::check(char*, const
> > suffix_info*, fs_info&, path_conv_handle&)
> > Aborted (core dumped)
>  [...]
> > I've reported this on github as an "ag" bug, but I think it is a bug
> in cygwin
> 
>  An assertion failure in Cygwin code is a Cygwin bug.  I'll take a
> look.
> >>>
> >>> Running
> >>>
> >>>bash -c '/usr/bin/ag 2 <(echo 2)'
> >>>
> >>> under strace yields the following:
> >>>
> >>>242  191767 [main] ag 33659 open: open(/dev/fd/63/.ignore, 0x0)
> >>> [...]
> >>> 30  192584 [main] ag 33659 mount_info::conv_to_win32_path:
> src_path
> >>> /proc/self/fd/63/.ignore, dst /proc/self/fd/63/.ignore, flags 0x0, rc 0
> >>> [...]
> >>> 31  193366 [main] ag 33659 mount_info::conv_to_win32_path:
> >>> conv_to_win32_path (pipe:[4295036184]/.ignore)
> >>> [...]
> >>> 31  193550 [main] ag 33659 mount_info::conv_to_win32_path:
> >>> conv_to_win32_path (pipe:[4295036184])
> >>> [...]
> >>> 34  193615 [main] ag 33659 symlink_info::check: 0xC034 =
> NtCreateFile
> >>> (\??\C:pipe:[4295036184])
> >>>
> >>> The assertion fails because the path 'C:pipe:[4295036184]' doesn't
> contain a
> >>> backslash.  But probably we should never have allowed ourselves to get
> to the
> >>> point of considering that path.
> >>
> >> I've made some progress but haven't figured out the fix yet.  First,
> for
> >> easier debugging, here's a simpler way to reproduce the problem:
> >>
> >> $ cat proc_bug.c
> >> #include 
> >> #include 
> >> #include 
> >> #include 
> >>
> >> int
> >> main ()
> >> {
> >>int fd[2];
> >>char fname[100];
> >>
> >>if (pipe (fd) < 0)
> >>  {
> >>perror ("pipe");
> >>exit (1);
> >>  }
> >>sprintf (fname, "/dev/fd/%d/foo", fd[0]);
> >>if (open (fname, O_RDONLY) < 0)
> >>  {
> >>perror ("open");
> >>exit (1);
> >>  }
> >> }
> >>
> >> $ gcc -o proc_bug proc_bug.c
> >>
> >> $ ./proc_bug.exe
> >> assertion "p >= path" failed: file
> >> "../../../../newlib-cygwin/winsup/cygwin/path.cc", line 3065, function:
> int
> >> symlink_info::check(char*, const suffix_info*, fs_info&,
> path_conv_handle&)
> >> Aborted (core dumped)
> >>
> >> Here's what happens.  The program is trying to open /dev/fd/3/foo,
> where file
> >> descriptor 3 is the read end of a pipe.  path_conv check resolves this
> to
> >> /proc//fd/3/foo, creates an fhandler_process for this path, and
> calls (at
> >> path.cc:782) fhandler_process::exists.  The latter fills the filebuf
> with
> >> "pipe:[xx]/foo" and returns virt_fsdir.  We're now at
> path.cc:808, and
> >> everything is set up for the assertion failure.
> >
> > This is now fixed.  David, you can test it as soon as Corinna has a
> chance to
> > make a new Cygwin snapshot.
>
> That's now done:
>
>https://cygwin.com/snapshots/
>
> Ken
>

Thank you!

My first time through
  https://cygwin.com/snapshots/
and
  https://cygwin.com/faq.html#faq.setup.snapshots

Installed the dll alone (
https://cygwin.com/snapshots/x86_64/cygwin1-20200908.dll.xz )

and the tests I performed were successful

$ ack 2 <(echo 2)
2
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-08 Thread Ken Brown via Cygwin

On 9/8/2020 3:26 PM, Ken Brown via Cygwin wrote:

On 9/7/2020 4:35 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 4:28 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 3:47 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:

This command triggers an assertion failure
   "ag" is from the_silver_searcher

$ ag 2 <(echo 2)
assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

  3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll
 Cygwin DLL version info:
 DLL version: 3.1.7
bash    4.4.12-3    OK
the_silver_searcher 2.2.0-1 OK

[...]

assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

[...]

I've reported this on github as an "ag" bug, but I think it is a bug in cygwin


An assertion failure in Cygwin code is a Cygwin bug.  I'll take a look.


Running

   bash -c '/usr/bin/ag 2 <(echo 2)'

under strace yields the following:

   242  191767 [main] ag 33659 open: open(/dev/fd/63/.ignore, 0x0)
[...]
    30  192584 [main] ag 33659 mount_info::conv_to_win32_path: src_path 
/proc/self/fd/63/.ignore, dst /proc/self/fd/63/.ignore, flags 0x0, rc 0

[...]
    31  193366 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184]/.ignore)

[...]
    31  193550 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184])

[...]
    34  193615 [main] ag 33659 symlink_info::check: 0xC034 = NtCreateFile 
(\??\C:pipe:[4295036184])


The assertion fails because the path 'C:pipe:[4295036184]' doesn't contain a 
backslash.  But probably we should never have allowed ourselves to get to the 
point of considering that path.


I've made some progress but haven't figured out the fix yet.  First, for 
easier debugging, here's a simpler way to reproduce the problem:


$ cat proc_bug.c
#include 
#include 
#include 
#include 

int
main ()
{
   int fd[2];
   char fname[100];

   if (pipe (fd) < 0)
 {
   perror ("pipe");
   exit (1);
 }
   sprintf (fname, "/dev/fd/%d/foo", fd[0]);
   if (open (fname, O_RDONLY) < 0)
 {
   perror ("open");
   exit (1);
 }
}

$ gcc -o proc_bug proc_bug.c

$ ./proc_bug.exe
assertion "p >= path" failed: file 
"../../../../newlib-cygwin/winsup/cygwin/path.cc", line 3065, function: int 
symlink_info::check(char*, const suffix_info*, fs_info&, path_conv_handle&)

Aborted (core dumped)

Here's what happens.  The program is trying to open /dev/fd/3/foo, where file 
descriptor 3 is the read end of a pipe.  path_conv check resolves this to 
/proc//fd/3/foo, creates an fhandler_process for this path, and calls (at 
path.cc:782) fhandler_process::exists.  The latter fills the filebuf with 
"pipe:[xx]/foo" and returns virt_fsdir.  We're now at path.cc:808, and 
everything is set up for the assertion failure.


This is now fixed.  David, you can test it as soon as Corinna has a chance to 
make a new Cygwin snapshot.


That's now done:

  https://cygwin.com/snapshots/

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


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-08 Thread Ken Brown via Cygwin

On 9/7/2020 4:35 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 4:28 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 3:47 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:

This command triggers an assertion failure
   "ag" is from the_silver_searcher

$ ag 2 <(echo 2)
assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

  3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll
 Cygwin DLL version info:
 DLL version: 3.1.7
bash    4.4.12-3    OK
the_silver_searcher 2.2.0-1 OK

[...]

assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

[...]

I've reported this on github as an "ag" bug, but I think it is a bug in cygwin


An assertion failure in Cygwin code is a Cygwin bug.  I'll take a look.


Running

   bash -c '/usr/bin/ag 2 <(echo 2)'

under strace yields the following:

   242  191767 [main] ag 33659 open: open(/dev/fd/63/.ignore, 0x0)
[...]
    30  192584 [main] ag 33659 mount_info::conv_to_win32_path: src_path 
/proc/self/fd/63/.ignore, dst /proc/self/fd/63/.ignore, flags 0x0, rc 0

[...]
    31  193366 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184]/.ignore)

[...]
    31  193550 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184])

[...]
    34  193615 [main] ag 33659 symlink_info::check: 0xC034 = NtCreateFile 
(\??\C:pipe:[4295036184])


The assertion fails because the path 'C:pipe:[4295036184]' doesn't contain a 
backslash.  But probably we should never have allowed ourselves to get to the 
point of considering that path.


I've made some progress but haven't figured out the fix yet.  First, for easier 
debugging, here's a simpler way to reproduce the problem:


$ cat proc_bug.c
#include 
#include 
#include 
#include 

int
main ()
{
   int fd[2];
   char fname[100];

   if (pipe (fd) < 0)
     {
   perror ("pipe");
   exit (1);
     }
   sprintf (fname, "/dev/fd/%d/foo", fd[0]);
   if (open (fname, O_RDONLY) < 0)
     {
   perror ("open");
   exit (1);
     }
}

$ gcc -o proc_bug proc_bug.c

$ ./proc_bug.exe
assertion "p >= path" failed: file 
"../../../../newlib-cygwin/winsup/cygwin/path.cc", line 3065, function: int 
symlink_info::check(char*, const suffix_info*, fs_info&, path_conv_handle&)

Aborted (core dumped)

Here's what happens.  The program is trying to open /dev/fd/3/foo, where file 
descriptor 3 is the read end of a pipe.  path_conv check resolves this to 
/proc//fd/3/foo, creates an fhandler_process for this path, and calls (at 
path.cc:782) fhandler_process::exists.  The latter fills the filebuf with 
"pipe:[xx]/foo" and returns virt_fsdir.  We're now at path.cc:808, and 
everything is set up for the assertion failure.


This is now fixed.  David, you can test it as soon as Corinna has a chance to 
make a new Cygwin snapshot.


Thanks for reporting the problem.

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


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-07 Thread Ken Brown via Cygwin

On 9/6/2020 4:28 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 3:47 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:

This command triggers an assertion failure
   "ag" is from the_silver_searcher

$ ag 2 <(echo 2)
assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

  3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll
 Cygwin DLL version info:
 DLL version: 3.1.7
bash    4.4.12-3    OK
the_silver_searcher 2.2.0-1 OK

[...]

assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

[...]

I've reported this on github as an "ag" bug, but I think it is a bug in cygwin


An assertion failure in Cygwin code is a Cygwin bug.  I'll take a look.


Running

   bash -c '/usr/bin/ag 2 <(echo 2)'

under strace yields the following:

   242  191767 [main] ag 33659 open: open(/dev/fd/63/.ignore, 0x0)
[...]
    30  192584 [main] ag 33659 mount_info::conv_to_win32_path: src_path 
/proc/self/fd/63/.ignore, dst /proc/self/fd/63/.ignore, flags 0x0, rc 0

[...]
    31  193366 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184]/.ignore)

[...]
    31  193550 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184])

[...]
    34  193615 [main] ag 33659 symlink_info::check: 0xC034 = NtCreateFile 
(\??\C:pipe:[4295036184])


The assertion fails because the path 'C:pipe:[4295036184]' doesn't contain a 
backslash.  But probably we should never have allowed ourselves to get to the 
point of considering that path.


I've made some progress but haven't figured out the fix yet.  First, for easier 
debugging, here's a simpler way to reproduce the problem:


$ cat proc_bug.c
#include 
#include 
#include 
#include 

int
main ()
{
  int fd[2];
  char fname[100];

  if (pipe (fd) < 0)
{
  perror ("pipe");
  exit (1);
}
  sprintf (fname, "/dev/fd/%d/foo", fd[0]);
  if (open (fname, O_RDONLY) < 0)
{
  perror ("open");
  exit (1);
}
}

$ gcc -o proc_bug proc_bug.c

$ ./proc_bug.exe
assertion "p >= path" failed: file 
"../../../../newlib-cygwin/winsup/cygwin/path.cc", line 3065, function: int 
symlink_info::check(char*, const suffix_info*, fs_info&, path_conv_handle&)

Aborted (core dumped)

Here's what happens.  The program is trying to open /dev/fd/3/foo, where file 
descriptor 3 is the read end of a pipe.  path_conv check resolves this to 
/proc//fd/3/foo, creates an fhandler_process for this path, and calls (at 
path.cc:782) fhandler_process::exists.  The latter fills the filebuf with 
"pipe:[xx]/foo" and returns virt_fsdir.  We're now at path.cc:808, and 
everything is set up for the assertion failure.


I think fhandler_process::exists is not doing the right thing here, but I'm not 
familiar with this part of the code, so I'll have to stare at it for a while to 
see what's going wrong.


Corinna, if you are able to see it more quickly and want to go ahead and fix it, 
you won't hurt my feelings.


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


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-06 Thread Eliot Moss

On 9/6/2020 6:15 PM, David Dyck wrote:



On Sun, Sep 6, 2020 at 12:07 PM Eliot Moss mailto:m...@cs.umass.edu>> wrote:
 >
 > On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:
 > > This command triggers an assertion failure
 > >    "ag" is from the_silver_searcher
 > >
 > > $ ag 2 <(echo 2)
 > > assertion "p >= path" failed: file
 > > 
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",

 > > line 3065, function: int symlink_info::check(char*, const
 > > suffix_info*, fs_info&, path_conv_handle&)

 >
 > I just tried this:
 >
 >    grep 2 <(echo 2)
 >
 > on cygwin 3.1.7 and it worked fine.  I am not familiar with Silver Searcher, 
but it would
 > seem that the problem is more idiosyncratic to that program than to Cygwin 
more generally.
 > I am _not_ saying the problem is not in Cygwin - only that ag must be doing 
something
 > somewhat different from what grep does with <( ) command input.  Perhaps ag 
is testing
 > what sort of "thing" (device, etc.) the input file is, while grep does not - 
something
 > like that might give different behavior.
 >
 > Now I have CYGWIN=winsymlinks:native, which may (almost certainly does) 
affect what
 > path.cc is doing (the error message is concerned about symlinks; presumably 
Cygwin
 > is trying to check whether /dev/fd/63 is a symlink.
 >
 > Well, those are the clues I can offer :-) ...   EM

Thanks,  I tried
   export CYGWIN=winsymlinks:native
and it still asserted

I think the "ag" uses mmap and pthreads - at least that is what the manual page 
indicated -
  though even when I passed --nommap I still got the assertion,

 From man ag:

How is it so fast?
* Searching for literals (no regex) uses Boyer-Moore-Horspool strstr.
* Files are mmap()ed instead of read into a buffer.
* If you're building with PCRE 8.21 or greater, regex searches use the JIT 
compiler.
* Ag calls pcre_study() before executing the regex on a jillion files.
* Instead of calling fnmatch() on every pattern in your ignore files, 
non-regex patterns are
loaded into an array and binary searched.
* Ag uses Pthreads to take advantage of multiple CPU cores and search files 
in parallel.


Yes, mmap would fail on a device file like this, but the failure is when trying 
to open a
.ignore file under the device file (which won't exist), as I recall.  As others 
indicated,
there is a problem in cygwin.  It might have to do with flavors of symlink, but 
maybe not.
Anyway, seems folks are onto it.

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


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-06 Thread David Dyck via Cygwin
On Sun, Sep 6, 2020 at 12:07 PM Eliot Moss  wrote:
>
> On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:
> > This command triggers an assertion failure
> >"ag" is from the_silver_searcher
> >
> > $ ag 2 <(echo 2)
> > assertion "p >= path" failed: file
> >
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",
> > line 3065, function: int symlink_info::check(char*, const
> > suffix_info*, fs_info&, path_conv_handle&)

>
> I just tried this:
>
>grep 2 <(echo 2)
>
> on cygwin 3.1.7 and it worked fine.  I am not familiar with Silver
Searcher, but it would
> seem that the problem is more idiosyncratic to that program than to
Cygwin more generally.
> I am _not_ saying the problem is not in Cygwin - only that ag must be
doing something
> somewhat different from what grep does with <( ) command input.  Perhaps
ag is testing
> what sort of "thing" (device, etc.) the input file is, while grep does
not - something
> like that might give different behavior.
>
> Now I have CYGWIN=winsymlinks:native, which may (almost certainly does)
affect what
> path.cc is doing (the error message is concerned about symlinks;
presumably Cygwin
> is trying to check whether /dev/fd/63 is a symlink.
>
> Well, those are the clues I can offer :-) ...   EM

Thanks,  I tried
  export CYGWIN=winsymlinks:native
and it still asserted

I think the "ag" uses mmap and pthreads - at least that is what the manual
page indicated -
 though even when I passed --nommap I still got the assertion,

>From man ag:

> How is it so fast?
> * Searching for literals (no regex) uses Boyer-Moore-Horspool strstr.
> * Files are mmap()ed instead of read into a buffer.
> * If you're building with PCRE 8.21 or greater, regex searches use the JIT
> compiler.
> * Ag calls pcre_study() before executing the regex on a jillion files.
> * Instead of calling fnmatch() on every pattern in your ignore files,
> non-regex patterns are loaded into an array and binary searched.
> * Ag uses Pthreads to take advantage of multiple CPU cores and search
> files in parallel.
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-06 Thread Ken Brown via Cygwin

On 9/6/2020 3:47 PM, Ken Brown via Cygwin wrote:

On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:

This command triggers an assertion failure
   "ag" is from the_silver_searcher

$ ag 2 <(echo 2)
assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

  3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll
 Cygwin DLL version info:
 DLL version: 3.1.7
bash    4.4.12-3    OK
the_silver_searcher 2.2.0-1 OK

[...]

assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc", 


line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

[...]

I've reported this on github as an "ag" bug, but I think it is a bug in cygwin


An assertion failure in Cygwin code is a Cygwin bug.  I'll take a look.


Running

  bash -c '/usr/bin/ag 2 <(echo 2)'

under strace yields the following:

  242  191767 [main] ag 33659 open: open(/dev/fd/63/.ignore, 0x0)
[...]
   30  192584 [main] ag 33659 mount_info::conv_to_win32_path: src_path 
/proc/self/fd/63/.ignore, dst /proc/self/fd/63/.ignore, flags 0x0, rc 0

[...]
   31  193366 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184]/.ignore)

[...]
   31  193550 [main] ag 33659 mount_info::conv_to_win32_path: 
conv_to_win32_path (pipe:[4295036184])

[...]
   34  193615 [main] ag 33659 symlink_info::check: 0xC034 = NtCreateFile 
(\??\C:pipe:[4295036184])


The assertion fails because the path 'C:pipe:[4295036184]' doesn't contain a 
backslash.  But probably we should never have allowed ourselves to get to the 
point of considering that path.


I don't have any more time to think about this today, but I'll get back to it 
tomorrow if no one beats me to it.


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


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-06 Thread Ken Brown via Cygwin

On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:

This command triggers an assertion failure
   "ag" is from the_silver_searcher

$ ag 2 <(echo 2)
assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",
line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

  3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll
 Cygwin DLL version info:
 DLL version: 3.1.7
bash4.4.12-3OK
the_silver_searcher 2.2.0-1 OK

[...]

assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",
line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

[...]

I've reported this on github as an "ag" bug, but I think it is a bug in cygwin


An assertion failure in Cygwin code is a Cygwin bug.  I'll take a look.

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


Re: ag 2 <(echo 2) gets assertion "p >= path" failed: .. /cygwin-3.1.7 ... /cygwin/path.cc", line 3065, function: int symlink_info::check

2020-09-06 Thread Eliot Moss

On 9/6/2020 2:43 PM, David Dyck via Cygwin wrote:

This command triggers an assertion failure
   "ag" is from the_silver_searcher

$ ag 2 <(echo 2)
assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",
line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)

  3473k 2020/08/22 C:\cygwin64\bin\cygwin1.dll
 Cygwin DLL version info:
 DLL version: 3.1.7
bash4.4.12-3OK
the_silver_searcher 2.2.0-1 OK

Wrapping in "bash -c" gives identical results ( see above)
$ /usr/bin/bash -c '/usr/bin/ag 2 <(echo 2)'

Turning on some "ag" debugging reveals worker threads and the
"special" /dev/fd/63 file handle creation ( used with bash "Process
Substitution" )

$ /usr/bin/bash -c '/usr/bin/ag -D 2 <(echo 2)'
  
DEBUG: Query is 2
DEBUG: PCRE Version: 8.44 2020-02-12
DEBUG: Using 7 workers
DEBUG: Thread 0 set to CPU 0
DEBUG: Thread 1 set to CPU 1
DEBUG: Worker 1 started
DEBUG: Worker 0 started
  ...
DEBUG: searching path /dev/fd/63 for 2
assertion "p >= path" failed: file
"/home/corinna/src/cygwin/cygwin-3.1.7/cygwin-3.1.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/path.cc",
line 3065, function: int symlink_info::check(char*, const
suffix_info*, fs_info&, path_conv_handle&)
Aborted (core dumped)


I expected behaviour like ack

$ ack 2 <(echo 2)
2

Noticed that input from pipe works

$ echo 2 | ag 2
2

I've reported this on github as an "ag" bug, but I think it is a bug in cygwin
https://github.com/ggreer/the_silver_searcher/issues/1408

I would appreciate hearing if someone else can reproduce this issue in
3.1.7 or later dll
   ( 3.1.6 seems to hang )

Attached cygcheck.out
   UserName and HostName substituted into cygcheck.out
   one environment variable deleted


I just tried this:

  grep 2 <(echo 2)

on cygwin 3.1.7 and it worked fine.  I am not familiar with Silver Searcher, 
but it would
seem that the problem is more idiosyncratic to that program than to Cygwin more 
generally.
I am _not_ saying the problem is not in Cygwin - only that ag must be doing 
something
somewhat different from what grep does with <( ) command input.  Perhaps ag is 
testing
what sort of "thing" (device, etc.) the input file is, while grep does not - 
something
like that might give different behavior.

Now I have CYGWIN=winsymlinks:native, which may (almost certainly does) affect 
what
path.cc is doing (the error message is concerned about symlinks; presumably 
Cygwin
is trying to check whether /dev/fd/63 is a symlink.

Well, those are the clues I can offer :-) ...   EM
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple