boramalper / magnetico

Autonomous (self-hosted) BitTorrent DHT search engine suite.
http://labs.boramalper.org/magnetico/
GNU Affero General Public License v3.0
3.06k stars 344 forks source link

Can't run on MacOS #240

Closed anacrolix closed 4 years ago

anacrolix commented 4 years ago

Works fine on Linux, but on MacOS, running magneticod I get:

$ magneticod 
2020-02-04T16:17:06.938+1100    INFO    magneticod v0.9.0 has been started.
2020-02-04T16:17:06.939+1100    INFO    Copyright (C) 2017-2019  Mert Bora ALPER <bora@boramalper.org>.
2020-02-04T16:17:06.939+1100    INFO    Dedicated to Cemile Binay, in whose hands I thrived.
2020-02-04T16:17:06.939+1100    INFO    Compiled on 2020-02-04T05:17:00Z
2020-02-04T16:17:06.939+1100    FATAL   Could not open the database at `sqlite3:///Users/anacrolix/Library/Application Support/magneticod/database.sqlite3?_journal_mode=WAL&_busy_timeout=3000&_foreign_keys=true`%!(EXTRA zapcore.Field={error 25 0  sql.DB.Ping: unable to open database file})

Same error on master and v0.9.0.

kescherCode commented 4 years ago

"Unable to open database file" looks like a file permission error or a corrupted DB to me.

anacrolix commented 4 years ago

There's more:

--- FAIL: TestAppdirs (0.00s)
    main_test.go:15: UserDataDir returned an unexpected value!  `/Users/anacrolix/Library/Application Support/magneticod`
    main_test.go:21: UserCacheDir returned an unexpected value!  `/Users/anacrolix/Library/Caches/magneticod`
FAIL
boramalper commented 4 years ago

@anacrolix Thank you for reporting this!

You can ignore the failing tests as they test the paths generated by Appdir package, but assumes linux by default so it fails on other platforms, which are now fixed. 5a869e127b11582275fbdae2543715d65e83c8f0

Can you try again with the latest version? I don't expect it to be resolved, but updated the dependencies which now emit more details.

anacrolix commented 4 years ago

@boramalper the new error message:

2020-02-24T11:33:47.441+1100    FATAL   Could not open the database {"url": "sqlite3:///Users/anacrolix/Library/Application Support/magneticod/database.sqlite3?_journal_mode=WAL&_busy_timeout=3000&_foreign_keys=true", "error": "sql.DB.Ping: unable to open database file: no such file or directory", "errorVerbose": "unable to open database file: no such file or directory\nsql.DB.Ping\ngithub.com/boramalper/magnetico/pkg/persistence.makeSqlite3Database\n\t/Users/anacrolix/src/magnetico/pkg/persistence/sqlite3.go:51\ngithub.com/boramalper/magnetico/pkg/persistence.MakeDatabase\n\t/Users/anacrolix/src/magnetico/pkg/persistence/interface.go:114\nmain.main\n\t/Users/anacrolix/src/magnetico/cmd/magneticod/main.go:95\nruntime.main\n\t/Users/anacrolix/src/go1.13/src/runtime/proc.go:203\nruntime.goexit\n\t/Users/anacrolix/src/go1.13/src/runtime/asm_amd64.s:1357"}

The issue appears to be with the space in the file path given to sqlite3. AFAICT, there's some bad unexpected URI handling, or not, on the sqlite3 side. I'll submit a PR.