bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no feedback on snapshot? coreutils-7.5 coming soon


From: Jim Meyering
Subject: Re: no feedback on snapshot? coreutils-7.5 coming soon
Date: Thu, 13 Aug 2009 16:22:44 +0200

Pádraig Brady wrote:

> Pádraig Brady wrote:
>> C de-Avillez wrote:
>>> Sorry for the delay, got busy. I just built & make check, and got two
>>> errors.
>>>
>>> First one is here, I will re-run the second error by itself in a few.
>>>
>>> Running on Ubuntu 9.10 (kernel 2.6.31.5 with Ubuntu mods, libc6
>>> 2.10.1-0ubuntu6).
>>>
>>> FAIL: tail-2/pid
>>
>>> + tail --pid=2147483647 -f /dev/null
>>> + fail=1
>>
>>> + timeout 1 tail -s.1 -f /dev/null --pid=2147483647
>>> + test 1 = 124
>>
>> So tail silently returns with 1 immediately.
>> The only way I can see this happening is in tail_forever_inotify() at:
>>
>>   if (follow_mode == Follow_descriptor && !found_watchable)
>>     return;
>>
>> I'd better try and pay attention in this meeting ;)
>
> Meeting over :)
> Following from the above analysis, does the attached help?
>
> cheers,
> Pádraig.
>>From af996b0e868752c633477a90802d2dcb382725b8 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
> Date: Wed, 12 Aug 2009 19:01:56 +0100
> Subject: [PATCH] tail: fix tail -f failure when inotify used
>
> * src/tail.c (tail_inotify_forever): Use the correct bounds
> in the error check of the return from inotify_add_watch().
> Reported by C de-Avillez.
> ---
>  src/tail.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/tail.c b/src/tail.c
> index 3c8f425..7d84bec 100644
> --- a/src/tail.c
> +++ b/src/tail.c
> @@ -1231,7 +1231,7 @@ tail_forever_inotify (int wd, struct File_spec *f, 
> size_t n_files,
>            if (hash_insert (wd_table, &(f[i])) == NULL)
>              xalloc_die ();
>
> -          if (follow_mode == Follow_name || f[i].wd)
> +          if (follow_mode == Follow_name || 0 <= f[i].wd)

Ten lines above that, we ensure that 0 <= f[i].wd is true,
so this stmt:
             if (follow_mode == Follow_name || 0 <= f[i].wd)
is equivalent to this:
             if (follow_mode == Follow_name || true)
aka,
             if (true)

so perhaps that change should be larger:

-          if (follow_mode == Follow_name || f[i].wd)
-            found_watchable = true;
+          found_watchable = true;

Also, the initialization (farther above) of f[i].wd to a valid
file descriptor value (0) seems like a mistake:

-          f[i].wd = 0;
+          f[i].wd = -1;

What do you think?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]