This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nscd/14906] New: inotify failed when /etc/hosts file change
- From: "binli at opensuse dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Mon, 03 Dec 2012 10:36:26 +0000
- Subject: [Bug nscd/14906] New: inotify failed when /etc/hosts file change
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=14906
Bug #: 14906
Summary: inotify failed when /etc/hosts file change
Product: glibc
Version: 2.11
Status: NEW
Severity: normal
Priority: P2
Component: nscd
AssignedTo: unassigned@sourceware.org
ReportedBy: binli@opensuse.org
CC: drepper.fsp@gmail.com
Classification: Unclassified
Created attachment 6770
--> http://sourceware.org/bugzilla/attachment.cgi?id=6770
The test program
This test program shows the problem. I'm creating a watch on /etc/hosts
(looking for modification or deletion), and it's catching only changes of
the type "echo '#bla' >> /etc/hosts". It doesn't catch changes via copy
to temporary file, do changes, rename temp file back to /etc/hosts. That's
what sed -i is using to atomically do the in place changes.
I thought that adding IN_MOVE should help when setting up the watch,
but it doesn't (commented out in the test program). Even if it would have
helped I would claim the kernel to be broken. If I include IN_MODIFY
in a watch for /etc/hosts, I'm of course also interested if somebody renames
some random file to the watched filename, as it very certainly is a
modification.
Basically as soon as "sed -i" is done on the file the kernel lost track
of the watch and no changes to the "new" /etc/hosts are tracked anymore.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.