@actions/io: `mv(file, dest)` replaces `dest` when it is a symlink to a directory instead of moving into it
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- devtools
Hướng nghiên cứu
Đọc packages/io/src/io.ts và theo dõi cách mv kiểm tra xem đích có phải là thư mục hay không; so sánh bước kiểm tra đó với io.cp và hành vi useStat của helper isDirectory. Thêm hoặc cập nhật một bài kiểm thử hồi quy cho trường hợp chuyển một tệp vào symlink trỏ đến thư mục, sau đó xác nhận symlink vẫn còn và tệp xuất hiện trong thư mục đích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
io.mv checks whether dest is a directory with ioUtil.isDirectory(dest), which uses lstat by default. When dest is a symlink pointing to a directory, isDirectory(dest) returns false and dest is treated as an existing file. With the default force: true, the symlink is deleted and the source is renamed to the symlink's path; with force: false, it throws "Destination already exists". By contrast, mv(1) (which @actions/io documents mv as following) and io.cp (which uses stat) move/copy the source into the target directory.
To Reproduce
Run the following with @actions/io:
// repro.mjs
import * as io from '@actions/io'
import fs from 'fs'
fs.mkdirSync('real-dir')
fs.symlinkSync('real-dir', 'link-dir')
fs.writeFileSync('a.txt', 'hello')
await io.mv('a.txt', 'link-dir')
console.log('link-dir is symlink:', fs.lstatSync('link-dir').isSymbolicLink())
console.log('real-dir:', fs.readdirSync('real-dir'))
mkdir demo && cd demo && node ../repro.mjs
Actual output:
link-dir is symlink: false
real-dir: []
(link-dir is now the moved file.)
Expected behavior
Matching mv a.txt link-dir (GNU coreutils 9.1) and io.cp:
link-dir is symlink: true
real-dir: [ 'a.txt' ]
Screenshots
N/A
Desktop (please complete the following information):
- OS: Linux (x86_64)
- Browser: N/A
- Version:
@actions/io3.0.2 (npm latest),actions/toolkitmain0c3a9c3, Node.js v26.13.0
Smartphone (please complete the following information):
- Device: N/A
- OS: N/A
- Browser: N/A
- Version: N/A
Additional context
In packages/io/src/io.ts, mv calls ioUtil.isDirectory(dest), whose useStat parameter defaults to false (lstat). Passing ioUtil.isDirectory(dest, true) would use stat and match io.cp and mv(1).
Credit: https://ucsbplse.github.io/
- Ngôn ngữ chính
- TypeScript
- Star
- 5.9k
- Fork
- 1.8k
- Merge trung bình
- 15 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của actions/toolkit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
@actions/exec: `exec(commandLine)` drops `""` arguments and trims trailing spaces of the last argumentCó thể đã có người làm @bardrop đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
actions/toolkit#2565 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
@actions/cache: downloadCacheHttpClientConcurrent never stops its progress timer on failure, so the step hangs until the job times outCó thể đã có người làm @YodHeVauHe đã nhận 46 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của actions/toolkit
Issue tương tự
-
type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
db-ux-design-system/core-web#8856 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
'!' breaking change is lost when the commit also has an empty BREAKING CHANGE footerCó thể đã có người làm @wittdennis đã nhận hôm nay. Đang mởpriority: p3 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
googleapis/release-please#2971 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 87/100
Maintainer thường phản hồi trong vòng 1 ngày
-
🛠️ dette technique
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
betagouv/mon-entreprise#4752 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày