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>
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/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 ==="
|