factor out "untar atomically" code