[xrootd/epel7] Fix ix86, arm and ppc64 compilation

Mattias Ellert ellert at fedoraproject.org
Mon Jun 30 09:55:47 UTC 2014


commit 62b62a5675a4a4b8e5f960df296230a83041e02d
Author: Mattias Ellert <mattias.ellert at fysast.uu.se>
Date:   Mon Jun 30 11:54:44 2014 +0200

    Fix ix86, arm and ppc64 compilation

 xrootd-32bit.patch     |   21 ++++++++
 xrootd-narrowing.patch |   39 +++++++++++++++
 xrootd-range.patch     |  122 ++++++++++++++++++++++++++++++++++++++++++++++++
 xrootd.spec            |    9 ++++
 4 files changed, 191 insertions(+), 0 deletions(-)
---
diff --git a/xrootd-32bit.patch b/xrootd-32bit.patch
new file mode 100644
index 0000000..209b524
--- /dev/null
+++ b/xrootd-32bit.patch
@@ -0,0 +1,21 @@
+diff -ur xrootd-4.0.0.orig/src/XrdApps/XrdCpy.cc xrootd-4.0.0/src/XrdApps/XrdCpy.cc
+--- xrootd-4.0.0.orig/src/XrdApps/XrdCpy.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdApps/XrdCpy.cc	2014-06-30 06:44:13.917855929 +0200
+@@ -722,7 +722,7 @@
+   
+ char *genDestCgi(XrdClient *xrdsrc, const char *src)
+ {
+-   union {int *intP;
++   union {long long intP;
+           int  intV[2];
+          } iKey;
+    XrdClientStatInfo stat;
+@@ -749,7 +749,7 @@
+    gettimeofday(&abs_start_time,&tz);
+    myKey[0] = abs_start_time.tv_usec;
+    myKey[1] = getpid() | (getppid() << 16);
+-   iKey.intP = &myKey[0];
++   iKey.intP = (long long) &myKey[0];
+    myKey[2] = iKey.intV[0] ^ iKey.intV[1];
+    sprintf(tpcKey, "%08x%08x%08x", myKey[0], myKey[1], myKey[2]);
+ 
diff --git a/xrootd-narrowing.patch b/xrootd-narrowing.patch
new file mode 100644
index 0000000..1291958
--- /dev/null
+++ b/xrootd-narrowing.patch
@@ -0,0 +1,39 @@
+Endast i xrootd-4.0.0/src/XrdApps: XrdCpy.cc.orig
+diff -ur xrootd-4.0.0.orig/src/XrdCms/XrdCmsProtocol.cc xrootd-4.0.0/src/XrdCms/XrdCmsProtocol.cc
+--- xrootd-4.0.0.orig/src/XrdCms/XrdCmsProtocol.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdCms/XrdCmsProtocol.cc	2014-06-30 10:43:08.347990433 +0200
+@@ -994,7 +994,7 @@
+ 
+      if (Data.Request.streamid && (Data.Routing & XrdCmsRouting::Repliable))
+         {CmsResponse Resp = {{Data.Request.streamid, kYR_error, 0,
+-                              htons(sizeof(kXR_unt32)+n)},
++                              htons((unsigned short int)(sizeof(kXR_unt32)+n))},
+                              htonl(static_cast<unsigned int>(ecode))};
+          struct iovec ioV[2] = {{(char *)&Resp, sizeof(Resp)},
+                                 {(char *)etext, (size_t)n}};
+diff -ur xrootd-4.0.0.orig/src/XrdCms/XrdCmsTalk.cc xrootd-4.0.0/src/XrdCms/XrdCmsTalk.cc
+--- xrootd-4.0.0.orig/src/XrdCms/XrdCmsTalk.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdCms/XrdCmsTalk.cc	2014-06-30 09:58:49.006623716 +0200
+@@ -77,7 +77,7 @@
+ 
+    struct iovec Liov[xNum];
+    int mlen = strlen(msg)+1;
+-   CmsResponse LEResp={{0, kYR_error, 0, 0}, htonl(ecode)};
++   CmsResponse LEResp={{0, kYR_error, 0, 0}, htonl((unsigned int)ecode)};
+ 
+ // Fill out header and iovector
+ //
+diff -ur xrootd-4.0.0.orig/src/XrdXrootd/XrdXrootdProtocol.cc xrootd-4.0.0/src/XrdXrootd/XrdXrootdProtocol.cc
+--- xrootd-4.0.0.orig/src/XrdXrootd/XrdXrootdProtocol.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdXrootd/XrdXrootdProtocol.cc	2014-06-30 10:21:29.533773243 +0200
+@@ -243,8 +243,8 @@
+                 kXR_unt32 styp;   // Specified as kXR_int32 in doc!
+                } hsresp={0, 0, htonl(8), // isRedir == 'M' -> MetaManager
+                          htonl(kXR_PROTOCOLVERSION),
+-                         (isRedir ? htonl(kXR_LBalServer)
+-                                  : htonl(kXR_DataServer))};
++                         (isRedir ? htonl((unsigned int)kXR_LBalServer)
++                                  : htonl((unsigned int)kXR_DataServer))};
+ 
+ XrdXrootdProtocol *xp;
+ int dlen, rc;
diff --git a/xrootd-range.patch b/xrootd-range.patch
new file mode 100644
index 0000000..c85cf75
--- /dev/null
+++ b/xrootd-range.patch
@@ -0,0 +1,122 @@
+diff -ur xrootd-4.0.0.orig/src/XrdApps/XrdCpConfig.cc xrootd-4.0.0/src/XrdApps/XrdCpConfig.cc
+--- xrootd-4.0.0.orig/src/XrdApps/XrdCpConfig.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdApps/XrdCpConfig.cc	2014-06-30 08:19:41.704671233 +0200
+@@ -207,7 +207,7 @@
+ // Process legacy options first before atempting normal options
+ //
+ do{while(optind < Argc && Legacy(optind)) {}
+-   if ((opC = getopt_long(Argc, Argv, opLetters, opVec, &i)) >= 0)
++   if ((opC = getopt_long(Argc, Argv, opLetters, opVec, &i)) != (char)-1)
+       switch(opC)
+          {case OpCksum:    defCks(optarg);
+                            break;
+@@ -274,7 +274,7 @@
+           default:         UMSG("Internal error processing '" <<OpName() <<"'.");
+                            break;
+          }
+-  } while(opC >= 0 && optind < Argc);
++  } while(opC != (char)-1 && optind < Argc);
+ 
+ // Make sure we have the right number of files
+ //
+Endast i xrootd-4.0.0/src/XrdApps: XrdCpy.cc.orig
+diff -ur xrootd-4.0.0.orig/src/XrdApps/XrdMapCluster.cc xrootd-4.0.0/src/XrdApps/XrdMapCluster.cc
+--- xrootd-4.0.0.orig/src/XrdApps/XrdMapCluster.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdApps/XrdMapCluster.cc	2014-06-30 09:22:27.565173895 +0200
+@@ -487,7 +487,7 @@
+ //
+    opterr = 0;
+    optind = 1;
+-   while((opC = getopt_long(argc, argv, opLetters, opVec, &i)) >= 0)
++   while((opC = getopt_long(argc, argv, opLetters, opVec, &i)) != (char)-1)
+         switch(opC)
+               {case 'h': Usage(0);
+                          break;
+diff -ur xrootd-4.0.0.orig/src/XrdCns/XrdCnsConfig.cc xrootd-4.0.0/src/XrdCns/XrdCnsConfig.cc
+--- xrootd-4.0.0.orig/src/XrdCns/XrdCnsConfig.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdCns/XrdCnsConfig.cc	2014-06-30 09:00:55.099773364 +0200
+@@ -143,7 +143,7 @@
+ 
+ // Parse the options
+ //
+-   while((theOpt = Spec.getopt()) != -1) 
++   while((theOpt = Spec.getopt()) != (char)-1) 
+      {switch(theOpt)
+        {
+        case 'a': if (*aPath == '/') aPath = Spec.argval;
+diff -ur xrootd-4.0.0.orig/src/XrdCns/XrdCnsSsiCfg.cc xrootd-4.0.0/src/XrdCns/XrdCnsSsiCfg.cc
+--- xrootd-4.0.0.orig/src/XrdCns/XrdCnsSsiCfg.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdCns/XrdCnsSsiCfg.cc	2014-06-30 08:34:11.831591853 +0200
+@@ -107,7 +107,7 @@
+ 
+ // Parse the options
+ //
+-   while((theOpt = Spec.getopt()) != -1) 
++   while((theOpt = Spec.getopt()) != (char)-1) 
+      {switch(theOpt)
+        {
+        case 'h': Lopt |= Lhost;
+diff -ur xrootd-4.0.0.orig/src/XrdFrc/XrdFrcRequest.hh xrootd-4.0.0/src/XrdFrc/XrdFrcRequest.hh
+--- xrootd-4.0.0.orig/src/XrdFrc/XrdFrcRequest.hh	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdFrc/XrdFrcRequest.hh	2014-06-30 07:57:55.042165173 +0200
+@@ -50,6 +50,7 @@
+ char      Reserved2;
+ char      csType;       // Checksum type
+ char      OPc;          // Original Operation Request code (debugging)
++signed
+ char      Prty;         // Request priority
+ 
+ // Flags set in options
+diff -ur xrootd-4.0.0.orig/src/XrdFrm/XrdFrmAdmin.cc xrootd-4.0.0/src/XrdFrm/XrdFrmAdmin.cc
+--- xrootd-4.0.0.orig/src/XrdFrm/XrdFrmAdmin.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdFrm/XrdFrmAdmin.cc	2014-06-30 08:42:00.744792288 +0200
+@@ -864,7 +864,7 @@
+ 
+ // Now process all the options
+ //
+-   while((theOpt = Spec.getopt()) != -1)
++   while((theOpt = Spec.getopt()) != (char)-1)
+         {switch(theOpt)
+                {case 'A': Opt.All     = 1; break;
+                 case 'e': Opt.Erase   = 1; break;
+@@ -964,7 +964,7 @@
+ // Process username
+ //
+    if (Uname)
+-      {if (*Uname >= 0 && *Uname <= 9)
++      {if (*Uname >= '0' && *Uname <= '9')
+           {if (XrdOuca2x::a2i(Say,"uid",Uname, &Unum)) return 0;
+            Opt.Uid = Unum;
+           }
+@@ -977,7 +977,7 @@
+ // Process groupname
+ //
+    if (Gname)
+-      {if (*Gname >= 0 && *Gname <= 9)
++      {if (*Gname >= '0' && *Gname <= '9')
+           {if (XrdOuca2x::a2i(Say, "gid", Gname, &Gnum))  return 0;
+            Opt.Gid = Gnum;
+           }
+diff -ur xrootd-4.0.0.orig/src/XrdFrm/XrdFrmConfig.cc xrootd-4.0.0/src/XrdFrm/XrdFrmConfig.cc
+--- xrootd-4.0.0.orig/src/XrdFrm/XrdFrmConfig.cc	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdFrm/XrdFrmConfig.cc	2014-06-30 07:04:15.705177080 +0200
+@@ -257,7 +257,7 @@
+ //
+    opterr = 0; nextArg = 1;
+    while(nextArg < argc && '-' == *argv[nextArg]
+-         && (c=getopt(argc,argv,vOpts)) && (c != -1))
++         && (c=getopt(argc,argv,vOpts)) && (c != (char)-1))
+      { switch(c)
+        {
+        case 'b': optBG = 1;
+diff -ur xrootd-4.0.0.orig/src/XrdOuc/XrdOucCache.hh xrootd-4.0.0/src/XrdOuc/XrdOucCache.hh
+--- xrootd-4.0.0.orig/src/XrdOuc/XrdOucCache.hh	2014-06-04 18:31:15.000000000 +0200
++++ xrootd-4.0.0/src/XrdOuc/XrdOucCache.hh	2014-06-30 07:38:17.794877893 +0200
+@@ -280,6 +280,7 @@
+        int   prRecalc;  // Recalc pr efficiency every prRecalc bytes   (0->50M)
+        int   Reserve4;
+        short minPages;  // If rdln/pgsz < min,  preread minPages       (0->off)
++       signed
+        char  minPerf;   // Minimum auto preread performance required   (0->n/a)
+        char  Reserve1;
+ 
diff --git a/xrootd.spec b/xrootd.spec
index af83796..1a702a7 100644
--- a/xrootd.spec
+++ b/xrootd.spec
@@ -10,6 +10,12 @@ Group:		System Environment/Daemons
 License:	LGPLv3+
 URL:		http://xrootd.org/
 Source0:	http://xrootd.org/download/v%{version}/%{name}-%{version}.tar.gz
+#		Fix for uninitialized varible on 32 bit systems
+Patch0:		%{name}-32bit.patch
+#		Fix for unsigned char
+Patch1:		%{name}-range.patch
+#		Fix for big endian
+Patch2:		%{name}-narrowing.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:	cmake
@@ -171,6 +177,9 @@ This package contains the API documentation of the xrootd libraries.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %if %{?fedora}%{!?fedora:0} <= 9 && %{?rhel}%{!?rhel:0} <= 5
 # Older versions of SELinux does not have policy for open


More information about the scm-commits mailing list