Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: slong@××××××××××××××××××.uk
Subject: Re: [gentoo-dev] Re: [PATCH eutils] Move remove_libtool_files() from autotools-utils for wider use.
Date: Wed, 30 May 2012 17:16:00
Message-Id: 20120530191615.1f84d791@pomiocik.lan
In Reply to: [gentoo-dev] Re: [PATCH eutils] Move remove_libtool_files() from autotools-utils for wider use. by Steven J Long
1 On Tue, 29 May 2012 14:50:19 +0100
2 Steven J Long <slong@××××××××××××××××××.uk> wrote:
3
4 > Michał Górny wrote:
5 >
6 > > + find "${D}" -type f -name '*.la' -print0 | while read -r -d ''
7 > > f;
8 > ..
9 > > + rm -f "${f}" || die
10 > ..
11 > > + done
12 >
13 > Don't pipe to read like that; it means the final command is in a
14 > subshell and "die is /not/ guaranteed to work correctly if called
15 > from a subshell environment."[1]
16
17 Didn't we actually change that in the past? I think I'm recalling
18 something like that...
19
20 > More seriously, the script doesn't actually get the correct
21 > filenames, despite being written to handle any filename.
22 > eg:
23 > $ touch $' foo bar \n\t '
24 > $ while read -r -d '' f; do echo "'$f'"; done < <(find . -type f
25 > -print0) './ foo bar'
26 >
27 > You do it like this:
28 >
29 > while read -rd ''; do
30 > f=$REPLY;
31 > ..
32 > done < <(find "$D" -type f -name '*.la' -print0)
33
34 Thanks.
35
36 --
37 Best regards,
38 Michał Górny

Attachments

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