1 |
On Monday 02 March 2009 08:24:35 Torsten Veller wrote: |
2 |
> > > find "${D}/${VENDOR_LIB}" -type f -a \( -name .packlist \ |
3 |
> > > -o \( -name '*.bs' -a -empty \) \) -delete |
4 |
> > > find "${D}/${VENDOR_LIB}" -depth -mindepth 1 -type d -empty -delete |
5 |
> > |
6 |
> > I'm curious how portable the find () construct is. Do you know? |
7 |
|
8 |
It was established well over a year ago that find in the ebuild environment |
9 |
must be GNU find. Using portable find is not worth the pain. |
10 |
|
11 |
[...] |
12 |
> > Could you just use dosed here? |
13 |
|
14 |
dosed needs to die. |
15 |
|
16 |
[...] |
17 |
> BTW: After I looked up the devmanual part about "find" above, I wonder: |
18 |
> | find "${S}" -type f | while read f ; do |
19 |
> | [...] |
20 |
> | for f in $(find "${S}" -type f) ; do |
21 |
> | [...] |
22 |
> | Warning |
23 |
> | In both cases, files with weird characters or spaces in their names may |
24 |
> | cause serious problems. |
25 |
|
26 |
The while loop breaks with leading or trailing spaces in the path. If the |
27 |
spaces are anywhere else in the path it works. The for loop breaks with spaces |
28 |
regardless of where they are. And you can of course come up with weird |
29 |
characters that break them both. |
30 |
|
31 |
If you really want to do better use: |
32 |
|
33 |
find "${S}" -print0 | while read -rd '' f; do |
34 |
if file "${f}" ... |
35 |
done |
36 |
|
37 |
You also really should provide proper die messages. |
38 |
|
39 |
-- |
40 |
Bo Andresen |