Prev: [Meta] for the record - please ignore (was Re: how to transpose largematrix?)
Next: sed queation - remove all characters after a hyphen
From: Rainer Weikusat on 7 Jun 2010 07:20 K-mart Cashier <cdalten(a)gmail.com> writes: > Someone told me, on another forum, that kill -9 could possibly erase a > temporary file. If the file is intended to be use only temporarily, it ought to be erased before the program(s) which was (were) using it terminate. Sure you don't have this backwards, ie, 'kill -9' could possibly prevent temporary files from being unlinked (because the process which created them was killed before it could remove them)?
From: Barry Margolin on 7 Jun 2010 23:18 In article <aa6dc92b-82f9-460d-b682-d0e3d5c445cf(a)s4g2000prh.googlegroups.com>, David Schwartz <davids(a)webmaster.com> wrote: > On Jun 6, 11:39�pm, gor...(a)hammy.burditt.org (Gordon Burditt) wrote: > > > >4) Program restores the link to that file from the containing > > >directory. > > > What POSIX call will do that? �Does anything but Linux have flink(), > > and what are the security issues? > > I don't believe there's any POSIX call to do it, but there are quite a > few ways (for example, on some operating systems you can use /proc or > equivalent). In any event, this was just an example. > > > >Now imagine you 'kill -9' the program during step 3. Since the only > > >reference to that file (the descriptor that program has) will be lost, > > >the file will be deleted at that point. > > > It seems to me that any program that does this is just begging for > > the file to be lost (any uncaught signal, such as a segfault or > > assert failure, along with exit() will end up losing it). �That's > > what a *temporary* file is, isn't it? �If the file is valuable, > > omit steps (2) thru (4), and put it somewhere safe in the first > > place. > > I agree. But the OP's question was specifically about losing temporary > files. I suspect the OP either misunderstood or was misinformed. What they *could* have been thinking of is an application that writes data to a file with a temporary filename, and at the end renames it to the permanent name. This is often done so that the new data will replace the old data atomically. However, I don't see how this is specific to kill -9. It's unlikely that the program would have a handler for ordinary kill that would perform the final rename, since the whole point of this mechanism is that you don't rename until you're sure you're done. -- Barry Margolin, barmar(a)alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***
From: K-mart Cashier on 8 Jun 2010 17:18
On Jun 7, 4:20 am, Rainer Weikusat <rweiku...(a)mssgmbh.com> wrote: > K-mart Cashier <cdal...(a)gmail.com> writes: > > Someone told me, on another forum, that kill -9 could possibly erase a > > temporary file. > > If the file is intended to be use only temporarily, it ought to be > erased before the program(s) which was (were) using it terminate. Sure > you don't have this backwards, ie, 'kill -9' could possibly prevent > temporary files from being unlinked (because the process which created > them was killed before it could remove them)? I could have possibly misunderstood what I read. What can I say. It happens from time to time. |