jmurzy / codesearch

Automatically exported from code.google.com/p/codesearch
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

cindex fails with mmap errors on OpenBSD #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Trying to run codesearch on OpenBSD -current amd64 with go 1.0.3 from packages, 
using current codesearch code fetched with 'go get', I'm seeing this:

$ go run src/code.google.com/p/codesearch/cmd/cindex/cindex.go /usr/src
2013/03/04 10:52:52 index /usr/src
2013/03/04 10:56:11 flush index
2013/03/04 10:56:12 merge 13 files + mem
2013/03/04 10:56:12 mmap /tmp/csearch-index060279584: errno 4967816
exit status 1

If I run tests I get this,

=== RUN TestMerge
2013/03/04 11:11:32 merge 0 files + mem
2013/03/04 11:11:32 99 data bytes, 1217 index bytes
2013/03/04 11:11:33 merge 0 files + mem
2013/03/04 11:11:33 87 data bytes, 1217 index bytes
2013/03/04 11:11:33 mmap /tmp/index-test259895843: errno 5172144
exit status 1
FAIL    code.google.com/p/codesearch/index      0.411s

The errno seems strange, any suggestions what might be happening? OpenBSD does 
not have UBC so I'm wondering if it may require msync (not sure if cindex is 
mixing access via standard file operations and mmap, but if so, it will need 
msyncs between the different types of access).

Original issue reported on code.google.com by s...@spacehopper.org on 4 Mar 2013 at 11:19

GoogleCodeExporter commented 9 years ago
From mmap_bsd.go:

        if err != nil {
                log.Fatalf("mmap %s: %v", f.Name(), err)
        }

for mmap it seems failure is only indicated by the returned pointer being set 
to MAP_FAILED (on OpenBSD this is (void *)-1), errno being nonzero doesn't 
necessarily indicate an error.

Original comment by sthe...@gmail.com on 24 Oct 2013 at 10:46