Comments (9)
Just a guess:
If you run ps -x
do you see entr in the state T
(stopped)?
If so you can fix this by adding -n
to avoid opening STDIN.
from entr.
When I run ps -x
after entr has stopped responding to events, I see this: 873817 pts/10 S+ 0:00 entr echo modified
. Adding -n
to the entr command does not help.
I should also note that if I have entr watch multiple files including the script that executes it (e.g. echo -n "foo.txt\nbar.txt\ntest.sh" | entr echo "modified"
) it will still only respond to a single event from the script file that executed it, but it will continue to respond to events from the other files.
from entr.
I wasn't able to reproduce this problem using Ubuntu 22.04 (Linux 5.15). I can see that the inode changes after modifying the file with vim
$ ls -li test.sh
1051650 -rwxrwxr-x 1 eradman eradman 49 Dec 11 10:15 test.sh
$ vim test.sh
$ ls -li test.sh
1051648 -rwxrwxr-x 1 eradman eradman 50 Dec 11 10:16 test.sh
$ vim test.sh
$ ls -li test.sh
1051645 -rwxrwxr-x 1 eradman eradman 49 Dec 11 10:16 test.sh
Each time entr
responds
$ ./test.sh
modified
modified
modified
Can you run the same experiement with EV_TRACE=1 ./test.sh
?
I'll spin up an Arch Linux instance to see if I see different behavior on a 6.6 kernel
from entr.
Here was the output I received using a 6.1 kernel
$ EV_TRACE=1 ./test.sh
open_max: 524288
modified
0/1: fflags: 0x28 r 100755 ./test.sh
modified
0/1: fflags: 0x29 r 100755 ./test.sh
modified
$ uname
Linux arch 6.1.65-1-lts #1 SMP PREEMPT_DYNAMIC Sun, 03 Dec 2023 12:06:12 +0000 x86_64 GNU/Linux
from entr.
I get this, the output just stops after the first event even if I keep writing the file:
$ EV_TRACE=1 ./test.sh 14:28:58
open_max: 524288
modified
0/1: fflags: 0x8 r 100755 ./test.sh
modified
I'm going to reboot in a little while and try the base kernel (currently using xanmod).
from entr.
For reference, fflags
on Linux represents the following events:
#define IN_ACCESS· · 0x00000001· /* File was accessed */
#define IN_MODIFY· · 0x00000002· /* File was modified */
#define IN_ATTRIB· · 0x00000004· /* Metadata changed */
#define IN_CLOSE_WRITE· · 0x00000008· /* Writtable file was closed */
#define IN_CLOSE_NOWRITE· 0x00000010· /* Unwrittable file closed */
#define IN_OPEN·· · 0x00000020· /* File was opened */
#define IN_MOVED_FROM· · 0x00000040· /* File was moved from X */
#define IN_MOVED_TO·· 0x00000080· /* File was moved to Y */
#define IN_CREATE· · 0x00000100· /* Subfile was created */
#define IN_DELETE· · 0x00000200· /* Subfile was deleted */
#define IN_DELETE_SELF· · 0x00000400· /* Self was deleted */
#define IN_MOVE_SELF· · 0x00000800· /* Self was moved */
from entr.
I tweaked my test a bit:
#!/usr/bin/env bash
printf '%s\n' ./test.sh ./foobar.txt | entr -pn basename /_
...and added a foobar.txt
file. Here's the output when I write foobar.txt
3 times, then test.sh
3 times:
$ EV_TRACE=1 ./test.sh
open_max: 524288
0/1: fflags: 0x9 r 100644 ./foobar.txt
foobar.txt
0/1: fflags: 0x9 r 100644 ./foobar.txt
foobar.txt
0/1: fflags: 0x9 r 100644 ./foobar.txt
foobar.txt
0/1: fflags: 0x8 r 100755 ./test.sh
test.sh
Not sure why there is a difference in the fflags between the events for the two files. Is that indicative of anything?
from entr.
I have a theory about what's happening
inotify does not deliver some events while a file is open (including running binaries). In this case IN_CLOSE_NOWRITE
and IN_DELETE_SELF
does not seem to be not sent until test.sh
completes.
If you save a file (with VIM for example) the file is replaced, but entr
does not open the file again for monitoring since it never saw that the file was unlinked.
If this explanation is correct, this is essentially a deadlock because entr won't see events until the script completes...which it never happen since this script blocks while running entr
$ sudo fuser test.sh
/home/eradman/test.sh: 514923
from entr.
@b0o feel free to reopen if you think there is a problem we should investigate further.
from entr.
Related Issues (20)
- How to deal with user input? HOT 8
- `-r` option seems to force reboot on MacOS HOT 6
- entr: No regular files to watch in ruby HOT 8
- Alternatives to SIGTERM with -r HOT 11
- Use strlcpy with >=glibc-2.38 HOT 9
- Missing entr command on website HOT 1
- Ability to kill the process after a timeout if it fails to stop gracefully HOT 7
- `/_` marker and quotes. HOT 2
- doesn't this force the RLIMIT_NOFILES to be exactly 65536? HOT 11
- Feature request: provide a way to debounce triggers HOT 8
- fatal error: sys/sysctl.h: No such file or directory HOT 3
- `entr` apparently don't work when called from a Makefile task HOT 3
- $0 isn't populated on macOS when using -s HOT 5
- Git tags are not signed HOT 4
- Feature request: print blank line between runs with -b HOT 2
- Feature request: suppress exit status message with -q HOT 7
- 'entr: setrlimit cannot set rlim_cur to 61440: Invalid argument' on macOS HOT 23
- Is there an easy way to print out the time that `entr` ran the last command? HOT 4
- Update link to doc page HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entr.