`fs.watch`: endless file events reported
オープン
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
Version
v22.21.1
Platform
Microsoft Windows NT 10.0.26200.0 x64
Subsystem
No response
What steps will reproduce the bug?
- create a folder
vscode - run this command in that folder
mkdir .vscode && echo {"editor.fontSize": 33}>.vscode\settings.json - run the following node.js script in a terminal pointing to the folder
vscode/.vscode - run this command in that folder
rmdir /s /q .vscode\ && mkdir .vscode && echo {"editor.fontSize": 33}>.vscode\settings.json
const fs = require("fs");
fs.watch("<path to a folder>/.vscode", (eventType, filename) => {
if (filename) {
console.log(`Event Type: ${eventType}`);
console.log(`Filename: ${filename}`);
} else {
console.log("Filename not provided");
}
});
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
After running the last command there should be change events reported in an endless fashion.
What do you see instead?
Endless reports of:
Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Additional information
Originally reported in VS Code repo as https://github.com/microsoft/vscode/issues/287800
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
fs.watch API から始め、提供された Node.js スクリプトを使って Windows のシーケンスを再現します。繰り返される rename イベントとパスの値を、示されている期待される動作と比較し、その後 Windows のファイル監視パスを追跡します。再現によって意図しない無限のイベントが発生しなくなり、関連する動作がテストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend, operating-systems
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100