You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FS notification stop after using sed command on the file #143
If I manually edit the file watched, I get the notifications. However, if I try to edit a file using sed command. I don't receive any notification for this or any subsequent notifications even if I update the file manually with VIM after using sed command.
This is the sed command I am using:
sed -i 's,'getLatestImage=true','getLatestImage=false','
I added some logs and looks like after using this sed command, we are always waiting on this call:
n, errno := syscall.EpollWait(poller.epfd, events, -1) in inotify_poller.go
I don't see any response from this call after using sed command, even when I change the file manually using VIM.
So the original file inotify is watching no longer exists and the new file isn't monitored. I think you need to watch the directory if you want to catch changes like this.
The general way to deal with this is to watch the parent directory and then filter on the file path. It's annoying :-/ There are some other scenarios where this happens to, such as compilers generating binaries.
Either way, seems a duplicate of #17, so I'll close it as such.
Activity
nathany commentedon May 4, 2016
Thanks for the report. Which operating system is this on?
prateekgogia commentedon May 4, 2016
cat /etc/os-release
NAME="Ubuntu"
VERSION="15.10 (Wily Werewolf)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 15.10"
VERSION_ID="15.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
suihkulokki commentedon May 9, 2016
"sed -i foo" is a bit misleading, it doesn't really edit the file in-place - it outputs the file to a temporary file and renames:
open("foo", O_RDONLY)
open("./sedkYoTpL", O_RDWR|O_CREAT)
rename("./sedkYoTpL", "foo")
So the original file inotify is watching no longer exists and the new file isn't monitored. I think you need to watch the directory if you want to catch changes like this.
nathany commentedon May 10, 2016
Thanks @suihkulokki. So
sedexhibits the same issues as text editors #17.arp242 commentedon Jul 21, 2022
The general way to deal with this is to watch the parent directory and then filter on the file path. It's annoying :-/ There are some other scenarios where this happens to, such as compilers generating binaries.
Either way, seems a duplicate of #17, so I'll close it as such.