Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the ack CPAN distribution.

Maintainer(s)' notes

ack's issues are tracked at https://github.com/petdance/ack2

Report information
The Basics
Id: 24670
Status: resolved
Priority: 0/
Queue: ack

People
Owner: Nobody in particular
Requestors: ianburrell [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.56
Fixed in: (no value)



Subject: Test failures when run detached from tty
Download (untitled) / with headers
text/plain 332b
The tests fail when run without a tty. This happens when building rpms. t/ack-type........ack-standalone: Can't use -f when acting as a filter. # Failed test 'File lists match via --perl' # in t/ack-type.t at line 42. # Structures begin differing at: # $got->[0] = Does not exist # $expected->[0] = 'Ack.pm'
From: PETEK [...] cpan.org
Download (untitled) / with headers
text/plain 963b
This happens because ack only checks whether STDIN is a tty. The intent of the check is to see if data should be filtered from STDIN, which is assumed to be the case if STDIN is not a tty. However, I believe that if STDIN is not a tty and there's no data available on it (because it's closed or it's null/EOF), ack should proceed as normal. The test failures can be reproduced with: perl -e 'close(STDIN); print system("make","test")' I have attached a patch that checks for EOF on STDIN, which also allows this to succeed: cat /dev/null | make test In doing that, ack will now not treat null or closed STDIN as if it's running from a terminal, and yet "echo foo | ack foo" still works. The catch is that the following now fails to do the right thing: /bin/true | ack foo where /bin/true is any command that doesn't have output. A warning to STDERR may be appropriate in that case, along the lines of: ack: STDIN is not a terminal and has no data, ignoring
From: PETEK [...] cpan.org
Download (untitled) / with headers
text/plain 963b
This happens because ack only checks whether STDIN is a tty. The intent of the check is to see if data should be filtered from STDIN, which is assumed to be the case if STDIN is not a tty. However, I believe that if STDIN is not a tty and there's no data available on it (because it's closed or it's null/EOF), ack should proceed as normal. The test failures can be reproduced with: perl -e 'close(STDIN); print system("make","test")' I have attached a patch that checks for EOF on STDIN, which also allows this to succeed: cat /dev/null | make test In doing that, ack will now not treat null or closed STDIN as if it's running from a terminal, and yet "echo foo | ack foo" still works. The catch is that the following now fails to do the right thing: /bin/true | ack foo where /bin/true is any command that doesn't have output. A warning to STDERR may be appropriate in that case, along the lines of: ack: STDIN is not a terminal and has no data, ignoring
diff -ur --exclude=blib ack-1.58/ack ack-1.58-modified/ack --- ack-1.58/ack 2007-01-18 22:44:38.000000000 -0600 +++ ack-1.58-modified/ack 2007-03-02 11:51:54.000000000 -0600 @@ -159,7 +159,7 @@ $opt{show_filename} = (@what > 1) || (!-f $what[0]); } else { - my $is_filter = !-t STDIN; + my $is_filter = !-t STDIN && !eof(STDIN); if ( $is_filter ) { # We're going into filter mode for ( qw( f l ) ) { diff -ur --exclude=blib ack-1.58/ack-standalone ack-1.58-modified/ack-standalone --- ack-1.58/ack-standalone 2007-03-02 11:54:02.000000000 -0600 +++ ack-1.58-modified/ack-standalone 2007-03-02 11:55:11.000000000 -0600 @@ -157,7 +157,7 @@ $opt{show_filename} = (@what > 1) || (!-f $what[0]); } else { - my $is_filter = !-t STDIN; + my $is_filter = !-t STDIN && !eof(STDIN); if ( $is_filter ) { # We're going into filter mode for ( qw( f l ) ) {
This should be fixed in 1.60, uploaded tonight.
From: ianburrell [...] gmail.com
Download (untitled) / with headers
text/plain 747b
The bug isn't fixed in 1.60. You can show this bug by running "make test" with nohup. Or redirect stdin to /dev/null (make test < /dev/null Show quoted text
>& test.out).
ack-1.62$ nohup make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'bl ib/arch')" t/*.t t/00-load.........# Testing App::Ack 1.62, Perl 5.008008, /usr/bin/perl ok t/ack-a...........ok t/ack-binary......ok t/ack-c...........ok t/ack-type........ack-standalone: Can't use -f when acting as a filter. # Failed test 'File lists match via --perl' # in t/ack-type.t at line 47. # Structures begin differing at: # $got->[0] = Does not exist # $expected->[0] = 'Ack.pm' ack-standalone: Can't use -f when acting as a filter.
From: JOHANL [...] cpan.org
Download (untitled) / with headers
text/plain 118b
This also occurs on Windows from e.g. within Emacs, for the same reasons. The patch provided earlier seems to fix it.
Fixed in next release.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.