1 |
On 10/25/2014 01:41 PM, Micha³ Górny wrote: |
2 |
> Dnia 2014-10-25, o godz. 13:28:54 |
3 |
> Zac Medico <zmedico@g.o> napisa³(a): |
4 |
> |
5 |
>> On 10/25/2014 01:25 PM, Micha³ Górny wrote: |
6 |
>>> Dnia 2014-10-25, o godz. 12:42:14 |
7 |
>>> Zac Medico <zmedico@g.o> napisa³(a): |
8 |
>>> |
9 |
>>>> On 10/25/2014 09:15 AM, Michael Palimaka wrote: |
10 |
>>>>> +eqalog() { |
11 |
>>>>> + local tag=$1 x |
12 |
>>>>> + shift |
13 |
>>>>> + for x in "$@" ; do |
14 |
>>>>> + echo "${tag}" "${x}" >> "${T}"/qa.log |
15 |
>>>>> + done |
16 |
>>>>> +} |
17 |
>>>> |
18 |
>>>> Your patches look good to me, except that I think eqalog should escape |
19 |
>>>> any \n characters that might be embedded in the arguments. |
20 |
>>> |
21 |
>>> Why? That sounds like some unsafe fancy feature only one person would |
22 |
>>> use. Embedding newlines in bash is trivial, why make them implicit with |
23 |
>>> a lot of added complexity? |
24 |
>> |
25 |
>> Because the caller should not be concerned about the qa.log file format. |
26 |
>> The fact that it's delimited by newlines is an implementation detail |
27 |
>> that the caller need know nothing about. Escaping the new lines is |
28 |
>> really not all that complex. All of the elog functions have similar |
29 |
>> handling for newlines. |
30 |
> |
31 |
> Oh, you mean converting from newlines to \n escapes? I thought |
32 |
> the opposite way, sorry then. |
33 |
|
34 |
Right, that's what my sample code does. |
35 |
-- |
36 |
Thanks, |
37 |
Zac |