[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] simply and fix a race in 2 tail --follow tests
From: |
Jim Meyering |
Subject: |
Re: [PATCH] simply and fix a race in 2 tail --follow tests |
Date: |
Thu, 03 Sep 2009 08:23:06 +0200 |
Pádraig Brady wrote:
> I had noticed these tests were a little verbose and
> had meant to simplify them. Coincidentally today
> I triggered a race in tail-2/pid, so the attached
> patch kills two birds with the one stone.
Good timing. I hit this today, too.
>>From ba37fb2e96334b3cc784a4387d74f726be9be98d Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
> Date: Thu, 3 Sep 2009 00:39:17 +0100
> Subject: [PATCH] tests: simplify and fix a race in 2 tail --follow tests
>
> * tests/tail-2/pid: Use the timeout command to determine process
> longevity, rather than querying /proc/$pid/status.
> That was racy in any case as I presume the test was copied
slightly clearer: s/That/The latter/
FYI, tail -f with an unchanging file is different,
now that it's based on inotify. Before, it really was
always in the 'S' state. Now, it wakes up periodically.
Hence this race.
> from tail-2/tail-n0f and wasn't updated to handle the case
> where the background process was in the R (running) state.
> * tests/tail-2/wait: Likewise.
> ---
> tests/tail-2/pid | 37 +++------------------
> tests/tail-2/wait | 93
> ++++++++---------------------------------------------
> 2 files changed, 19 insertions(+), 111 deletions(-)
>
> diff --git a/tests/tail-2/pid b/tests/tail-2/pid
Looks fine, and works for me.
Thanks!