Skip to content

Fix Taildrop delivery paths - #237

Merged
malik-na merged 3 commits into
omacom:quattrofrom
dl-alexandre:fix/tailscale-claim-path
Aug 26, 2026
Merged

malik-na merged 3 commits into
omacom:quattrofrom
dl-alexandre:fix/tailscale-claim-path

Conversation

@dl-alexandre

Copy link
Copy Markdown

What changed

Fix claim_path so the staged filename is derived after the local source variable is assigned. With Bash 5, the prior single local declaration expanded ${staged##*/} before staged was initialized, so deliveries were reported as the downloads directory and name collisions became -1, -2, etc.

Verification

  • Reproduced the bad path and collision behavior from the pre-fix function.
  • Ran the Taildrop regression test under Bash 5.
  • Ran bash -n, ShellCheck, and git diff --check.

Fixes the existing test/shell.d/tailscale-receive-test.sh coverage.

@malik-na malik-na left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Bash 5 local staged="$1" name="${staged##*/}" bug is real: everything after the first assignment on a local line expands before any of those locals exist, so name was the downloads directory and collisions became -1, -2. Splitting the declarations is the fix.

Two more real bugs in the same function, both worth the extra test cases:

  1. ln into an existing directory creates $candidate/$name and reports the directory as the destination. The -e || -L occupancy check before ln stops that.
  2. ((index++)) under set -euo pipefail is fatal on the first collision: index starts at 0, the post-increment expression is 0, (( )) exits 1, the receiver dies. index=$((index + 1)) always succeeds.

NUL-delimited find -print0 / read -d '' is the right inbox enumerator; a legal filename with a newline was two paths.

Rebase onto #233 before merge — upstream rewrote announce() to the argv --exec form in the same file.

@malik-na
malik-na merged commit 666aa35 into omacom:quattro Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants