bugGNU Core Utilities - Bugs: bug #15473, tail -f fails on append-only files

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #15473: tail -f fails on append-only files

Submitter:  dean gaudet <dgaudet>
Submitted:  Wed 18 Jan 2006 06:14:35 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Sun 12 Feb 2006 08:26:35 AM UTC, comment #2: 

thanks again.
This is fixed for upcoming 5.94 and 6.0.

Jim Meyering <meyering>
Group administrator
Sat 04 Feb 2006 04:04:21 PM UTC, comment #1: 

fyi -- linus has accepted a patch into 2.6.16 which fixes the kernel's behaviour in this case.  the kernel was requiring O_APPEND in F_SETFL on append-only files even if the file was opened for read-only... now it requires that the F_SETFL isn't trying to change the O_APPEND flag on an append-only file.

just mentioning it in case you try to reproduce the problem in the future -- you'll need an older kernel.

-dean

dean gaudet <dgaudet>
Wed 18 Jan 2006 06:14:35 PM UTC, original submission:  

tail -f tries to set O_NONBLOCK on all regular files... which doesn't really accomplish anything except it results in an EPERM on linux when the file is marked append-only... and unfortunately append-only is a really useful attribute for a log file (especially a non-root log file since append-only can only be changed by root).

this is a regression since 5.2.1...

the patch below ignores EPERM errors for O_NONBLOCK on regular files.

to test it do something like this as root:

    echo hi >/tmp/test
    chattr +a /tmp/test
    ./src/tail -f /tmp/test

hi
./src/tail: /tmp/test: cannot change nonblocking mode: Operation not permitted

note that the test file needs to be on an ext[23] or xfs filesystem (possibly others... but doesn't work on tmpfs for example).

-dean

dean gaudet <dgaudet>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #2170:  coreutils-5.93-tail-f-append-only.patch added by dgaudet (561B - text/x-patch - ignore EPERM on regular files when setting O_NONBLOCK)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-02-14 meyering Open/ClosedOpen Closed
2006-02-12 meyering StatusNone Fixed
2006-01-18 dgaudet Attached File- Added coreutils-5.93-tail-f-append-only.patch, #3290

Back to the top

Powered by Savane 3.14-8aba.
Corresponding source code