fix(GH#1224): detect Docker Desktop bind mounts in WSL2 and disable WAL mode
Fixes stack overflow and database initialization failures when running bd on WSL2 with Docker Desktop bind mounts. ## Problem The bd CLI crashed with stack overflow when running on WSL2 with repositories on Docker Desktop bind mounts (/mnt/wsl/docker-desktop-bind-mounts/...). SQLite WAL mode fails with 'locking protocol' error on these network filesystems. ## Solution - Expand WAL mode detection to identify Docker bind mounts at /mnt/wsl/* (in addition to Windows paths at /mnt/[a-zA-Z]/) - Fall back to DELETE journal mode on these problematic paths - Add comprehensive unit tests for path detection Fixes GH #1224, relates to GH #920 Co-authored-by: maphew <matt.wilkie@gmail.com>
This commit is contained in:
44
test_wsl2_wal.sh
Executable file
44
test_wsl2_wal.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# Test script to reproduce GH#1224 - SQLite WAL mode on WSL2 bind mounts
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== Testing SQLite WAL mode on WSL2 bind mounts ==="
|
||||
|
||||
# Check if we're in WSL2
|
||||
if ! grep -qi microsoft /proc/version; then
|
||||
echo "Not running in WSL2, skipping test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create test directory in different locations
|
||||
test_paths=(
|
||||
"/tmp/beads-test-wal" # /tmp (Linux filesystem)
|
||||
"/mnt/c/temp/beads-test-wal" # Windows filesystem (if available)
|
||||
)
|
||||
|
||||
# Add Docker Desktop bind mount if available
|
||||
if [ -d "/mnt/wsl" ]; then
|
||||
test_paths+=("/mnt/wsl/beads-test-wal") # Docker Desktop bind mount
|
||||
fi
|
||||
|
||||
for test_path in "${test_paths[@]}"; do
|
||||
echo ""
|
||||
echo "Testing WAL mode at: $test_path"
|
||||
|
||||
# Create directory
|
||||
mkdir -p "$test_path"
|
||||
|
||||
# Test with SQLite CLI
|
||||
sqlite3 "$test_path/test.db" "PRAGMA journal_mode=WAL;" 2>&1 | head -1
|
||||
|
||||
# Check if WAL was actually enabled
|
||||
journal_mode=$(sqlite3 "$test_path/test.db" "PRAGMA journal_mode;" 2>&1 | head -1)
|
||||
echo "Journal mode: $journal_mode"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$test_path"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=== Test complete ==="
|
||||
Reference in New Issue
Block a user