"Robin H. Johnson" <robb...@gentoo.org> writes:
>> > cp -f "${tmpf}" "$f" || die "copy back failed"
>> 
>> Why '-f' is required?
> Corner cases w/ copying and bad ebuild usage (specifically running
> ebuild as two different non-root users during development). Mostly
> habit.

Reading:

  http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html

in 3.a.ii it is stated 'cp' should behave like redirection if file
already exists, but in case it must actually force (3.a.iii) it does
unlink first and in that case permissions of destination are not
preserved. So it should either be 'cp' alone or redirection as I already
have.

> Another thought I had, is that if you're using eawk on something in
> $ROOT, you're also going to clobber ownership, permissions and
> extended attributes.

Yes, that's why I have used stream redirection in the first place to
make it explicit/clear that permissions and attributes are preserved.

> If we declare the calling format in BSD style:
> <args> <files>
>
> Then this is negated, but means you need to be able to find the first
> file in the list, which requires parsing the options correctly.

Which is not even an option here. (Pun intended.)

> Another variation that you haven't considered above is passing
> multiple programs to awk via -e or -f options, in which case there is
> no non-option program argument.

Indeed. So one of these:

  a) eawk <file> <awk_args...>
  b) eawk <files...> -- <awk_args...>
  c) eawk <awk_args...> -- <files...>
 
in (b) and (c) "--" is required. This makes it easy to separate options
From files without parsing args. With (c) we would have interface almost
similar to awk (only that we require "--"). (a) is simplest in
implementation and doesn't require "--". I am not sure which is most
intuitive. What do you think?

-- Amadeusz Żołnowski

Attachment: signature.asc
Description: PGP signature

Reply via email to