| ▲ | devnonymous 12 hours ago | |
I'm almost certain what the OP meant was if the commands were run synchronously (ie: from 2 different shells or as `mv a b &; mv c d`) yes there is a possibility that a and d exist (eg: On a busy system where neither of the 2 commands can be immediately scheduled and eventually the second one ends up being scheduled before the first) Or to go a level deeper, if you have 2 occurrences of rename(2) from the stdlibc ... rename('a', 'b'); rename('c', 'd'); ...and the compiler decides on out of order execution or optimizing by scheduling on different cpus, you can get a and d existing at the same time. The reason it won't happen in the example you posted is the shell ensures the atomicity (by not forking the second mv until the wait() on the first returns) | ||
| ▲ | isodude 11 hours ago | parent [-] | |
nitpick, it should be `touch a c & mv a b & mv c d` as `&;` returns `bash: syntax error near unexpected token `;'`. I always find this oddly weird, but that would not be the first pattern in BASH that is. `inotifywait` actually sees them in order, but nothing ensure that it's that way.
`stat` tells us that the timestamps are equal as well.
However, speeding things up changes it a bit.Given
And with `inotifywait` I saw this when running it for a while. | ||