rewatch watch on Linux stops watching a source folder when an overlapping recursive source folder is removed from rescript.json
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- ocaml
- Domaine
- devtools
Piste de recherche
Start in rewatch/src/watcher.rs, especially compute_watch_paths and update_watches, and trace how overlapping paths are handled when the config changes. Check notify 5.2.0's Linux INotifyWatcher removal behavior described in the issue, then reproduce with the supplied Linux steps. Done means edits under src/retained are picked up after narrowing the source folders without restarting the watcher.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Found by adversarial experiments on semantic analysts.
What is broken
rescript watch registers each source folder as its own watch, and overlapping folders are allowed. Consider sources [{"dir": "src", "subdirs": true}, "src/retained"], which become ["src/retained"] after an edit to rescript.json. On Linux, edits under src/retained are no longer picked up afterwards.
compute_watch_pathsgivessrc(recursive) andsrc/retained(non-recursive) separate entries.- On a config change,
update_watches(called at L599) does three things:- it keeps
src/retainedas unchanged; - it calls
unwatchon the stalesrc; - it registers only the paths that are not kept.
- it keeps
- On Linux,
RecommendedWatcheris notify'sINotifyWatcher. In notify 5.2.0 (the version locked inrewatch/Cargo.lock), unwatching a recursive path removes every watched path that starts with it (src/inotify.rs,remove_watch, lines 518–541 of the crate). That includes the separately registeredsrc/retained. update_watchesstill listssrc/retainedas registered, so it is never re-registered. The package root watch is non-recursive and does not seesrc/retained/*.res.
macOS (FSEvents) keeps the child watch, and there the scenario below works. The Linux result follows from the notify code above; I have not run it on Linux.
Reproduction (Linux)
mkdir -p proj/src/retained && cd proj
echo '{"name":"proj","version":"0.0.0","dependencies":{"rescript":"13.0.0-alpha.7"}}' > package.json
cat > rescript.json <<'EOF'
{"name":"proj","sources":[{"dir":"src","subdirs":true},"src/retained"],
"package-specs":{"module":"esmodule","in-source":true},"suffix":".mjs"}
EOF
echo 'let x = 1' > src/retained/Demo.res
npm install && (npx rescript watch &) && sleep 3
sed -i 's|"sources":.*"src/retained"\],|"sources":["src/retained"],|' rescript.json; sleep 3
echo 'let x = 2' > src/retained/Demo.res; sleep 3
grep 'let x' src/retained/Demo.mjs
Expected: let x = 2;. Per the code above, on Linux Demo.mjs keeps let x = 1; until the watcher restarts.
Introduced by
fb85e7bf8 (#8730). Before it, a full rebuild unregistered every path and registered the complete new list.
Impact
Linux users who narrow an overlapping source configuration while rescript watch runs get silently stale output for the retained folder. One fix is to treat a kept watch as stale when an ancestor recursive watch is removed. Another is to re-register every kept path below a removed recursive path.
- Langage dominant
- OCaml
- Étoiles
- 7.5k
- Forks
- 484
- Merge moyen
- 18 h 19 min
- PR mergées (30 j)
- 116
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de rescript-lang/rescript
-
Build-test fixtures that no longer test what they claimPeut-être pris @cknitt l’a pris il y a 1 jour. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
rescript-lang/rescript#8827 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
rescript-lang/rescript#8833 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Formatter drops comments in dict patterns, variant spread patterns and dict literal spreadsPeut-être pris @cknitt l’a pris il y a 1 jour. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
rescript-lang/rescript#8820 ·
Les mainteneurs répondent en général sous 1 jour
-
JSX preserve mode spreads an `@unboxed` props record (`{..."x"}` instead of `"x"`)Peut-être pris @cknitt l’a pris il y a 1 jour. Ouverte
Difficulté 4/5 1-2 jours Accessibilité débutants 25/100
rescript-lang/rescript#8813 ·
Les mainteneurs répondent en général sous 1 jour
-
Compiler crash (matching.ml assertion) on dict and optional-field record patterns mixing a value and `?None` on one keyPeut-être pris @cknitt l’a pris il y a 1 jour. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
rescript-lang/rescript#8810 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de rescript-lang/rescript
Issues similaires
-
difficulty: easy documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
-
Difficulté 2/5 Moins d'une heure Accessibilité débutants 82/100
SublimeText/LaTeXTools#1717 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
A helper package that registers two plugins (LSP-R) is not applied to the window after a live installPeut-être pris @rchl l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
sublimelsp/LSP#3074 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour