{{ message }}
Repository navigation
Conversation
Users (including Tails AppArmor sandbox cases) could pick a directory like /root and start Receive Mode with no error until uploads failed. Check writability with a real probe on browse and before start, and show a clear warning. Adds unit tests for the probe helper. Fixes onionshare#2062.
Contributor
Author
Member
|
Hello @Pitchfork-and-Torch . Thanks for the PR and your contribution. I am going to review the changes soon but probably won't make it to the 2.6.5 release. |
Contributor
Author
|
Thanks @SaptakS. No rush on 2.6.5. Happy to wait for the next train, and I will rebase if main moves before review. |
mig5
requested changes
Sep 21, 2026
| try: | ||
| test_path = os.path.join(path, ".onionshare-write-test") | ||
| with open(test_path, "w", encoding="utf-8") as f: | ||
| f.write("ok") |
Collaborator
There was a problem hiding this comment.
Would you be able to make this a named temp file rather than write to a predictable, static file name? (Not that it's likely to contain any real data, but technically, we're overwriting it, so it's just good practice I think).
Something like this (make sure to add import tempfile):
@staticmethod
def is_data_dir_writable(path):
"""Check directory creation, file writing, and cleanup."""
if not path or not os.path.isdir(path):
return False
try:
with tempfile.TemporaryDirectory(
prefix=".onionshare-write-test-",
dir=path,
) as probe_dir:
with tempfile.NamedTemporaryFile(
mode="wb",
prefix="probe-",
dir=probe_dir,
) as probe:
probe.write(b"ok")
probe.flush()
return True
except OSError:
return False
Contributor
Author
mig5
approved these changes
Oct 2, 2026
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.

Summary
Fixes #2062.
Receive Mode allowed selecting a non-writable folder (e.g.
/rootunder Tails AppArmor) and starting with no warning. Uploads then failed only when files arrived.Changes
os.accessalone for sandboxes)gui_receive_data_dir_not_writableTesting