`install -D file /file` fails and loses the file when the destination's parent is /

未关闭 适合新手
#13,232 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
rust
领域
cli

调研方向

从 install 命令对 -D 选项的处理入手,并使用 install -D -m755 file /file 重现该问题。验证源文件仍然可用、/file 已创建,并且其模式为 0755,与 GNU install 的行为一致。

由索引模型根据 Issue 内容生成。

描述

U - install

When the destination of install -D is a single-component absolute path (i.e. its parent directory is the filesystem root /), install fails with a chmod error and does not produce the destination file. GNU coreutils handles this correctly.

Steps to reproduce

ubuntu@resolute-racoon:~$ ls
folder file
ubuntu@resolute-racoon:~$ install -D -m755 file /file
install: No such file or directory
ubuntu@resolute-racoon:~$ ls
folder

the file disappears and is not to be found even in /file.

Environmnet

ubuntu 26.04
install (uutils coreutils) 0.8.0

Expected behavior

Per the GNU install(1) documentation for -D:

-D — create all leading components of DEST except the last, then copy SOURCE to DEST

For DEST = /file, the only leading component except the last is /, which already exists. install should simply copy file to /file and set mode 0755.

主要语言
Rust
星标
24.1k
派生
2k
平均合并
1 天 4 小时
30 天内合并 PR
371

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

uutils/coreutils 的其他 Issue

查看 uutils/coreutils 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。