我在嵌入式设备中使用Busybox 1.32.0包工具。当我在基于Ubuntu的x64平台中时,如果我试图提取一个符号链接,那么在那里打包的解压缩工具可以在目标目录上进行解压缩,而不会引发任何错误。但是,在Busybox的情况下,当我尝试执行此操作时,已经有一个具有相同链接的符号链接存储在其中,则会得到以下错误:
unzip: '/usr/local/bin/sample.so.1' exists but is not a regular file当然,这不是一个常规文件,因为它实际上是一个符号链接。但我想做的是:
有办法做到这一点吗?
发布于 2021-08-26 19:24:10
不,它不能。
你得先把它拿掉。
这是实际的源代码:
/* Does target file already exist? */
{
int mode = get_lstat_mode(dst_fn);
if (mode == -1) {
/* ENOENT: does not exist */
goto do_open_and_extract;
}
if (overwrite == O_NEVER) {
goto skip_cmpsize;
}
if (!S_ISREG(mode)) {
fishy:
bb_error_msg_and_die("'%s' exists but is not a %
s",
printable_string(dst_fn),
"regular file"
);
}
if (overwrite == O_ALWAYS) {
goto do_open_and_extract;
}正如你所看到的,没有办法绕过这个错误。
https://unix.stackexchange.com/questions/659437
复制相似问题