Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o, Michael Palimaka <kensington@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH 1/3] bin/misc-functions.sh: Introduce eqalog and eqawarnlog functions.
Date: Sat, 25 Oct 2014 20:43:24
Message-Id: 20141025224103.1da8c0e6@pomiot.lan
In Reply to: Re: [gentoo-portage-dev] [PATCH 1/3] bin/misc-functions.sh: Introduce eqalog and eqawarnlog functions. by Zac Medico
1 Dnia 2014-10-25, o godz. 13:28:54
2 Zac Medico <zmedico@g.o> napisał(a):
3
4 > On 10/25/2014 01:25 PM, Michał Górny wrote:
5 > > Dnia 2014-10-25, o godz. 12:42:14
6 > > Zac Medico <zmedico@g.o> napisał(a):
7 > >
8 > >> On 10/25/2014 09:15 AM, Michael Palimaka wrote:
9 > >>> +eqalog() {
10 > >>> + local tag=$1 x
11 > >>> + shift
12 > >>> + for x in "$@" ; do
13 > >>> + echo "${tag}" "${x}" >> "${T}"/qa.log
14 > >>> + done
15 > >>> +}
16 > >>
17 > >> Your patches look good to me, except that I think eqalog should escape
18 > >> any \n characters that might be embedded in the arguments.
19 > >
20 > > Why? That sounds like some unsafe fancy feature only one person would
21 > > use. Embedding newlines in bash is trivial, why make them implicit with
22 > > a lot of added complexity?
23 >
24 > Because the caller should not be concerned about the qa.log file format.
25 > The fact that it's delimited by newlines is an implementation detail
26 > that the caller need know nothing about. Escaping the new lines is
27 > really not all that complex. All of the elog functions have similar
28 > handling for newlines.
29
30 Oh, you mean converting from newlines to \n escapes? I thought
31 the opposite way, sorry then.
32
33 --
34 Best regards,
35 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies