Skip to content

bd dolt start strips env vars from child dolt-sql-server #2812

@harry-miller-trimble

Description

@harry-miller-trimble

Bug Description

bd dolt start spawns a dolt sql-server child process that does not inherit environment variables from the parent shell. This prevents Azure Blob Storage remotes (az://) from authenticating, since Dolt relies on AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_KEY env vars for Azure remotes.

Steps to Reproduce

  1. Configure a Dolt remote: bd dolt remote add origin az://myaccount.blob.core.windows.net/dolt/my-db
  2. Export Azure credentials: export AZURE_STORAGE_ACCOUNT=myaccount and export AZURE_STORAGE_KEY=...
  3. Start the server: bd dolt start
  4. Verify env vars are missing: strings /proc/<PID>/environ | grep AZURE_STORAGE returns empty
  5. bd dolt pull and bd dolt push both fail with "no common ancestor" (actually an auth failure)

Expected Behavior

The dolt-sql-server child process should inherit environment variables from the parent process, or bd should provide a mechanism to pass env vars to the server.

Workaround

Start the dolt server manually with env vars, then write tracking files so bd discovers it:

AZURE_STORAGE_ACCOUNT=myaccount AZURE_STORAGE_KEY="$KEY" \
  nohup dolt sql-server -H 127.0.0.1 -P 44444 > .beads/dolt-server.log 2>&1 &

echo -n "$!" > .beads/dolt-server.pid
echo -n "44444" > .beads/dolt-server.port
touch .beads/dolt-server.lock

bd dolt pull   # Pull complete.
bd dolt push   # Push complete.

Environment

  • bd version: 0.62.0 (Homebrew)
  • dolt version: latest via Homebrew
  • OS: Ubuntu (WSL2)
  • Remote type: Azure Blob Storage (az://)

Impact

Blocks any team using Azure Blob Storage as a Dolt remote from using bd dolt push/pull. Likely also affects AWS remotes relying on AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY.

Suggested Fix

In Go, exec.Command inherits env by default when Cmd.Env is nil. If bd is explicitly setting Cmd.Env, it should include os.Environ() as the base.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions