[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#153948: Need help with afio on powerpc



Here is a new patch to address the compile-time issues
of afio.   It supersedes the earlier patch I provided, and
should be applied to 2.4.7-2.

I hope that I'm providing these patches right. I'm producing
them with diff -ur .



diff -u afio-2.4.7-old/Makefile afio-2.4.7/Makefile
--- afio-2.4.7-old/Makefile	Wed Jul 24 16:57:44 2002
+++ afio-2.4.7/Makefile	Wed Jul 24 15:48:12 2002
@@ -58,7 +58,7 @@
 #CFLAGS1 = -Wall -s -g -O2 -fomit-frame-pointer
 #CFLAGS1 = -Wall -O2 -fomit-frame-pointer
 # edd 14 Mar 2002  added -D_FILE_OFFSET_BITS=64 and -D_LARGEFILE_SOURCE
-CFLAGS1 = -W -s -g -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CFLAGS1 = -Wall -s -g -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 
 
 CC=gcc
diff -u afio-2.4.7-old/afio.c afio-2.4.7/afio.c
--- afio-2.4.7-old/afio.c	Wed Oct 10 02:03:53 2001
+++ afio-2.4.7/afio.c	Wed Jul 24 16:56:08 2002
@@ -1138,14 +1138,7 @@
   if (inread (header, H_STRLEN) < 0)
     return (warnarch ("Corrupt ASCII header", (off_t) H_STRLEN));
   header[H_STRLEN] = '\0';
-#if 0
-  if (sscanf (header, H_SCAN, &asb->sb_dev,
-	      &asb->sb_ino, &asb->sb_mode, &asb->sb_uid,
-	      &asb->sb_gid, &asb->sb_nlink, &asb->sb_rdev,
-	      &asb->sb_mtime, &namelen, &asb->sb_size) != H_COUNT)
-    return (warnarch ("Bad ASCII header", (off_t) H_STRLEN));
-#else
-  /* this should be much more portable than the one above */
+
   if (sscanf (header, PH_SCAN, &pasb.PSt_dev,
              &pasb.PSt_ino, &pasb.PSt_mode, &pasb.PSt_uid,
              &pasb.PSt_gid, &pasb.PSt_nlink, &pasb.PSt_rdev,
@@ -1161,7 +1154,6 @@
   asb->sb_rdev = pasb.PSt_rdev;
   asb->sb_mtime = pasb.PSt_mtime;
   asb->sb_size = pasb.PSt_size;
-#endif
   if (namelen == 0 || namelen >= PATHSIZE)
     return (warnarch ("Bad ASCII pathname length", (off_t) H_STRLEN));
   if (inread (name, namelen) < 0)
@@ -1550,7 +1542,7 @@
      char *name;
      reg Stat *asb;
 {
-  reg Link *linkp;
+  reg Link *linkp=NULL;
   reg int ifd;
   auto int compression;
 
@@ -1599,16 +1591,18 @@
   bufend = bufidx = buffer;
   if (!failed)
     {
-      if (areof)
-	if (total == 0)
+      if (areof) {
+	if (total == 0) {
 	  fatal (arspec, "No input");
-	else
+	} else
 	{
-	    if((aruntil!=0) || askfornext)
+	    if((aruntil!=0) || askfornext) {
 		next (O_RDONLY, "Input EOF");
-	    else
+	    } else {
 		fatal (arspec, "Premature input EOF");	    
+	    }
 	}
+      }
 #if 0
     fprintf(stderr,"aruntil=%Ld arleft=%Ld arbsize=%d\n",aruntil,arleft,arbsize);
 #endif
@@ -1721,12 +1715,15 @@
       asb->sb_size = 0;
     }
 #endif /* S_IFLNK */
-  if ((name[0] == '/') && !abspaths)
-    if (name[1])
+  if ((name[0] == '/') && !abspaths) {
+    if (name[1]) {
       while ((name[0] = name[1]))
 	++name;
-    else
+    } else {
       name[0] = '.';
+    }
+  }
+
   asb->sb_atime = asb->sb_ctime = asb->sb_mtime;
   return (0);
 }
@@ -2854,12 +2851,12 @@
     }
   else
     namedot = NULL;		/* not uncompressing */
-  if ((exists = (LSTAT (name, &osb) == 0)))
+  if ((exists = (LSTAT (name, &osb) == 0))) {
     /* The asb.sb_ino here has not been truncated to 16 bits, so the check is
        safe and may even add some protection. */
     if (ispass
 	&& osb.sb_ino == asb->sb_ino
-	&& osb.sb_dev == asb->sb_dev)
+	&& osb.sb_dev == asb->sb_dev) 
       return (warn (name, "Same file"));
     else if ((osb.sb_mode & S_IFMT) == (asb->sb_mode & S_IFMT))
       operm = osb.sb_mode & (xflag ? S_IPERM : S_IPOPN);
@@ -2867,6 +2864,7 @@
       return (warn (name, syserr ()));
     else
       exists = 0;
+  }
   if (linkp)
     {
       if (exists)
@@ -2914,7 +2912,7 @@
     case S_IFBLK:
     case S_IFCHR:
       fd = 0;
-      if (exists)
+      if (exists) {
 	if (asb->sb_rdev == osb.sb_rdev)
 	  if (perm != operm && chmod (name, perm) < 0)
 	    return (warn (name, syserr ()));
@@ -2928,6 +2926,8 @@
          and is encoded in dev and ino instead
          see out(). 
        */
+      }
+
       if(asb->sb_rdev==0) asb->sb_rdev=(asb->sb_dev << 16) + asb->sb_ino;
       if (mknod (name, asb->sb_mode, asb->sb_rdev) < 0
 	  && (errno != ENOENT
@@ -2977,7 +2977,7 @@
 #ifdef	S_IFLNK
     case S_IFLNK:
       fd = 0;
-      if (exists)
+      if (exists) {
 	if ((ssize = readlink (name, sname, sizeof (sname))) < 0)
 	  return (warn (name, syserr ()));
 	else if (strncmp (sname, asb->sb_link, ssize) == 0)
@@ -2986,6 +2986,7 @@
 	  return (warn (name, syserr ()));
 	else
 	  exists = 0;
+      }
       if (symlink (asb->sb_link, name) < 0
 	  && (errno != ENOENT
 	      || dirneed (name) < 0
@@ -2994,13 +2995,15 @@
       break;
 #endif /* S_IFLNK */
     case S_IFREG:
-      if (exists)
+      if (exists) {
 	if (nflag && osb.sb_mtime > asb->sb_mtime)
 	  return (warn_nocount (name, "Newer file exists"));
 	else if (unlink (name) < 0)
 	  return (warn (name, syserr ()));
 	else
 	  exists = 0;
+      }
+
       if ((fd = creat (name, perm)) < 0
 	  && (errno != ENOENT
 	      || dirneed (name) < 0
@@ -3059,7 +3062,7 @@
   if((asb->sb_mode & S_IFMT) != S_IFLNK)
     {
       if (xflag && (!exists || asb->sb_uid != osb.sb_uid
-		    || asb->sb_gid != osb.sb_gid))
+		    || asb->sb_gid != osb.sb_gid)) {
 	if (chown (name, uid == 0 ? ush (asb->sb_uid) : uid,
 		   ush (asb->sb_gid)))
 	  perror (name);
@@ -3067,6 +3070,7 @@
 	  if(perm&S_IPEXE)
 	    if(chmod (name, perm) < 0)
 	      return (warn (name, syserr ()));
+      }
     }
 
   if (linkp == NULL && asb->sb_nlink > 1)
@@ -3271,8 +3275,8 @@
 	    sb.sb_rdev=(dev_t)0; 
 	  }
 	
- 	if(extfmt) outhead2 (name, &sb); else outhead (name, &sb);
-	if (fd)
+ 	if(extfmt) { outhead2 (name, &sb); } else { outhead (name, &sb); }
+	if (fd) {
 	    if (fd==ZIPFD) 
 	    {
 		outdatazip(zipfdfd,name,sb.sb_size);
@@ -3284,6 +3288,7 @@
 	    }
 	    else
 		VOID close (outdata (fd, name, sb.sb_size));
+	}
 	
 	if (vflag)
 	{
@@ -3500,8 +3505,8 @@
   if ((pad = (total + M_STRLEN + H_STRLEN + namelen) % arpad))
     pad = arpad - pad;
   VOID strcpy (header, M_ASCII);
-  VOID sprintf (header + M_STRLEN, H_PRINT, 0, 0,
-		0, 0, 0, 1, 0, (time_t) 0, namelen, pad);
+  VOID sprintf (header + M_STRLEN, H_PRINT, 0, (unsigned long long)0,
+		0, 0, 0, 1, 0, (time_t) 0, namelen, (unsigned long long)pad);
   outwrite (header, M_STRLEN + H_STRLEN);
   outwrite (name, namelen);
   outpad (pad);
@@ -3556,15 +3561,16 @@
   reg uint namelen;
   auto char header[M_STRLEN + H_STRLEN + 1];
 
-  if ((name[0] == '/') && !abspaths)
+  if ((name[0] == '/') && !abspaths) {
     if (name[1])
       ++name;
     else
       name = ".";
+  }
   namelen = (uint) strlen (name) + 1;
   VOID strcpy (header, M_ASCII);
   VOID sprintf (header + M_STRLEN, H_PRINT, ush (asb->sb_dev),
-		ush (asb->sb_ino), ush (asb->sb_mode), ush (asb->sb_uid),
+		asb->sb_ino, ush (asb->sb_mode), ush (asb->sb_uid),
 		ush (asb->sb_gid), ush (asb->sb_nlink), ush (asb->sb_rdev),
 		mflag ? timenow : asb->sb_mtime, namelen, asb->sb_size);
   outwrite (header, M_STRLEN + H_STRLEN);
@@ -3588,17 +3594,18 @@
   reg uint namelen;
   auto char header[M_STRLEN + H_STRLEN2 + 1];
 
-  if ((name[0] == '/') && !abspaths)
+  if ((name[0] == '/') && !abspaths) {
     if (name[1])
       ++name;
     else
       name = ".";
+  }
   namelen = (uint) strlen (name) + 1;
   VOID strcpy (header, M_ASCII2);
-  VOID sprintf (header + M_STRLEN, H_PRINT2, ush (asb->sb_dev),
-		(asb->sb_ino), ush (asb->sb_mode), ush (asb->sb_uid),
+  VOID sprintf (header + M_STRLEN, H_PRINT2, ush(asb->sb_dev),
+	       asb->sb_ino, ush (asb->sb_mode), ush (asb->sb_uid),
 		ush (asb->sb_gid), ush (asb->sb_nlink), ush (asb->sb_rdev),
-		mflag ? timenow : asb->sb_mtime, namelen, asb->sb_size);
+		mflag ? timenow : asb->sb_mtime, namelen, (unsigned long long)asb->sb_size);
   outwrite (header, M_STRLEN + H_STRLEN2);
   outwrite (name, namelen);
 #ifdef	S_IFLNK
@@ -4079,7 +4086,7 @@
 		       major (asb->sb_rdev), minor (asb->sb_rdev));
 	  break;
 	case S_IFREG:
-	  VOID printf (" %8ld", asb->sb_size);
+	  VOID printf (" %8Ld", asb->sb_size);
 	  break;
 	default:
 	  VOID printf ("         ");
@@ -4121,11 +4128,12 @@
   if (vflag || lflag)
     {
       from=NULL;
-      if (asb->sb_nlink > 1)
+      if (asb->sb_nlink > 1) {
 	if ((from = linkfrom (asb,1)))
 	  VOID printf (" -> %s", from->l_path->p_name);
 	else
 	  VOID linkto (name, asb);
+      }
 	  
 #ifdef	S_IFLNK
       if (((asb->sb_mode & S_IFMT) == S_IFLNK)&&(from==NULL))
@@ -4301,11 +4309,13 @@
 #endif
   for (idx = 0; (pid = fork ()) < 0; ++idx)
     {
-      if (idx == sizeof (delay))
+      if (idx == sizeof (delay)) {
 	if (die)
 	  fatal (arspec, syserr ());
 	else
 	  return (-1);
+      }
+
       VOID warn_nocount (what, "Trouble forking...");
       if (Fflag && !die)	/* give up and go on... */
 	return (-1);
diff -u afio-2.4.7-old/afio.h afio-2.4.7/afio.h
--- afio-2.4.7-old/afio.h	Sat Oct  6 23:43:47 2001
+++ afio-2.4.7/afio.h	Wed Jul 24 16:54:48 2002
@@ -101,10 +101,8 @@
 #define	H_COUNT	10		/* Number of items in ASCII header */
 
 /* old ASCII format */
-#define	H_PRINT	"%06o%06o%06o%06o%06o%06o%06o%011lo%06o%011lo"
-/* H_SCAN is obsolete, replaced by PH_SCAN to be more portable. */
-#define	H_SCAN	"%6ho%6ho%6ho%6ho%6ho%6ho%6ho%11lo%6o%11lo"
-#define PH_SCAN  "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6o%11lo"
+#define	H_PRINT	"%06o%06Lo%06o%06o%06o%06o%06o%011lo%06o%011Lo"
+#define PH_SCAN  "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6o%11Lo"
 
 /*
 Below is a handy piece of ASCII art which can be used to decode old
@@ -118,8 +116,8 @@
 
 
 /* extended ASCII format */
-#define	H_PRINT2  "%06o%011lo%06o%06o%06o%06o%06o%011lo%06o%011lo"
-#define PH_SCAN2  "%6lo%11lo%6lo%6lo%6lo%6lo%6lo%11lo%6o%11lo"
+#define	H_PRINT2  "%06o%011Lo%06o%06o%06o%06o%06o%011lo%06o%011Lo"
+#define PH_SCAN2  "%6lo%11lo%6lo%6lo%6lo%6lo%6lo%11lo%6o%11Lo"
 
 
 typedef struct {
@@ -131,7 +129,7 @@
 long unsigned int PSt_nlink;
 long unsigned int PSt_rdev;
 long unsigned int PSt_mtime;
-long unsigned int PSt_size;
+unsigned long long PSt_size;
 } PStat;
 
 #define	H_STRLEN 70		/* old ASCII header string length */
Common subdirectories: afio-2.4.7-old/debian and afio-2.4.7/debian
Common subdirectories: afio-2.4.7-old/script1 and afio-2.4.7/script1
Common subdirectories: afio-2.4.7-old/script2 and afio-2.4.7/script2
Common subdirectories: afio-2.4.7-old/script3 and afio-2.4.7/script3
Common subdirectories: afio-2.4.7-old/script4 and afio-2.4.7/script4
Common subdirectories: afio-2.4.7-old/script5 and afio-2.4.7/script5


-- 
To UNSUBSCRIBE, email to debian-powerpc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: