Bug 39059 - patch to compile apr-1.2.2 on SkyOS
Summary: patch to compile apr-1.2.2 on SkyOS
Status: RESOLVED INVALID
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: 1.2.2
Hardware: Other other
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL: http://www.skyos.org
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-22 12:47 UTC by Peter Speybrouck
Modified: 2006-08-07 07:05 UTC (History)
0 users



Attachments
patch for apr_strings (5.01 KB, patch)
2006-03-22 12:49 UTC, Peter Speybrouck
Details | Diff
patch for apr_strings (5.01 KB, patch)
2006-03-22 12:55 UTC, Peter Speybrouck
Details | Diff
patch for file_io/unix/pipe.ce (1.91 KB, patch)
2006-03-22 12:57 UTC, Peter Speybrouck
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Speybrouck 2006-03-22 12:47:54 UTC
These are patches to be able to compile apr on SkyOS.
The modifications are done with #ifdef SKYOS to prevent breaking the other
platforms.

Needed modification: 
* mkfifo is not available in SkyOS so I needed to work around this.
* switched the order of 2 includes to solve undefined struct iovec
* removed a function definition, although this should not generate errors in
normal conditions. However there might be a compiler issue, so this is the
current solution.


pipe.c.patch: file_io/unix/pipe.c
=================== cut here ==============
Index: file_io/unix/pipe.c
===================================================================
--- file_io/unix/pipe.c	(revision 79)
+++ file_io/unix/pipe.c	(working copy)
@@ -45,7 +45,7 @@
       fd_flags &= ~O_NDELAY;
 #  elif defined(O_FNDELAY)
       fd_flags &= ~O_FNDELAY;
-#  else 
+#  else
       /* XXXX: this breaks things, but an alternative isn't obvious...*/
       return APR_ENOTIMPL;
 #  endif
@@ -61,8 +61,8 @@
       }
 #  else /* "classic" BeOS doesn't support this at all */
       return APR_ENOTIMPL;
-#  endif 
- 
+#  endif
+
 #endif /* !BEOS_BLOCKING */
 
     thepipe->blocking = BLK_ON;
@@ -87,7 +87,7 @@
       if (fcntl(thepipe->filedes, F_SETFL, fd_flags) == -1) {
           return errno;
       }
-    
+
 #else /* BEOS_BLOCKING */
 
 #  if BEOS_BONE /* This only works on BONE 0-6 */
@@ -139,7 +139,7 @@
                                              apr_pool_t *pool)
 {
     int *dafile = thefile;
-    
+
     (*file) = apr_pcalloc(pool, sizeof(apr_file_t));
     (*file)->pool = pool;
     (*file)->eof_hit = 0;
@@ -183,7 +183,7 @@
     if (pipe(filedes) == -1) {
         return errno;
     }
-    
+
     (*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
     (*in)->pool = pool;
     (*in)->filedes = filedes[0];
@@ -222,7 +222,15 @@
     return APR_SUCCESS;
 }
 
-APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, 
+#ifdef SKYOS
+/* patch for SkyOS to fix unsupported mkfifo, added by Peter Speybrouck,
3/3/2006 */
+int mkfifo(const char *filename,int mode){
+	printd("apr: file_io/unix/pipe.c:230: mkfifo not supported/implemented");
+	return -1;
+}
+#endif
+
+APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename,
                                                     apr_fileperms_t perm,
apr_pool_t *pool)
 {
     mode_t mode = apr_unix_perms2mode(perm);
@@ -231,7 +239,7 @@
         return errno;
     }
     return APR_SUCCESS;
-} 
+}
 
-    
 
+

=================== cut here ==============


apr_strings.patch:
=================== cut here ==============
Index: include/apr_strings.h
===================================================================
--- include/apr_strings.h	(revision 80)
+++ include/apr_strings.h	(working copy)
@@ -61,7 +61,7 @@
 
 /**
  * @defgroup apr_strings String routines
- * @ingroup APR 
+ * @ingroup APR
  * @{
  */
 
@@ -76,7 +76,7 @@
 APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b);
 
 /**
- * Do a natural order comparison of two strings ignoring the case of the 
+ * Do a natural order comparison of two strings ignoring the case of the
  * strings.
  * @param a The first string to compare
  * @param b The second string to compare
@@ -109,7 +109,7 @@
 APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n);
 
 /**
- * duplicate the first n characters of a string into memory allocated 
+ * duplicate the first n characters of a string into memory allocated
  * out of a pool; the new string will be null-terminated
  * @param p The pool to allocate out of
  * @param s The string to duplicate
@@ -144,11 +144,12 @@
  * @param nbytes (output) strlen of new string (pass in NULL to omit)
  * @return The new string
  */
+#ifndef SKYOS
 APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
                                  apr_size_t nvec, apr_size_t *nbytes);
-
+#endif
 /**
- * printf-style style printing routine.  The data is output to a string 
+ * printf-style style printing routine.  The data is output to a string
  * allocated from a pool
  * @param p The pool to allocate out of
  * @param fmt The format of the string
@@ -158,7 +159,7 @@
 APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
 
 /**
- * printf-style style printing routine.  The data is output to a string 
+ * printf-style style printing routine.  The data is output to a string
  * allocated from a pool
  * @param p The pool to allocate out of
  * @param fmt The format of the string
@@ -183,10 +184,10 @@
  * <PRE>
  * Note the differences between this function and strncpy():
  *  1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
- *  2) strncpy() pads the destination string with NULs, which is often 
+ *  2) strncpy() pads the destination string with NULs, which is often
  *     unnecessary; apr_cpystrn() does not.
  *  3) strncpy() returns a pointer to the beginning of the dst string;
- *     apr_cpystrn() returns a pointer to the NUL terminator of dst, 
+ *     apr_cpystrn() returns a pointer to the NUL terminator of dst,
  *     to allow a check for truncation.
  * </PRE>
  */
@@ -203,7 +204,7 @@
 APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src);
 
 /**
- * Convert the arguments to a program from one string to an array of 
+ * Convert the arguments to a program from one string to an array of
  * strings terminated by a NULL pointer
  * @param arg_str The arguments to convert
  * @param argv_out Output location.  This is a pointer to an array of strings.
@@ -214,7 +215,7 @@
                                                apr_pool_t *token_context);
 
 /**
- * Split a string into separate null-terminated tokens.  The tokens are 
+ * Split a string into separate null-terminated tokens.  The tokens are
  * delimited in the string by one or more characters from the sep
  * argument.
  * @param str The string to separate; this should be specified on the
@@ -310,7 +311,7 @@
  *   digits are prefixed with '0x', in which case it will be treated as
  *   base 16.
  */
-APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf, 
+APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf,
                                       char **end, int base);
 
 /**
Index: strings/apr_strings.c
===================================================================
--- strings/apr_strings.c	(revision 82)
+++ strings/apr_strings.c	(working copy)
@@ -47,9 +47,14 @@
  */
 
 #include "apr.h"
+#ifdef SKYOS
+#include "apr_private.h"
 #include "apr_strings.h"
+#else
+#include "apr_strings.h"
+#include "apr_private.h"
+#endif
 #include "apr_general.h"
-#include "apr_private.h"
 #include "apr_lib.h"
 #define APR_WANT_STDIO
 #define APR_WANT_STRFUNC
@@ -161,7 +166,7 @@
         else {
             len = strlen(argp);
         }
- 
+
         memcpy(cp, argp, len);
         cp += len;
     }
@@ -197,7 +202,7 @@
 
     /* Allocate the required string */
     res = (char *) apr_palloc(a, len + 1);
-    
+
     /* Pass two --- copy the argument strings into the result space */
     src = vec;
     dst = res;
@@ -292,7 +297,7 @@
      * in both the mult and add/sub operation.  Unlike the bsd impl,
      * we also work strictly in a signed int64 word as we haven't
      * implemented the unsigned type in win32.
-     * 
+     *
      * Set 'any' if any `digits' consumed; make it negative to indicate
      * overflow.
      */
@@ -319,7 +324,7 @@
 	else if (c >= 's' && c <= 'z')
 	    c -= 'z' - 28;
 #else
-#error "CANNOT COMPILE apr_strtoi64(), only ASCII and EBCDIC supported" 
+#error "CANNOT COMPILE apr_strtoi64(), only ASCII and EBCDIC supported"
 #endif
 	else
 	    break;

=================== cut here ==============
Comment 1 Peter Speybrouck 2006-03-22 12:49:31 UTC
Created attachment 17939 [details]
patch for apr_strings
Comment 2 Peter Speybrouck 2006-03-22 12:55:31 UTC
Created attachment 17940 [details]
patch for apr_strings
Comment 3 Peter Speybrouck 2006-03-22 12:57:39 UTC
Created attachment 17941 [details]
patch for file_io/unix/pipe.ce
Comment 4 Garrett Rooney 2006-03-22 19:00:03 UTC
Like 98% of those patches are bogus whitespace changes that are just obfuscating
things and making it difficult to see what's actually being changed.  Could you
please repost with just the actual changes needed to make things work?

On top of that, the part replacing mkfifo seems quite wrong to me.  If mkfifo
doesn't exist we should detect that somehow and not use it, not replace it with
a printf that says it's not there, that can't possibly do what the user expected
when they called that function.
Comment 5 Max Bowsher 2006-04-03 00:07:20 UTC
Marking NEEDINFO.

Peter, please supply new patches which:

* Do not contain spurious whitespace changes. This is very important, as it
makes things very hard to review when the effective changes are concealed in a
mass of irrelevancies.

* Use the method I described on IRC to deal with mkfifo. Ask for clarification
if what I said is not sufficiently detailed for you:

[08/03/2006 15:37] <maxb> Darknesss: add an autoconf test (if you know autoconf)
checking for the function, and then use #ifndef HAVE_MKFIFO return APR_ENOTIMPL;
#endif in pipe.c
[08/03/2006 15:37] <Darknesss> I don't know autoconf...
[08/03/2006 15:39] <maxb> Just adding the following line somewhere in
configure.in, and rerunning ./buildconf, should work:
[08/03/2006 15:39] <maxb> AC_CHECK_FUNCS(mkfifo)
[08/03/2006 15:42] <Darknesss> ok, but what will be the result?
[08/03/2006 15:43] <Darknesss> will it just stop the script or leave out that code?
[08/03/2006 15:44] <chipig> leave out that code
[08/03/2006 15:44] <Darknesss> ok, sounds good :)

* Do not simply switch the order of includes, or remove the declaration of
apr_pstrcatv, since these changes are only concealing the underlying problems,
not solving them. If you would like help trying to diagnose the underlying
problems, then please post to dev@apr.a.o, or try to catch someone interested on
#apr.


Thanks,
Max.
Comment 6 Peter Speybrouck 2006-08-04 17:01:24 UTC
I have good news!

apr-1.2.7 compiles on skyos without having to patch the sources.

The patches attached here are no longer needed (and were bad anyway)
Comment 7 Joe Orton 2006-08-07 14:05:53 UTC
Marking this invalid in that case, there was a different PR for the actual bugs
which got fixed.