Package: shapetools
Version: 1.4pl6-14
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu hirsute ubuntu-patch

Hi,

shapetools currently FTBFS against glibc 2.32, which is used in the
development release of Ubuntu (and should be in Debian soon).

This is because it uses sys_errlist instead of strerror(), which is also
supported in earlier versions of glibc.

In Ubuntu, the attached patch was applied to achieve the following:

  * Use strerror() instead of sys_errlist to fix FTBFS with glibc 2.32.

Thanks for considering the patch.

Logan
diff -u shapetools-1.4pl6/src/atfs/aferror.c 
shapetools-1.4pl6/src/atfs/aferror.c
--- shapetools-1.4pl6/src/atfs/aferror.c
+++ shapetools-1.4pl6/src/atfs/aferror.c
@@ -272,7 +272,7 @@
 
   switch (af_errno) {
   case AF_ESYSERR:
-    sprintf (errMsg, "%s: %s", string, sys_errlist[errno]);
+    sprintf (errMsg, "%s: %s", string, strerror(errno));
     break;
   case AF_EMISC:
     sprintf (errMsg, "%s: %s", string, diagstr);
diff -u shapetools-1.4pl6/src/atfs/atfsrepair.c 
shapetools-1.4pl6/src/atfs/atfsrepair.c
--- shapetools-1.4pl6/src/atfs/atfsrepair.c
+++ shapetools-1.4pl6/src/atfs/atfsrepair.c
@@ -495,7 +495,7 @@
     lockInfo.l_pid = (pid_t)0;
     if (fcntl (fileno(inFile), F_GETLK, &lockInfo) == -1) {
       fprintf (stderr, "->   Error:\tCannot get lock info for %s -- fcntl 
failed (%s)!\n",
-              arFilename, sys_errlist[errno]);
+              arFilename, strerror(errno));
       fclose (inFile);
       cleanup ();
     }
@@ -525,7 +525,7 @@
     lockInfo.l_pid = (pid_t)0;
     if (fcntl (fileno(inFile), F_SETLK, &lockInfo) == -1) {
       fprintf (stderr, "->   Error:\tCannot unlock %s -- fcntl failed (%s)!\n",
-              arFilename, sys_errlist[errno]);
+              arFilename, strerror(errno));
       fclose (inFile);
       cleanup ();
     }
@@ -1437,7 +1437,7 @@
            if (modeConfirmed) {
              if (chmod (attrArPath, atfsIbuf.st_mode) == -1)
                fprintf (stderr, "Error:\tCannot change protection of '%s': 
%s\n",
-                        attrArPath, sys_errlist[errno]);
+                        attrArPath, strerror(errno));
            }
          }
          if (atfsIbuf.st_gid != subIbuf.st_gid) {
@@ -1454,7 +1454,7 @@
              if (chown (attrArPath, atfsIbuf.st_uid, atfsIbuf.st_gid) == -1)
                if (chown (attrArPath, geteuid(), atfsIbuf.st_gid) == -1) {
                  fprintf (stderr, "Error:\tCannot change Owner/Group of '%s': 
%s\n",
-                          attrArPath, sys_errlist[errno]);
+                          attrArPath, strerror(errno));
                }
          }
        }
diff -u shapetools-1.4pl6/src/atfs/cacheadm.c 
shapetools-1.4pl6/src/atfs/cacheadm.c
--- shapetools-1.4pl6/src/atfs/cacheadm.c
+++ shapetools-1.4pl6/src/atfs/cacheadm.c
@@ -132,7 +132,7 @@
        retCode += setCacheSize (argv[i+optind]);
       }
       else {
-       fprintf (stderr, "  Error -- %s: %s\n", argv[i+optind], 
sys_errlist[errno]);
+       fprintf (stderr, "  Error -- %s: %s\n", argv[i+optind], 
strerror(errno));
       }
     }
   }
diff -u shapetools-1.4pl6/src/shape/parser.h 
shapetools-1.4pl6/src/shape/parser.h
--- shapetools-1.4pl6/src/shape/parser.h
+++ shapetools-1.4pl6/src/shape/parser.h
@@ -39,5 +39,5 @@
 extern char *sys_errlist[] ;   /* ... these strings by myself */
 #endif
-#define fatal_perror(string)    fatal(sys_errlist[errno], string)
+#define fatal_perror(string)    fatal(strerror(errno), string)
 
 
diff -u shapetools-1.4pl6/src/vc/rcs2atfs/utils.c 
shapetools-1.4pl6/src/vc/rcs2atfs/utils.c
--- shapetools-1.4pl6/src/vc/rcs2atfs/utils.c
+++ shapetools-1.4pl6/src/vc/rcs2atfs/utils.c
@@ -387,16 +387,16 @@
        switch (errno) {
          case EACCES:
            if (! recursive) {
-               error(sys_errlist[errno], fname) ;
+               error(strerror(errno), fname) ;
            }
            return f_error ;
          case EFAULT:
-           fatal(sys_errlist[errno], MUSTNOT) ;
+           fatal(strerror(errno), MUSTNOT) ;
          case ENOENT:
            /* can be RCS working file without busy version */
            return f_plain ;
          default:
-           error(sys_errlist[errno], fname) ;
+           error(strerror(errno), fname) ;
        }
     }
 
only in patch2:
unchanged:
--- shapetools-1.4pl6.orig/src/vc/rcs2atfs/main.c
+++ shapetools-1.4pl6/src/vc/rcs2atfs/main.c
@@ -98,12 +98,12 @@
     if (use_pipe) {
        /* open pipe to Bourne Shell */
        if ((out = popen(BOURNE_SHELL, "w")) == NULL) {
-           fatal(POPEN_SHELL, sys_errlist[errno]) ;
+           fatal(POPEN_SHELL, strerror(errno)) ;
        }
     } else {
        /* open output file for script */
        if ((out = fopen(shellscript, "w")) == NULL) {
-           fatal(sys_errlist[errno], shellscript) ;
+           fatal(strerror(errno), shellscript) ;
        }
        /* insert some header into shell script (#!/bin/sh etc.) */
        fprintf(out, SCRIPT_HEADER, "rcs2atfs-1.9") ;
@@ -228,7 +228,7 @@
     basedir = strip_last(rdir) ; /* may be NULL */
     
     if ((dirp = opendir(rdir)) == NULL) {
-       warning(sys_errlist[errno], rdir) ;
+       warning(strerror(errno), rdir) ;
        free(rdir) ;
        return ;
     }

Reply via email to