Why concurrent runs of shred cause "No such file or directory" errors ?
Issue
- Several instances of the same script are run daily at the same time.
- The script uses
shred -uto delete its temporary files before exiting. - Once in a while, one of those instances output the following error :
shred: /tmp/debug_mktemp.RzwT6UQB: failed to remove: No such file or directory
- Running an strace on the command, it appears to be a race condition, since shred does several renames to a fixed name before actually deleting the file. Sometimes, between it checking if the file already exists and its renaming, another instance of shred obviously creates it or rename it.
- It has been very easy to reproduce.
Environment
Red Hat Enterprise Linux 6.8
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
