Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: antarus@g.o
Subject: Re: [gentoo-dev] [PATCH 1/2] Introduce multibuild_merge_root() to merge interim installs.
Date: Sat, 23 Mar 2013 18:56:32
Message-Id: 20130323195702.59824135@pomiocik.lan
In Reply to: Re: [gentoo-dev] [PATCH 1/2] Introduce multibuild_merge_root() to merge interim installs. by Alec Warner
1 On Sat, 23 Mar 2013 10:44:59 -0700
2 Alec Warner <antarus@g.o> wrote:
3
4 > On Sat, Mar 23, 2013 at 9:26 AM, Michał Górny <mgorny@g.o> wrote:
5 > > + if [[ ${lock_fd} ]]; then
6 > > + # Close the lock file when we are done with it.
7 > > + # Prevents deadlock if we aren't in a subshell.
8 > > + eval "exec ${lock_fd}>&-"
9 >
10 > Not following this bit.
11 >
12 > The bash manpage says N>&DIGIT- redirects fd DIGIT to fd N. N may be
13 > unspecified and defaults to 1.
14 > It doesn't say what happens if DIGIT is unspecified.
15
16 Hm, that's interesting. It looks like they forgot to document it. I've
17 just tested it with bash-3.2 and it works as expected.
18
19 > Nor does it say it closes any file descriptors.
20
21 Well, if we assume that this fragment is correct, then it does:
22
23 DIGIT is closed after being duplicated to N.
24
25
26 There's also the following in bash-4.2 info page:
27
28 If >&- or <&- is preceded by {VARNAME}, the value of VARNAME defines
29 the file descriptor to close.
30
31 But IMO it's more like describing a specific case, rather than introducing
32 >&-.
33
34 --
35 Best regards,
36 Michał Górny

Attachments

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