Skip to content

Commit

Permalink
Disable use-sqlite-wal under WSL
Browse files Browse the repository at this point in the history
Before:

    $ nix-channel --update
    unpacking channels...
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)

After:

    $ inst/bin/nix-channel --update
    unpacking channels...
    created 1 symlinks in user environment

I've seen complaints that "sandbox" caused problems under WSL but I'm
having no problems. I think recent changes could have fixed the issue.

(cherry picked from commit d259232)
Signed-off-by: Domen Kožar <domen@dev.si>
  • Loading branch information
puffnfresh authored and domenkozar committed Jun 1, 2020
1 parent a729883 commit 35f5da5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/libstore/globals.cc
Expand Up @@ -103,6 +103,15 @@ StringSet Settings::getDefaultSystemFeatures()
return features;
}

bool Settings::isWSL1()
{
struct utsname utsbuf;
uname(&utsbuf);
// WSL1 uses -Microsoft suffix
// WSL2 uses -microsoft-standard suffix
return hasSuffix(utsbuf.release, "-Microsoft");
}

const string nixVersion = PACKAGE_VERSION;

template<> void BaseSetting<SandboxMode>::set(const std::string & str)
Expand Down
4 changes: 3 additions & 1 deletion src/libstore/globals.hh
Expand Up @@ -34,6 +34,8 @@ class Settings : public Config {

StringSet getDefaultSystemFeatures();

bool isWSL1();

public:

Settings();
Expand Down Expand Up @@ -130,7 +132,7 @@ public:
Setting<bool> fsyncMetadata{this, true, "fsync-metadata",
"Whether SQLite should use fsync()."};

Setting<bool> useSQLiteWAL{this, true, "use-sqlite-wal",
Setting<bool> useSQLiteWAL{this, !isWSL1(), "use-sqlite-wal",
"Whether SQLite should use WAL mode."};

Setting<bool> syncBeforeRegistering{this, false, "sync-before-registering",
Expand Down

0 comments on commit 35f5da5

Please sign in to comment.