touch(truncate=True) is a bad default
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 398
- Forks
- 181
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
What happened:
I wanted to update the timestamp on 2000 objects, comprising of 5 TB of data on Google Cloud. So I ran
for obj in obj_list:
fs.touch(obj)
What you expected to happen:
Consistent with my experience with the unix touch command, I assumed the default behavior would be to just update the modification time. Instead, I lost 5 TB of valuable data. This is my fault, for not reading the docstring
Signature: fs.touch(path, truncate=True, **kwargs)
Docstring:
Create empty file, or update timestamp
Parameters
----------
path: str
file location
truncate: bool
If True, always set file size to 0; if False, update timestamp and
leave file unchanged, if backend allows this
However, I would argue that this is a very bad default value for truncate. Why deviate from the standard unix behavior? I can't be the first user to make this mistake...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue identifies fs.touch(path, truncate=True, **kwargs) and its docstring as the relevant entry point; start there and inspect how the default is documented and exercised. Decide whether the default should match Unix touch semantics, then update the behavior and documentation so the default preserves existing data while an explicit truncation option remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100