write_entry: untangle symlink and regular-file cases