HP-UX fixes
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:55:31 +0000 (16:55 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:55:31 +0000 (16:55 +0000)
Author: jgg
Date: 1999-12-10 23:40:29 GMT
HP-UX fixes

13 files changed:
COMPILING [new file with mode: 0644]
apt-pkg/contrib/cdromutl.cc
apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/md5.cc
apt-pkg/contrib/system.h
apt-pkg/pkgcache.cc
apt-pkg/pkgcachegen.cc
buildlib/archtable
buildlib/sizetable
cmdline/indexcopy.cc
configure.in
methods/gzip.cc
methods/http.cc

diff --git a/COMPILING b/COMPILING
new file mode 100644 (file)
index 0000000..3ce7261
--- /dev/null
+++ b/COMPILING
@@ -0,0 +1,67 @@
+General Information
+~~~~~~~~~~~~~~~~~~~
+To compile this you need a couple things
+  - A working POSIX system with working POSIX gcc, g++, make (GNU),
+    ar, sh, awk and sed in the path
+  - GNU Make 3.74 or so, -- normal UNIX make will NOT work
+    * Note 3.77 is broken.    
+  - A working ANSI C++ compiler, this is not g++ 2.7.* 
+    g++ 2.8 works OK and newer egcs work well also. Nobody has tried it
+    on other compilers :< You will need a properly working STL as well.
+  - A C library with the usual POSIX functions and a BSD socket layer. 
+    If you OS conforms to the Single User Spec then you are fine:
+      http://www.opengroup.org/onlinepubs/7908799/index.html      
+
+Guidelines
+~~~~~~~~~~
+I am not interested in making 'ultra portable code'. I will accept patches
+to make the code that already exists conform more to SUS or POSIX, but
+I don't really care if your not-SUS OS doesn't work. It is simply too
+much work to maintain patches for dysfunctional OSs. I highly suggest you
+contact your vendor and express intrest in a conforming C library.
+
+That said, there are lots of finniky problems that must be delt with even
+between the supported OS's. Primarily the path I choose to take is to put
+a shim header file in build/include that transparently adds the required 
+functionality. Patches to make autoconf detect these cases and generate the 
+required shims are OK.
+
+Current shims:
+  * C9x integer types 'inttypes.h' 
+  * sys/statvfs.h to convert from BSD statfs to SUS statvfs  
+  * rfc2553 hostname resolution (methods/rfc*), shims to normal gethostbyname.
+  
+The only completely non-shimed OS is Linux with glibc2.1
+
+Platform Notes
+~~~~~~~~~~~~~~
+Debian GNU Linux 2.1 'slink'
+Debian GNU Linux 'potato'
+  * All Archs
+  - Works flawlessly
+  - You will want to have debiandoc-sgml and yodl installed to get
+    best results.
+  - No IPv6 Support in glibc's < 2.1
+
+Sun Solaris
+  SunOS cab101 5.7 Generic_106541-04 sun4u sparc
+  - Works fine
+  - Note, no IPv6 Support, OS lacks RFC 2553 hostname resolution
+   
+HP-UX
+  HP-UX nyquist B.10.20 C 9000/780 2016574337 32-user license
+  - Evil OS, does not conform very well to SUS
+     1) snprintf exists but is not prototyped, ignore spurios warnings
+     2) No socklen_t
+     3) Requires -D_XOPEN_SOURCE_EXTENDED for h_errno
+    Items 2 and 3 have to be fixed by hand. Insert this into
+    build/include/netdb.h:
+    
+    #define _XOPEN_SOURCE_EXTENDED
+    #define socklen_t size_t
+    #include_next <netdb.h>
+    
+    A similar techinque can be used for snprintf/vsprintf if you dislike 
+    the warnings
+  - Note, no IPv6 Support, OS lacks RFC 2553 hostname resolution
+    
index f703621..dae6f05 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: cdromutl.cc,v 1.10 1999/12/10 06:30:42 jgg Exp $
+// $Id: cdromutl.cc,v 1.11 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
    
    CDROM Utilities - Some functions to manipulate CDROM mounts.
@@ -170,7 +170,7 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
         struct stat Buf;
         if (stat(Dir->d_name,&Buf) != 0)
            continue;
-        sprintf(S,"%lu",Buf.st_mtime);
+        sprintf(S,"%lu",(unsigned long)Buf.st_mtime);
       }
       
       Hash.Add(S);
index 59d6aa5..7cd9482 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: fileutl.cc,v 1.32 1999/12/09 21:18:01 jgg Exp $
+// $Id: fileutl.cc,v 1.33 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
    
    File Utilities
@@ -25,8 +25,8 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/time.h>
+#include <sys/wait.h>
 #include <signal.h>
-#include <wait.h>
 #include <errno.h>
                                                                        /*}}}*/
 
index 11fe07e..1e2ab36 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: md5.cc,v 1.10 1999/11/16 03:10:56 jgg Exp $
+// $Id: md5.cc,v 1.11 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
    
    MD5Sum - MD5 Message Digest Algorithm.
 #include <apt-pkg/strutl.h>
 
 #include <string.h>
-#include <system.h>
 #include <unistd.h>
 #include <netinet/in.h>                          // For htonl
 #include <inttypes.h>
 #include <config.h>
+#include <system.h>
                                                                        /*}}}*/
 
 // byteSwap - Swap bytes in a buffer                                   /*{{{*/
index 325576d..7ec3d7f 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: system.h,v 1.2 1999/01/18 06:20:08 jgg Exp $
+// $Id: system.h,v 1.3 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
    
    System Header - Usefull private definitions
@@ -19,6 +19,7 @@
 #define        MAX_VAL(t)      (((t)(-1) > 0) ? (t)(-1) : (t)(((1L<<(sizeof(t)*8-1))-1)))
 
 // Min/Max functions
+#if !defined(MIN)
 #if defined(__HIGHC__)
 #define MIN(x,y) _min(x,y)
 #define MAX(x,y) _max(x,y)
@@ -36,6 +37,7 @@
 #define MIN(A,B) ((A) < (B)?(A):(B))
 #define MAX(A,B) ((A) > (B)?(A):(B))
 #endif
+#endif
 
 /* Bound functions, bound will return the value b within the limits a-c
    bounv will change b so that it is within the limits of a-c. */
index 5cf54b9..37a9c3a 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.cc,v 1.30 1999/12/05 05:37:45 jgg Exp $
+// $Id: pkgcache.cc,v 1.31 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
 #include <apt-pkg/version.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
-#include <system.h>
 
 #include <string>
 #include <sys/stat.h>
 #include <unistd.h>
+
+#include <system.h>
+
                                                                        /*}}}*/
 
 // Cache::Header::Header - Constructor                                 /*{{{*/
index 5aaba78..4033dc5 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcachegen.cc,v 1.42 1999/10/29 04:49:37 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.43 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/strutl.h>
-#include <system.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
+
+#include <system.h>
                                                                        /*}}}*/
 
 // CacheGenerator::pkgCacheGenerator - Constructor                     /*{{{*/
index 45149cd..55fab00 100644 (file)
@@ -29,3 +29,4 @@ armv4l  arm     arm
 powerpc        powerpc powerpc
 ppc    powerpc powerpc
 mipsel  mipsel  mipsel
+hppa1.1 hppa    hppa
index 54537a7..735f979 100644 (file)
@@ -16,3 +16,4 @@ sparc:  big     1 4 2 4
 m68k:   big     1 4 2 4
 powerpc: big    1 4 2 4
 mipsel: little  1 4 2 4
+hppa:   big     1 4 2 4
index 2585fc1..c8bbd75 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: indexcopy.cc,v 1.2 1999/09/03 05:46:48 jgg Exp $
+// $Id: indexcopy.cc,v 1.3 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
 
    Index Copying - Aid for copying and verifying the index files
@@ -23,7 +23,6 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <stdio.h>
-#include <wait.h>
                                                                        /*}}}*/
 
 // IndexCopy::CopyPackages - Copy the package files from the CD                /*{{{*/
@@ -103,11 +102,9 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List)
         }
         
         // Wait for gzip to finish
-        int Status;
-        if (waitpid(Process,&Status,0) != Process)
-           return _error->Errno("wait","Waiting for gzip failed");
-        if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
+        if (ExecWait(Process,_config->Find("Dir::bin::gzip","gzip").c_str(),false) == false)
            return _error->Error("gzip failed, perhaps the disk is full.");
+        
         Pkg.Seek(0);
       }
       pkgTagFile Parser(Pkg);
index beed253..c0ecdaa 100644 (file)
@@ -91,7 +91,7 @@ AC_DEFINE_UNQUOTED(ARCHITECTURE,"$archset")
 dnl We use C9x types if at all possible
 AC_CACHE_CHECK([for C9x integer types],c9x_ints,[
     AC_TRY_COMPILE([#include <inttypes.h>],
-                   [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;uint64_t Foo],
+                   [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
                   c9x_ints=yes,c9x_ints=no)])
 
 dnl Single Unix Spec statvfs
index f1bf60c..3372193 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: gzip.cc,v 1.8 1999/07/30 05:37:00 jgg Exp $
+// $Id: gzip.cc,v 1.9 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
 
    GZip method - Take a file URI in and decompress it into the target 
@@ -17,7 +17,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <utime.h>
-#include <wait.h>
 #include <stdio.h>
                                                                        /*}}}*/
 
@@ -73,19 +72,12 @@ bool GzipMethod::Fetch(FetchItem *Itm)
    From.Close();
    
    // Wait for gzip to finish
-   int Status;
-   if (waitpid(Process,&Status,0) != Process)
+   if (ExecWait(Process,_config->Find("Dir::bin::gzip","gzip").c_str(),false) == false)
    {
       To.OpFail();
-      return _error->Errno("wait","Waiting for gzip failed");
-   }    
-   
-   if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
-   {
-      To.OpFail();
-      return _error->Error("gzip failed, perhaps the disk is full or the directory permissions are wrong.");
-   }    
-   
+      return false;
+   }  
+       
    To.Close();
    
    // Transfer the modification times
index 536a23b..7a9a97a 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: http.cc,v 1.42 1999/12/10 08:53:43 jgg Exp $
+// $Id: http.cc,v 1.43 1999/12/10 23:40:29 jgg Exp $
 /* ######################################################################
 
    HTTP Aquire Method - This is the HTTP aquire method for APT.
@@ -635,7 +635,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
    if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
    {
       // In this case we send an if-range query with a range header
-      sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",SBuf.st_size - 1,
+      sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",(long)SBuf.st_size - 1,
              TimeRFC1123(SBuf.st_mtime).c_str());
       Req += Buf;
    }