Debian Codegraph @

extension/README.fts

raw
1 Wed Aug 29 22:34:24 IDT 2012
2 ============================
3
4 Portability is a myth, a chimera. Like the pot of gold at the end of
5 the rainbow, it's always looks like it is just within your reach, but
6 in fact, it is seldom, if ever, truly acheivable.
7
8 It all started when trying to get the extensions to work on my aged
9 PowerPC Macbook G4 running Mac OS X 10.5. That machine is wonderful,
10 since it is neither an Intel architecture machine nor is it GNU/Linux;
11 two criteria that are becoming increasingly harder to meet over 10%
12 into the 21st century.
13
14 The readdir extension didn't work. Furthermore, GDB showed that in gawk
15 itself, struct stat had one size and layout, while inside the readdir
16 code, it had another.
17
18 This turned out to be due to the large file nonsense foisted off upon
19 us by POSIX. The main gawk configure.ac had AC_SYS_LARGEFILE but the
20 extensions' configure.ac did not. OK - a one line fix, rebuild, and
21 everything is OK. Right?
22
23 Of course not.
24
25 Everything was OK on my 64-bit GNU/Linux Intel system, but lo and behold,
26 I compiled on a 32-bit GNU/Linux system and suddenly the fts tests
27 stopped working. A look at the config.log reveals:
28
29 <fts.h> cannot be used with -D_FILE_OFFSET_BITS==64
30
31 Why? Who knows. The comment in the file itself is cryptic:
32
33 /* The fts interface is incompatible with the LFS interface which
34 transparently uses the 64-bit file access functions. */
35 #ifdef __USE_FILE_OFFSET64
36 # error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
37 #endif
38
39 It purports to be English, but says nothing intelligible, and the man
40 page sheds no light, either.
41
42 Fortunately, the source for fts from NetBSD is reasonably legible,
43 freely available, and has a usable license.
44
45 So, I try to just plug it in directly. Everything compiles, nothing
46 works. There is shared library / weird linker dark voodoo crap going on.
47
48 *I* am not a powerful enough Jedi to get around it, and I think it has
49 more to do with the Dark Side of the Force than with the Light Side. So
50 gawkfts.h now has:
51
52 #define fts_children gawk_fts_children
53 #define fts_close gawk_fts_close
54 #define fts_open gawk_fts_open
55 #define fts_read gawk_fts_read
56 #define fts_set gawk_fts_set
57
58 to rename things, and it all compiles and works.
59
60 The Plan 9 guys got it right when they threw eveything out and started
61 over again. I sure wish I could.
62
63 On the bright side, this is stuff that would have had to be done anyway
64 for at least MinGW, and maybe for some other systems. So it's not wasted
65 effort. But it sure is sad that it's necessary.
66
67 Arnold Robbins
68 [email protected]