下载了Linux kernel源码的tar包文件,使用7zip在Windows下解压。
因为Linux里面有链接(symlinks)文件,直接在Windows平台上解压就会出错。
Cannot create symbolic link : A required privilege is not held by the client. : C:\LinuxKernel\\linux-6.8-rc6\Documentation\Changes
诀窍是以管理员身份运行,因为只有管理员才有权在 Windows 上创建符号链接。为了确认,如果打开 "本地安全策略",然后展开 "本地策略",再点击 "用户权限分配",就会看到 "创建符号链接"。如果双击该链接,就会发现只有管理员组才可以这样做。当我明白了这一点,并在管理员模式下运行 7zip 后,就不再出现错误了,而且还能解压压缩包。
The trick is to run as Administrator because only admin has the rights to create symlinks on Windows. Just to confirm, if you open "Local Security Policy", and then expand "Local Policy" then click on "User Rights Assignment", you'll see "Create symbolic links". If you double-click on that, you'll see that only the Administrators group is able to do that. When I figured this out and ran 7zip in admin mode, I no longer got the error and was able to extract the tarball.
如果没有权限,就会生成一个0字节的同名文件,比如上面的就是“Changes”文件。
如果有权限,就会在Documentation文件夹下生成一个链接文件:
Target就是process文件夹下面的changes.rst文件。
继续解压缩,还会报错,提示:
这是因为Linux下文件名是区分大小写的,但Windows下不区分,所以会出现同名文件,提示你保留原文件还是覆盖,也可以直接选择Auto Rename,或者Yes to All / No to All。
参考:
1,StackOverflow
bash - How to extract a tarball on Windows that contains symlinks - Stack Overflow