ack doesn't accept input from bash process substitutions #220

Closed
rsimoes opened this Issue Apr 8, 2012 · 6 comments

Comments

Projects
None yet
3 participants

rsimoes commented Apr 8, 2012

cf grep:

$ grep gnome <(ps aux)
rsimoes   1802  0.0  0.2 191684 13588 ?        SLl  Apr04   0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
rsimoes   1814  0.0  0.1 265632  9748 ?        Ssl  Apr04   0:00 /usr/bin/gnome-session --session=ubuntu
...
Owner

petdance commented Apr 9, 2012

How are you calling ack? Can you please provide an actual command line and results?

rsimoes commented Apr 9, 2012

I'm using it in an identical form as the grep call above, so there may be a difference in default behavior I'm not aware of:
$ ack gnome <(ps aux)
(no output)

Owner

petdance commented Apr 9, 2012

I'm sorry about that. Here I thought we'd gone through just about every permutation of dealing with the shell and having ack properly handle it. :-(

ggreer commented Apr 14, 2012

I had to read up on named pipes to figure this out. When you run grep blah <(ps ax), it's running the command grep blah /dev/fd/whatever. The output of ps is sent to that file, but fstat()ing that file gave me a length of zero. Fortunately, I could still read from the file. Also, the struct returned by fstat() contains an st_mode, which is true for named pipes when binary ANDed with S_IFIFO.

You can see the entire fix in C here: https://github.com/ggreer/the_silver_searcher/pull/23/files

My perl-fu is weak, so I'm sorry I can't give you any pointers on how to fix this in ack.

Owner

petdance commented May 21, 2012

The new version of File::Next, version 1.08, supports named pipes. You should be able to install File::Next and ack should now handle named pipes. This will only be if you are NOT using the standalone version.

Owner

petdance commented Apr 27, 2013

Thsi should now be working in ack 2.

petdance closed this Apr 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment