Gentoo Archives: gentoo-dev

From: Jonathan Callen <jcallen@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: [PATCH] readme.gentoo-r1.eclass: Do not inherit eutils.
Date: Sat, 19 Dec 2015 23:47:59
Message-Id: 5675ECA1.9030209@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] readme.gentoo-r1.eclass: Do not inherit eutils. by "Michał Górny"
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA512
3
4 On 12/19/2015 05:56 PM, Michał Górny wrote:
5 > On Sat, 19 Dec 2015 23:51:47 +0100 Ulrich Mueller <ulm@g.o>
6 > wrote:
7 >
8 >>>>>>> On Sat, 19 Dec 2015, Michał Górny wrote:
9 >>
10 >>>> (I guess it is encountering EOF on the temporary file created
11 >>>> by the string redirection, but how would one distinguish this
12 >>>> from other errors?)
13 >>
14 >>> read's return code indicates whether if found a full line (with
15 >>> a newline). read can't really fail.
16 >>
17 >> Certainly writing or reading the temp file can fail?
18 >>
19 >>>> Besides, it is hard to understand what this code does, as
20 >>>> compared to the "set -f" solution.
21 >>
22 >>> Many pieces of good code are harder to understand than cheap,
23 >>> ugly hacks. That's why those hacks are so common, and people
24 >>> meet them all the time and never learn good code.
25 >>
26 >> Well, compare:
27 >>
28 >> set -f echo -e ${DOC_CONTENTS} | ...
29 >>
30 >> versus:
31 >>
32 >> read -d '' -r -a DOC_CONTENTS <<<"${DOC_CONTENTS}" echo -e
33 >> "${DOC_CONTENTS[*]}" | ...
34 >>
35 >> The second one is (IMHO) harder to understand, less efficient,
36 >> and relies on undocumented behaviour.
37 >
38 > On WHAT?!
39 >
40
41 Apparently, bash(1) and bash.info don't document what it means to pass
42 an empty string as the argument to the -d option of the read builtin
43 (what actually happens is that in all cases, bash uses the first
44 character of the C string that the option gets translated to, which is
45 '\0' for the empty string; the documentation just refers to "the first
46 character of the string passed").
47
48 - --
49 Jonathan
50 -----BEGIN PGP SIGNATURE-----
51 Version: GnuPG v2
52
53 iQIcBAEBCgAGBQJWdeydAAoJEEIQbvYRB3mgnQ4P+gP6WHxcyb6PZaBo8EG3nj/i
54 I5mbIs4XSsp4G13SVm54nTQelPzDlDLtMsRqdAj5Oh+oXrCyLLFcUKSpUf/1laNG
55 z7pzY6FStgFm1MZWAajtw16xr1+tAbkmGbGy/6pYvSVu7yNiI1n/P+2tBij6e6rN
56 cOeLtqRGfb1M0Ew3Py2qKVmWYf+/YxH6AkwFZGBZRcb+q3lCSZ9Ycbk3GRBStZwG
57 wi3PAf6nnuEaouuk7GA33Fi35cmHs8MISVIC70ULakOTu51xHm7aVJCzZQQIFl9N
58 WvH04+IMCcX+BleU6mP4LK0NB647WwKR8JWgcl8qj2415RvvImCtE35bhnpJbf92
59 PcVP1l4NJzbUUyfXMDZBpvxzXMHTz2DA4b9PS5Mq8jhiA1jKqAWFD5BBG05SHyrA
60 IpD0CKipLUFsXyJ5z/MS0gmUFFwymhB+dBVtKOqa4a4s40H2qahY3ffyn/MzIx52
61 imAYb7IK4MqCPQrzr9nM7qf7UApyLEaQDjN5n+bJ4ZEEd+p3kdf2sVrAFdTom0SU
62 hXmF1+7TCW4pVB6kL35YbtJkKQbHPfXTHVAJ/ctsLMMNNzXSiKUdnlCV+CwWfrgC
63 ptMy/Rk7WoHssyQZgl83JsQBdz396j0M6M3+kUNSGFThCz3OF9YBAccrKy7gqeHr
64 cyg+QQQN4yNyFaWl7S9a
65 =5O6Z
66 -----END PGP SIGNATURE-----

Replies