On Sun, 26 Aug 2007, Denys Vlasenko wrote:

> On Saturday 25 August 2007 23:10, Cristian Ionescu-Idbohrn wrote:
> > AFAICS, that option creates a temporary file on the same fs as the edited
> > file resides on.  And that is indeed optimal, but at the same time
> > somewhat unfortunate for embedded systems.
> >
> > Embedded systems usualy place editable files on flash fs and those fs get
> > used out very much faster compared to real hdfs.  IMO, a better solution
> > for such cases would be to place the temporary files on a ramfs (usualy
> > tmpfs) and overrite the original file at the end of the editing session.
> > This operation is indeed more complicated, but the infrastructure is
> > available (libbb/copy_file and libbb/remove_file.c).  Obviously this
> > should be optional and configurable.
> >
> > What do you think?
>
> I think you mean
>
> sed ... <"$file" >/ramfs/tmp-$$ && mv /ramfs/tmp-$$ "$file"

If one would prefer using mktemp (mkstemp) instead of tmp-$$, it would get
more complicated and inefficient.

> This is what shells are for - to avoid bloating programs with all
> imaginable small improvements.

But of course.  That is one way to do it, but is it as efficient as having
sed do it in one go?  What about combining sed and mv code to achieve the
same?


Cheers,

-- 
Cristian
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to