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

App::Ack::Resource::Basic attempts to open directories for reading with open() #7

Closed
packy opened this issue Nov 29, 2011 · 5 comments
Labels
Milestone

Comments

@packy
Copy link

packy commented Nov 29, 2011

When I try to search my source tree, I get the following error:

$ ack2 -l FOO
ack: .git: Permission denied
Can't call method "name" on an undefined value at d:/git/ack2/ack line 1247.

I was able to trace this back to App::Ack::Resource::Basic line 37, which attempts to open the file it's been passed for reading. If this file is a directory, then this attempt fails (yielding the "Permission denied" error) and the method returns no object (which explains the "Can't call method on undefined value" error immediately afterward). If I make a local modification to the module so line 37 reads

if ((! -d $self->{filename}) && !open( $self->{fh}, '<', $self->{filename} ) ) {

then I get the following output:

$ ack2 -l FOO
Doxyfile
lib/GA/MiddleTier/Ops/Sync/WizardData/Mssql.pm

hoelzro added a commit that referenced this issue Nov 29, 2011
@packy
Copy link
Author

packy commented Nov 29, 2011

Actually, the "chmod 000" in this test is incorred. The directory in question had permissions of 755; the reason for the "Permission denied" error is because Basic.pm was trying to use open() to read a directory instead of opendir(), and under strawberry perl, that fails with a "Permission denied" error.

This test, as coded, does not test for the described error.

@hoelzro
Copy link
Collaborator

hoelzro commented Nov 29, 2011

Ah, it's under Strawberry Perl. I don't have an environment in which to test that; would you mind correcting the test, please? A fixup patch would be nice, too! =)

@hoelzro hoelzro reopened this Nov 29, 2011
@hoelzro
Copy link
Collaborator

hoelzro commented Dec 2, 2011

This should be fixed in 0337281; please test it out.

@hoelzro
Copy link
Collaborator

hoelzro commented Apr 15, 2012

@packy Have you had the chance to test this out?

@hoelzro
Copy link
Collaborator

hoelzro commented May 3, 2012

I just tried this on Win32, and I didn't see the error. So I'm closing this issue.

@hoelzro hoelzro closed this as completed May 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants