Hi,
I look for a FAQ related to portability issues and how to resolve them. I think of best practice solutions which may be applied to upstream, not just getting it work. The other reason for such a FAQ would be to get an idea about what has encoutered so far as being different.
I so far saw the following problems:
1. UID 0 / root
Several shell scripts test for being root as
$ test `id -u` -eq 0
One could replace 0 by 197108, but upstream would probably reject that :-)
For C programs I found to replace the literal 0 with a #define ROOTUID, but where should such a #define actually be defined? Is there a autoconf test/definition for it?
2. configure doesn't recognize ld's shared feature
I found this one: http://www.interopsystems.com/tools/tm.aspx?m=8556#8560
But is there a more general way, i.e. use newer autoconf? Which minimum version?
3. rename(2) issue
I just found that rename(2) behaves differently on linux/freebsd/win32 on the one hand and interix 3.5 on the other. Try:
$ cd /tmp
$ touch foo
$ mkdir bar
$ perl -e 'rename "foo", "foo" or die"' # is successful on all 4 platforms
$ perl -e 'rename "bar", "bar" or die"' # dies only on interix!
(For Win32, I used cmd.exe and ActivePerl.) One could argue that one is trying to move ./bar into ./bar/bar, and therefore the failing would be correct (because of moving a tree into its own subtree). But if src and dst are the same, then it is also argueable, that rename should be a no-op and interix is broken.
(not that much a question on how to patch, but more a documentation of the issue)
4. gnulib / missing obstack.{c,h}
Interix's libc has obviously differences to glibc. Missing functions such as strnlen or obstack can be found in gnulib. But how is the best way to merge the gnulib parts? Into every package? Or (just an idea) would it be possible to build a gnulib.so providing the missing functions in such a transparent way that configure and gcc wouldn't realize that libc misses it? One could say there might be packages which handle e.g. a missing strnlen itself, so using the gnulib version might not always be the right choice, however.
Martin
|