Opened 12 years ago

Last modified 10 years ago

#201 assigned enhancement

It is not possible to delete/rename open files

Reported by: Yuri Dario Owned by: bird
Priority: normal Milestone: libc-0.7
Component: libc-backend Version:
Severity: normal Keywords: unlink


It is necessary to workaround this bug/feature, because most programs logging to disk do not provide a log rotation since they rely on unix feature to rename/delete files when close is called (usually a cron task issue a rename log followed by a SIG_HUP to daemon).

This is an OS/2 known limit, but I suggest a workaround for klibc-only based programs: since klibc has a global table of open files, just add a proper field to remember the pending rename/delete operation; when file is closed, just execute the action. It will not work for non-klibc programs, but this is acceptable (at least for me).

Change History (6)

comment:1 Changed 12 years ago by bird

A solution that doesn't solve the whole unlink/rename thing is not going into libc proper, it can be supplied via additional libs and used by those who want knowing the restrictions.

It shouldn't be too difficult to come up with a solution that solves the whole problem. Implementing it might require a wee bit effort of course. My idea is to make use of EAs that indicates whether a file is unlink or really rename, renaming being done via hidden symlink like files. Cleaning up should be attempted on every close of a file involved. Transitions need to be defined and to form a kind of state machine. readdir will require filtering.

comment:2 Changed 12 years ago by Yuri Dario

Meanwhile the code has been written as a static library, available here:

as LGPL source code (and binaries).

comment:3 Changed 10 years ago by bird

Resolution: wontfix
Status: newclosed

comment:4 Changed 10 years ago by bird

Keywords: unlink added
Milestone: libc-0.7
Resolution: wontfix
Status: closedreopened

comment:5 Changed 10 years ago by bird

Status: reopenednew

comment:6 Changed 10 years ago by bird

Status: newassigned
Note: See TracTickets for help on using tickets.