See attached patch. Tested to work fine with 0.1.28 and 0.1.29 on Linux (x86, amd64), Solaris (sparc, sparc64, x86, amd64), Darwin (x86, ppc) and FreeBSD (x86)
Created attachment 143902 [details, diff] the Solaris patch
by the way, there is just one warning that remains: i386-pc-solaris2.10-gcc -O3 -pipe -std=gnu99 main.c -o q In file included from include_applets.h:10, from main.c:1050: quse.c: In function ‘quse_main’: quse.c:348: warning: the address of ‘buf0’ will never be NULL >>> Source compiled.
Created attachment 146182 [details, diff] compat.diff If we can Let's not litter all over the place with #ifdef __sun__ Perhaps we can try to put as much as we can in compat files.. I'd really like to avoid having to prefix a (const char *) with (char *).. Perhaps we can define an alternative structs in compat.c/.h ? Attached is the incomplete idea.
Created attachment 161838 [details, diff] solaris patch when using gnulib I've had much success when using the missing GNU things from dev-libs/gnulib. So the solaris patch can be reduced to this one, when -Ignulib/include is in CFLAGS and libgnulib.a on LDFLAGS. Patch-Description what is still necessary: LDFLAGS must come after main.c on the linkline, or gnulib-symbols would be thrown away too early. The 'regex' symbol is still predefined and should be renamed. Haven't found <sys/dir.h> in gnulib. Works on aix too when using 'dirent' instead of 'direct'. Haven't found S_BLKSIZE in gnulib.
Created attachment 161842 [details, diff] patch for aix when using gnulib When using dev-libs/gnulib, for AIX only this patch is necessary. Still no S_BLKSIZE in gnulib. How wonder, AIX (5.3) understands _LINUX_SOURCE_COMPAT in its headers.
Uhm, just have seen on the solaris2.9 box here, that - unlike solaris2.10 - it does have neither scandir() nor alphasort() in libc (/usr/include/dirent.h). And gnulib does have neither scandir() nor alphasort() too. gnulib only provides opendir() and closedir(), while solaris2.9 has readdir(), opendir(), fdopendir(), telldir(), seekdir(), rewinddir(), closedir().
When attaching diffs please do so to the CVS version as I'm pretty sure we fixed solaris support already. cvs -d :pserver:anonymous@anoncvs.gentoo.org:/var/cvsroot co gentoo-projects/portage-utils
I recall we had a bug on it with Solaris 9. Our gnulib thing might solve #209237 as well. Seems I'm confused with pax-utils (bug #201131) on the Solaris 9 thing.
haubi, we shouldn't be using LDFLAGS for -lgnu, but LIBADD instead. Your reordering upsets --as-needed people.
@solar: in revision 1.155 of main.c you introduced a strnlen call. strnlen isn't posix, but a GNU addition.
(I'm on windows so can't attach a file, sorry) This patch removes the strnlen usage. In fact the strnlen was useless anyway, since the array was supposed to be NULL-terminated by the if-block. However, an off-by-one error was in there, possibly resulting in a buffer overflow write. Index: main.c =================================================================== RCS file: /var/cvsroot/gentoo-projects/portage-utils/main.c,v retrieving revision 1.155 diff -u -r1.155 main.c --- main.c 11 May 2008 17:25:00 -0000 1.155 +++ main.c 13 Sep 2008 15:50:21 -0000 @@ -482,14 +482,14 @@ strncat(portroot, "/", sizeof(portroot)); f = 0; - profilelen = readlink("/etc/make.profile", profile, sizeof(profile)); + profilelen = readlink("/etc/make.profile", profile, sizeof(profile) - 1); if (profilelen == -1) strcpy(profile, "/etc/make.profile"); else profile[profilelen]='\0'; if (profile[0] != '/') { - memmove(profile+5, profile, strnlen(profile, (size_t)profilelen)+1); + memmove(profile+5, profile, strlen(profile)+1); memcpy(profile, "/etc/", 5); } do {
The compiler isn't amused by the pointer mismatches (* vs ** I guess), but I don't see why one wouldn't use void * here in this case anyway. Index: qcache.c =================================================================== RCS file: /var/cvsroot/gentoo-projects/portage-utils/qcache.c,v retrieving revision 1.33 diff -u -r1.33 qcache.c --- qcache.c 15 Mar 2008 16:28:06 -0000 1.33 +++ qcache.c 13 Sep 2008 15:57:51 -0000 @@ -440,10 +440,10 @@ * 1 (OLDER) * 0 (SAME) */ -int qcache_vercmp(const void *x, const void *y); -int qcache_vercmp(const void *x, const void *y) +int qcache_vercmp(const struct dirent **x, const struct dirent **y); +int qcache_vercmp(const struct dirent **x, const struct dirent **y) { - switch (atom_compare_str((*((const struct dirent **)x))->d_name, (*((const struct dirent **)y))->d_name)) { + switch (atom_compare_str((*x)->d_name, (*y)->d_name)) { case NEWER: return -1; case OLDER: return 1; default: return 0;
This is the last patch that's required for compilation with gnulib on Solaris. @solar: if you agree with the patches I can commit them if you want. I'll try to do the aix patch "cleaner" later Index: libq/compat.c =================================================================== RCS file: /var/cvsroot/gentoo-projects/portage-utils/libq/compat.c,v retrieving revision 1.2 diff -u -r1.2 compat.c --- libq/compat.c 12 Apr 2008 17:25:59 -0000 1.2 +++ libq/compat.c 13 Sep 2008 15:59:42 -0000 @@ -8,18 +8,6 @@ #define S_BLKSIZE DK_DEVID_BLKSIZE -/* strcasestr is a GNU extention */ -static char* strcasestr(const char *big, const char *little) { - char* b = alloca((strlen(big) + 1) * sizeof(char)); - char* l = alloca((strlen(little) + 1) * sizeof(char)); - char* off; - size_t i; - for (i = 0; big[i]; i++) b[i] = (char)tolower(big[i]); - for (i = 0; little[i]; i++) l[i] = (char)tolower(little[i]); - off = strstr(b, l); - return(off == NULL ? off : (char*)(big + (off - b))); -} - #undef xasprintf #define xasprintf(strp, fmt, args...) \ do { /* xasprintf() */ \
Created attachment 165344 [details, diff] solaris patch when using gnulib against CVS Here's the patch as proper file. The longer I look at the code, the more I'd like to get rid of gnulib and GNU extensions and just make it POSIX compatible, though...
Just add yourself to the portage-utils@ alias and add the patches that fix other arches. I think you know our code well enough from this and pax-utils. "Just fix anything you break for others". Please test your compiles on a linux box as well as a uclibc chroot if you have one. Commit whatever you feel is required for the arches you want it supported on. And push a 0.1.30 when you are ready.
(In reply to comment #14) > solaris patch when using gnulib against CVS (sorry, I'm low on time recently, but...) Is the use of scandir/alphasort removed in CVS (not available on solaris2.9)? Because gnulib still does not provide them AFAICT.
I've started hacking the sources yesterday to make them POSIX compliant. scandir/alphasort are untouched though. Any idea how that has to be done for Solaris 8 and 9?
(In reply to comment #17) > I've started hacking the sources yesterday to make them POSIX compliant. > scandir/alphasort are untouched though. Any idea how that has to be done for > Solaris 8 and readdir() + malloc() + qsort()
afaict I committed all patches that we had, so that should render this bug fixed