entr on big sur is not in sync
varvello opened this issue · 5 comments
varvello commented
Hi guys,
It seems to me that entr is monitoring files one step behind.
I.e. the script: ls | entr -p echo /_
is always printing the previous file I've changed. It only syncs if I press the spacebar. The p
flag isn't really necessary.
Am I doing something wrong?
eradman commented
@varvello, thanks for reporting this: on Big Sur events are reported in a strange way. For the following test I set export EV_TRACE=1
and then appended some test to three different files
$ echo xyz >> c
$ echo xyz >> b
$ echo xyz >> a
OpenBSD
$ ls a b c | entr echo /_
open_max: 16384
/tmp/a
0/1: fflags: 0x6 r 100644 c
/tmp/c
0/1: fflags: 0x6 r 100644 b
/tmp/b
0/1: fflags: 0x6 r 100644 a
/tmp/a
MacOS
$ ls a b c | entr echo /_
open_max: 256
/Users/eradman/tmp/a
0/1: fflags: 0x2 r 100644 c
/Users/eradman/tmp/c
0/1: fflags: 0x8 r 100644 c
0/1: fflags: 0x2 r 100644 b
/Users/eradman/tmp/c
0/1: fflags: 0x8 r 100644 b
0/1: fflags: 0x2 r 100644 a
/Users/eradman/tmp/b
0/1: fflags: 0x8 r 100644 a
I'll investigate this further
eradman commented
Here is a different view of the events using the diagnostic utility kqueue-touch
$ echo xyz >> test-file
OpenBSD
event 1/1: flags: 0x21 fflags: 0x6
MacOS
$ ./kqueue-touch
event 1/1: flags: 0x21 fflags: 0x8
event 1/1: flags: 0x21 fflags: 0x4
event 1/1: flags: 0x21 fflags: 0x2
event 1/1: flags: 0x21 fflags: 0x8
That last event is coming in about a second later! This is wrong, and certainly new behavior for any OS. For reference:
/*
* data/hint flags for EVFILT_VNODE, shared with userspace
*/
#define NOTE_DELETE 0x0001 /* vnode was removed */
#define NOTE_WRITE 0x0002 /* data contents changed */
#define NOTE_EXTEND 0x0004 /* size increased */
#define NOTE_ATTRIB 0x0008 /* attributes changed */
#define NOTE_LINK 0x0010 /* link count changed */
#define NOTE_RENAME 0x0020 /* vnode was renamed */
#define NOTE_REVOKE 0x0040 /* vnode access was revoked */
#define NOTE_TRUNCATE 0x0080 /* vnode was truncated */
eradman commented
eradman commented
Super!