Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Oozing Race Conditions' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Oozing Race Conditions
Authored by: zeniam1 on Dec 11, '08 06:34:54AM

Although not dangerous, scripts like this rarely work correctly. There is no guarantee that efax will appear in your process listing -- it could have come and gone in less than a second. You also don't know when it is safe to pull a copy of the file from a CUPS directory. A better approach would be to offer a wrapped efax application script that would run instead of the original. The script would then call the original. I would bet that there would be some command line arguments that give you the location of the file to fax, allowing you to safely make copies without fear that the original gets moved or goes away.



[ Reply to This | # ]
Oozing Race Conditions
Authored by: xr4ti on Dec 16, '08 02:15:10PM
I've used this script half a dozen times, with 100% success. (Over the last 10 years, I've also used similarly constructed scripts, carefully applied, for unix admin purposes. If you know your target application, and test carefully, scripts like this can be reliable.)

The commenter may not have used common sense when concluding that efax could appear and disappear in less than a 1-second cycle. It it does, then your fax failed to be sent

Also, the script doesn't "pull" a copy, it makes a copy, leaving the original intact and unmolested.

And further, the script waits until the efax process is running which means the file being sent is safe to copy.

In my opinion, a wrapper would be a much worse idea. The next OS update could wipe your wrapper out, and you wouldn't know it until after you lost the chance to copy your next fax.



[ Reply to This | # ]