> Moreover, I can't seem to find a code path that would spawn editor and then print MSG_FAILED
Oh never mind the nonsense, I clearly overlooked the effect of the `goto finish` lines. So either the tmpfile can't be opened after editing, or the editing process changed the line count.
Sorry for the late reply. I can't reproduce. I also grokked the code, `batchrenamecmd` looks pretty portable to me, should work on both GNU userland and BSD userland. Moreover, I can't seem to find a code path that would spawn editor and *then* print `MSG_FAILED`; the only possible return value of `batch_rename` after spawning the editor seems to be `true`, so even if there's something funny with the shell script it shouldn't print "failed".