3 ms·
> But you are aware it creates a potential race condition, right? If your script has to be idempotent in the face of concurrent executions of itself, then tha
by kazinator 5y ago
> But you are aware it creates a potential race condition, right?
If your script has to be idempotent in the face of concurrent executions of itself, then that's an extra requirement which you have to handle with locking or whatever.
It is not implied by idempotency; there is meaningful idempotency which excludes the concurrency requirement.
If something can rename example.txt in parallel with your script, at any time during its execution, there is nothing you can do to ensure that it's gone.
Whatever step you take to ensure that its is gone can be preceded by the parallel rename.
- SkittyDog 5y agoI'm not addressing idempotency, that's a separate issue. The comparison we're discussing here is about the relative merits of `rm -f` versus the stat/rm (no '-f' option) approach. The parent post addressed a potential weakness of using the '-f' option--and the proposed alternative brings tradeoffs. I believe your point about idempotency is correct, though.