Gentoo Archives: gentoo-dev

From: "Aaron W. Swenson" <titanofold@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: RFC: postgresql.eselect
Date: Wed, 30 Mar 2011 11:01:11
Message-Id: 4D930D45.30107@gentoo.org
In Reply to: Re: [gentoo-dev] Re: RFC: postgresql.eselect by Fabian Groffen
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 On 03/30/2011 03:58 AM, Fabian Groffen wrote:
5 > On 29-03-2011 22:35:48 -0600, Ryan Hill wrote:
6 >>> Because 'ls' would complain that files didn't exist, such as lib*.dylib
7 >>> when on a Linux system. It doesn't matter. But, using 'find' avoids this
8 >>> mess.
9 >>
10 >> Never use ls to get filenames in a script. Instead of
11 >>
12 >> for link_source in $(eval ls ${source_dir} 2> /dev/null) ; do
13 >>
14 >> just use
15 >>
16 >> for link_source in "${source_dir}"/* ; do
17 >>
18 >> I see you already fixed this one, but you do some funky stuff with ls -d
19 >> earlier on.
20 >
21 > Make sure though, when you use a glob, that you check for the asterisk.
22 >
23 > When there are no matches, bash assumes you meant the literal '*' and
24 > hence will return "/foo/bar/*" in link_source.
25 > So make sure you check the existence of whatever is in link_source
26 > before using it.
27 >
28 >
29 Yup, that's part of the reason why I changed to 'find' rather than 'ls'
30 there. 'find' will return a list matching the criteria, or it'll be
31 empty. Again, why I didn't use it earlier is beyond me. I think 'ls'
32 just worked for me and I moved on to getting other bits to work and
33 forgot about it.
34
35 As for the lib_dir(), I'm unsure if that's a good way to handle things.
36 Or, if it's really the best way, even though it's ugly. There's nothing
37 preventing me from making it a user configurable...it's just that at
38 some point I do need to determine the default bitness for the applications.
39
40 - - Aaron
41 -----BEGIN PGP SIGNATURE-----
42 Version: GnuPG v2.0.17 (GNU/Linux)
43 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
44
45 iF4EAREIAAYFAk2TDUQACgkQCOhwUhu5AEnnnAD/QPHQ2B3VUlFBQpCBg/8zdXDE
46 StAmxwYONYECac7ZZdYBAK0YW+JZYo4wez/U+OMNz6bMobNJrlC/e8TPgBQrHYd1
47 =ppf+
48 -----END PGP SIGNATURE-----

Replies

Subject Author
[gentoo-dev] Re: RFC: postgresql.eselect Ryan Hill <dirtyepic@g.o>