Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test run_ack( '--match', 'Sue' ); fails on Windows, chokes on "stdout.log". #393

Closed
ghost opened this issue Oct 3, 2013 · 2 comments
Closed

Comments

@ghost
Copy link

ghost commented Oct 3, 2013

On Windows (XP SP2, Strawberry 5.16.2, should not matter), t/ack-match.t failed for me with Out of memory error. This is because ack searches the stdout.log file as it is written into the build dir, during the 5th test:
run_ack( '--match', 'Sue' );

This patch is a (silly) workaround, a better approach for a fix might be to tell the test instance of ack to ignore all/some .logfiles.

     --- Util.pm.original.ack-2.10  Tue Sep 24 23:35:58 2013
     +++ Util.pm    Thu Oct  3 11:33:44 2013
     @@ -178,8 +178,15 @@
          if ( is_windows() ) {
              require Win32::ShellQuote;
              # Capture stderr & stdout output into these files (only on Win32).
     -        my $catchout_file = 'stdout.log';
     -        my $catcherr_file = 'stderr.log';
     +
     +        # Put into parent of build dir, because build dir is searched by
     +        # ack tests.  Test 5 in ack-match.t:
     +        # run_ack( '--match', 'Sue' );
     +        # can fail with "Out of memory" or fill storage volume -
     +        # Test ack reads stdout.log, appending a message for every read line to
     +        # stdout.log, filling up both storage and memory.
     +        my $catchout_file = '../stdout.log';
     +        my $catcherr_file = '../stderr.log';

              open(SAVEOUT, ">&STDOUT") or die "Can't dup STDOUT: $!";
              open(SAVEERR, ">&STDERR") or die "Can't dup STDERR: $!";
     @@ -199,6 +206,8 @@
              close SAVEERR;
              @stdout = read_file($catchout_file);
              @stderr = read_file($catcherr_file);
     +        unlink $catchout_file;
     +        unlink $catcherr_file;
          }
          else {
              my ( $stdout_read, $stdout_write );
@petdance
Copy link
Collaborator

petdance commented Oct 3, 2013

This is a bigger issue than just this test. I've run into this problem doing regular old searches with ack, where something like

ack blahblah > foo

will have ack searching the foo file for blahblah and looping infinitely over it.

@hoelzro hoelzro added this to the 2.16 milestone Sep 4, 2014
@petdance petdance removed this from the 2.16 milestone Mar 14, 2017
@petdance
Copy link
Collaborator

Or maybe stdout.log should not get written into the current directory?

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

No branches or pull requests

2 participants