3 ms·
I may be missing something here, but why are things like this not repotrted as a bug ?
by alok4nand 7y ago
I may be missing something here, but why are things like this not repotrted as a bug ?
- jchw 7y agoIt is not really a bug, just counter intuitive behavior. Their example is somewhat contrived, usually this will just manifest in something being broken. If you use an editor with safe saves this might not even happen because that works by saving to a temp file and doing an atomic swap, and unlinking the old file. In that case, I believe the script should continue as written, because the fd should point to the unlinked file. I believe vim does this by default, for example.
- larschdk 7y agoUsing rename() does this for you. It's actually guaranteed to preserve the contents of the old file for any process still having it open while atomically letting any future process only see the new file.
- noja 7y agoThis is a bug because the downside of this behaviour is outweighed by some tiny upside. But I've never seen a person editing a bash script without an editor that swaps in a new version of the file until today, so never knowingly encountered this bug before. It should be fixed.
- yachtman 7y agoI don't think that's how you define a bug. I think technically you could argue its a "logical error", however that assumes that you know the intent of the creator of bash was specifically to not allow this behavior which I don't think is the case.
- noja 7y agoIf nearly everyone doesn't expect the behaviour, and the behaviour has a serious downside, it's a bug.