bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] in place option for unexpand


From: Pádraig Brady
Subject: Re: [PATCH] in place option for unexpand
Date: Fri, 27 Mar 2009 11:13:15 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Sami Kerola wrote:
> Mean while I've continued with a first patch. I am having a hard time
> with cp_option_init. My source file is created by mkstemp which causes
> permissions to be 600. What ever I do with preserve permissions bits I
> always seem to get source file permissions in place. Am I such an
> amateur that I am not seeing something obvious, or is it really so
> that there is no preserve destination permissions?

I'm a little confused by what you mean by mkstemp here.
As a first step to support an `in-place cmd files` shell script,
you would need a cp --attributes-only option which should
do what cp does now but not do any read() or write() any data.
That would be generally useful option anyway outside of
an in place editing stuff.

> I also gave a thought to that general wrapper. By waving hands it
> should be a tool that can handle 1. writes after pipe and 2. xargs
> style in-placement. My work name for the command is writeafter. The
> two usage cases in my theory should look something like this.
> 
> 1. grep 127.0.0.1 /etc/hosts |
> writeafter /etc/hosts

That interface seems useful, but note the `sponge` command
from moreutils which I just remembered after your example.
Note sponge can rename() and loose some attributes from
a quick glance at the code.

> 2. echo /etc/passwd /etc/shadow |
> writeafter -I '{}' grep root '{}'
> 
> Does that sound like something reasonable? If yes, it might take a
> while to come up with a well working implementation but I'm sure
> that's doable.

that seems a little over complicated as I can't see one
needing to split files to edit and files to process on
position like that.

cheers,
Pádraig.




reply via email to

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