Porting to win32 #158

Merged
merged 1 commit into from Mar 1, 2013

Projects

None yet

3 participants

@mattn
Contributor
mattn commented Mar 1, 2013

I ported ag to win32. I dropped color syntax on windows, But It's useful.
Thanks for your work.

@ggreer
Owner
ggreer commented Mar 1, 2013

I assume this requires cygwin? I don't have a windows machine to test it out on, but it doesn't break OS X so I'm merging it.

@ggreer ggreer merged commit e9befe3 into ggreer:master Mar 1, 2013
@mattn
Contributor
mattn commented Mar 1, 2013

This patch does not require cygwin. It makes native win32 application.

@ggreer
Owner
ggreer commented Mar 1, 2013

Really? Wow. I didn't think windows had pthreads.

@mattn
Contributor
mattn commented Mar 1, 2013

If you want, I can remove dependency for pthreads. It's possible to use native thread APIs instead of pthreads.

@ggreer
Owner
ggreer commented Mar 1, 2013

It looks like there's a pthreads library for windows, so it's not necessary. Good work!

@mihaifm
mihaifm commented Mar 5, 2013

@mattn
I compiled this for Windows and I ran into a problem on Win7.
It seems like MapViewOfFile sometimes fails with error 5: ERROR_ACCESS_DENIED
(btw the log_error calls for _WIN32 should use GetLastError instead of strerror(errno))
This seems to be happening for random files each time I run it, and only on Win7. On XP seems to be working fine.

Do you have any idea what might be going wrong here?

@mattn
Contributor
mattn commented Mar 6, 2013

@mihaifm Hmm, Can you figureout the way to reproduce?

@mattn
Contributor
mattn commented Mar 6, 2013

@mihaifm I fixed issue about GetLastError() in #170

@mihaifm
mihaifm commented Mar 6, 2013

It replicates (inconsistently) when I try to search in a large directory.

If we encounter a failed memory map, I think we should attempt a simple read for the whole file into memory (valid for Unix as well).

Something like this.

It worked for me.

@ggreer
Owner
ggreer commented Mar 6, 2013

Is this happening on a 32-bit system of 64-bit? 32-bit can easily run out of address space when mmap()ing large files.

@mihaifm
mihaifm commented Mar 6, 2013

@ggreer on Windows 7 64bit

@mattn mattn added a commit to mattn/the_silver_searcher that referenced this pull request Mar 7, 2013
@mattn mattn Fix ERROR_ACCESS_DENIED on windows #158 f150706
@mattn
Contributor
mattn commented Mar 7, 2013

@mihaifm Could you please try the patch below?

@mihaifm
mihaifm commented Mar 7, 2013

@mattn very cool...that seems to take care of the problem

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