bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature Request - prepend to file


From: Brian Dessent
Subject: Re: Feature Request - prepend to file
Date: Sat, 05 Apr 2008 20:02:33 -0700

Eric Blake wrote:

> machines.  Finally, what syntax did you have in mind?  It is probably
> possible to write a shell script that has that exact same syntax, but uses
> existing commands, to achieve the task without needing to add a new coreutil.

I agree that for light duty a few simple shell commands are probably
best.  However, there is something to be said for writing a complete
solution once and then reusing it, rather than reinventing something
every time it comes up.  I'm thinking specifically about all the random
trivialities and corner cases:

- securely choosing a unique filename for the temporary file
- preventing a possible race when replacing the original
- coping with running out of space or being interrupted
- ensuring that temporary files are always cleaned up

I think these are all examples of things that traditionally the
coreutils have had to worry about above and beyond the basic
functionality of a command, so it's not totally unreasonable to make
such a request.  The portability argument of course still holds, and if
that's a concern it's much better to do it with the shell fragment --
but for some people portability is not an issue.

In addition, there's the possibility of doing this in-place if there's
not enough free space and/or if the size of the header fits into memory,
however that is dangerous since you suffer data loss if interrupted.

Brian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]