Repository navigation
Fix Taildrop delivery paths - #237
Merged
Merged
Conversation
malik-na
approved these changes
Aug 26, 2026
malik-na
left a comment
Member
There was a problem hiding this comment.
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:
lninto an existing directory creates$candidate/$nameand reports the directory as the destination. The-e || -Loccupancy check beforelnstops that.((index++))underset -euo pipefailis fatal on the first collision:indexstarts 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Fix
claim_pathso the staged filename is derived after the local source variable is assigned. With Bash 5, the prior singlelocaldeclaration expanded${staged##*/}beforestagedwas initialized, so deliveries were reported as the downloads directory and name collisions became-1,-2, etc.Verification
bash -n, ShellCheck, andgit diff --check.Fixes the existing
test/shell.d/tailscale-receive-test.shcoverage.