Penguin
Annotated edit history of ETXTBSY version 3, including all changes. View license author blame.
Rev Author # Line
1 WikiAdmin 1 !!!Text file busy
2
3 PerryLorier 3 This occurs when you try and write to a file that is currently being executed by the kernel, or execute a file that is currently open for writing.
1 WikiAdmin 4 For example:
5 $ cp /bin/cat example
6 $ ./example &
2 WikiAdmin 7 [[1] 17238
8 [[1]+ Stopped ./example
1 WikiAdmin 9 $ echo foo >example
10 bash: example: Text file busy
11
12 Note, that although you cannot overwrite the file, you can remove it:
13 $ rm example
14 And then replace it:
15 $ cp /bin/kill ./example
16
17 The reason you can do this is that the kernel will not free the disk space used by the program until the last use of it is free'd, ie: the program exits. If the computer crashes and doesn't get a chance to free these, on a reboot fsck will usually complain about "deleted inode has zero dtime" (the inode was deleted, but never free'd because it was still in use at the time the program crashed). Unix can do this because it refers to a file by it's inode number, and it may have 0 or more filenames. Opening a file and then deleting it (and keeping hold of the filehandle) is a common way of using a temp file, since you know it will be removed from the disk when your program exits. Note that MicrosoftWindows cannot do this, since it refers to a file by name. Thus, you cannot remove a file that is in use in Windows.