[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tail: add comments noting potential inotify-related problems
From: |
Jim Meyering |
Subject: |
Re: [PATCH] tail: add comments noting potential inotify-related problems |
Date: |
Fri, 03 Jul 2009 18:06:28 +0200 |
Giuseppe Scrivano wrote:
> I took a look at the problems you reported. The first one is fixed with
> the first attached patch.
>
> I have tested it under Linux 2.6.18-6-xen-686.
Thank you. Applied with only minor formatting changes (i.e., I
moved && to start of continued line).
> tail -F works until the parent directory is not removed and it is very
> related to the second problem you showed. At this point I think the
The potential quadratic-time problem is due to the current O(N)-per-event
cost of determining whether the event names one of the N files we're
tailing. tail.c already uses hash.c, so unless there's a compelling
reason to pull in tree-based code I'm inclined to prefer a hash-based
implementation.
> best way is to find a solution to both, using a tree instead of a hash
> map. What do you think?
I don't (yet?) see why a tree would be the preferred data structure.
...
>>From bfbd6a82055326ea45882664890a5e77aa3bb2a1 Mon Sep 17 00:00:00 2001
> From: Giuseppe Scrivano <address@hidden>
> Date: Thu, 2 Jul 2009 23:40:40 +0200
> Subject: [PATCH 2/2] tail: fixed a test case
>
> * tests/tail-2/wait: Be sure the `not_accessible' file is really not
> accessible before try to "tail -f" it.
Thanks for that, too.
I adjusted the log and pushed your change:
tests: tail-2/wait: don't fail when run as root
* tests/tail-2/wait: Ensure that the unreadable file really is not
readable before trying to run "tail -f" on it.
and then renamed the not_accessible file with this additional change:
>From 66ac50e723096b7350b2a4be004c71b6b6ccc612 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 3 Jul 2009 17:10:27 +0200
Subject: [PATCH 1/2] tests: tail-2/wait: rename internal file name
* tests/tail-2/wait: Rename file from not_accessible to unreadable,
since all the test cares about is readability.
---
tests/tail-2/wait | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/tail-2/wait b/tests/tail-2/wait
index 8f2f610..a902b54 100755
--- a/tests/tail-2/wait
+++ b/tests/tail-2/wait
@@ -28,7 +28,7 @@ require_proc_pid_status_
touch here || framework_failure
touch k || framework_failure
-(touch not_accessible && chmod 0 not_accessible) || framework_failure
+(touch unreadable && chmod a-r unreadable) || framework_failure
fail=0
@@ -46,8 +46,8 @@ if test -n "$state"; then
fi
# Check if the file is really not accessible before use it.
-if ! cat not_accessible; then
- tail -s0.1 -f not_accessible &
+if ! cat unreadable; then
+ tail -s0.1 -f unreadable &
pid=$!
sleep .5
state=$(get_process_status_ $pid)
@@ -90,7 +90,7 @@ if test -n "$state"; then
kill $pid
fi
-tail -s0.1 -F not_accessible &
+tail -s0.1 -F unreadable &
pid=$!
sleep .5
state=$(get_process_status_ $pid)
--
1.6.3.3.507.gc6b5a