1 |
Michał Górny <mgorny@g.o> writes:> |
2 |
>> + # Following commands should always succeed unless something weird is going |
3 |
>> + # on. |
4 |
>> + cat "${tmpf}" >"${f}" || die 'failed to replace source file' || return |
5 |
>> + rm "${tmpf}" || die "failed to remove temporary file" |
6 |
> |
7 |
> Any reason not to use mv here? Aside to making this simpler, it would |
8 |
> also prevent this from rewriting contents of hardlinked files. |
9 |
|
10 |
Permissions of ${f} wouldn't be preserved. |
11 |
|
12 |
>> + return 1 |
13 |
>> +} |
14 |
>> + |
15 |
>> +tbegin "preserves permissions" |
16 |
>> + |
17 |
>> +cd "${tmpdir}" || tend $? |
18 |
> |
19 |
> This doesn't terminate tests. So you'll end up creating files |
20 |
> in the wrong directory. |
21 |
|
22 |
Of course! :-/ Probably it would be best to put each test case in a |
23 |
function. I have the same issue in tests for rebar.eclass. Thanks! |
24 |
|
25 |
PS. As of discussion with robbat2, I am probably going to depend on |
26 |
gawk-4.1 (which has in-place edit feature) and use it explicitely in |
27 |
rebar.eclass and some other ebuilds where I meant to use eawk. robbat2 |
28 |
has already requested stabilization of gawk-4.1. |
29 |
|
30 |
Thanks, |
31 |
-- Amadeusz Żołnowski |