[tpm] more problems than solutions this week

Fulko Hew fulko.hew at gmail.com
Fri May 4 12:00:43 PDT 2012


On Fri, May 4, 2012 at 2:44 PM, <arocker at vex.net> wrote:

>
> I see Indy's answered your problem, but just a point on the topic:
>
> > But what I've found is that the inode doesn't change!
> > [so I'd assume that the ">" redirection simply rewinds
> > the write pointer to offset zero and writes the string
> > and then truncates the file at that point.]
> >
>
> That's why "sort file > file" (and similar commands) is fatal; it resets
> the pointer on the (output) file, then starts trying to read from the
> (input) file, whose pointer now says it's at EOF.
>

And here I always thought it was because it opens the output
file first clobbering the original data before it gets a chance
to open the original data.

It just goes to show you, you DO learn something new every few decades.  :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20120504/6dfe03f7/attachment.html>


More information about the toronto-pm mailing list