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

Bug#156821: Patches for LSB 1.2 compliance



Package: libc6
Version: 2.2.5-10
Severity: normal
Tags: patch, woody, sarge, sid

Severity normal since most of these fix real bugs, even if you'd never
notice them normally.

First is that the LSB test suite requires a bunch of currencies that
the Euro obsoleted to be available.  

See Q2.3 in http://www.linuxbase.org/test/lsb-runtime-test-faq.html for
details and the explanation. The fix is to reinstate some of the currencies
removed in the glibc-cvs patchset:

--- glibc/glibc-2.2.5/debian/patches/glibc-cvs.dpatch	Fri Aug 16 04:09:15 2002
+++ glibc/glibc-2.2.5-lsb/debian/patches/glibc-cvs.dpatch	Thu Aug 15 00:46:23 2002
@@ -1433,30 +1433,16 @@
 diff -X .ignore -urN glibc-current/locale/iso-4217.def glibc-cvs/locale/iso-4217.def
 --- glibc-current/locale/iso-4217.def	Mon Dec 25 08:37:19 2000
 +++ glibc-cvs/locale/iso-4217.def	Sat Mar  2 16:23:05 2002
-@@ -6,40 +6,33 @@
-  *
-  * !!! The list has to be sorted !!!
-  */
--DEFINE_INT_CURR("ADP ")		/* Andorran Peseta  */
- DEFINE_INT_CURR("AED ")		/* United Arab Emirates Dirham  */
- DEFINE_INT_CURR("AFA ")		/* Afghanistan Afgani  */
+@@ -12,7 +12,7 @@
  DEFINE_INT_CURR("ALL ")		/* Albanian Lek  */
  DEFINE_INT_CURR("AMD ")		/* Armenia Dram  */
  DEFINE_INT_CURR("ANG ")		/* Netherlands Antilles  */
 -DEFINE_INT_CURR("AON ")		/* Angolan New Kwanza  */
 +DEFINE_INT_CURR("AOA ")		/* Angolan Kwanza  */
  DEFINE_INT_CURR("ARS ")		/* Argentine Peso  */
--DEFINE_INT_CURR("ATS ")		/* Austrian Schilling  */
+ DEFINE_INT_CURR("ATS ")		/* Austrian Schilling  */
  DEFINE_INT_CURR("AUD ")		/* Australian Dollar  */
- DEFINE_INT_CURR("AWG ")		/* Aruba Guilder  */
- DEFINE_INT_CURR("AZM ")		/* Azerbaijan Manat  */
- DEFINE_INT_CURR("BAK ")		/* Bosnian and Herzegovina Convertible Mark  */
- DEFINE_INT_CURR("BBD ")		/* Barbados Dollar  */
- DEFINE_INT_CURR("BDT ")		/* Bangladesh Taka  */
--DEFINE_INT_CURR("BEF ")		/* Belgian Franc  */
- DEFINE_INT_CURR("BGL ")		/* Bulgarian Lev  */
- DEFINE_INT_CURR("BHD ")		/* Bahraini Dinar  */
- DEFINE_INT_CURR("BIF ")		/* Burundi Franc  */
+@@ -28,18 +28,14 @@
  DEFINE_INT_CURR("BMD ")		/* Burmudian Dollar  */
  DEFINE_INT_CURR("BND ")		/* Brunei Dollar  */
  DEFINE_INT_CURR("BOB ")		/* Bolivian Boliviano  */
@@ -1476,12 +1462,7 @@
  DEFINE_INT_CURR("CHF ")		/* Swiss Franc (Liechtenstein)  */
  DEFINE_INT_CURR("CLP ")		/* Chilean Peso  */
  DEFINE_INT_CURR("CNY ")		/* China Yuan Renminbi  */
-@@ -49,33 +42,24 @@
- DEFINE_INT_CURR("CVE ")		/* Cape Verde Escudo  */
- DEFINE_INT_CURR("CYP ")		/* Cypriot Pound  */
- DEFINE_INT_CURR("CZK ")		/* Czech Koruna  */
--DEFINE_INT_CURR("DEM ")		/* German Mark  */
- DEFINE_INT_CURR("DJF ")		/* Djibouti Franc  */
+@@ -54,7 +50,6 @@
  DEFINE_INT_CURR("DKK ")		/* Danish Krone (Faroe Islands, Greenland)  */
  DEFINE_INT_CURR("DOP ")		/* Dominican Republic  */
  DEFINE_INT_CURR("DZD ")		/* Algerian Dinar  */
@@ -1489,50 +1470,27 @@
  DEFINE_INT_CURR("EEK ")		/* Estonian Kroon  */
  DEFINE_INT_CURR("EGP ")		/* Egyptian Pound  */
  DEFINE_INT_CURR("ERN ")		/* Eritrean Nakfa  */
--DEFINE_INT_CURR("ESP ")		/* Spanish Peseta  */
- DEFINE_INT_CURR("ETB ")		/* Ethiopian Birr  */
- DEFINE_INT_CURR("EUR ")		/* European Union Euro  */
--DEFINE_INT_CURR("FIM ")		/* Finnish Markka  */
- DEFINE_INT_CURR("FJD ")		/* Fiji Dollar  */
- DEFINE_INT_CURR("FKP ")		/* Falkland Islands Pound (Malvinas)  */
--DEFINE_INT_CURR("FRF ")		/* French Franc  */
- DEFINE_INT_CURR("GBP ")		/* British Pound  */
- DEFINE_INT_CURR("GEL ")		/* Georgia Lari  */
- DEFINE_INT_CURR("GHC ")		/* Ghana Cedi  */
+@@ -71,11 +66,8 @@
  DEFINE_INT_CURR("GIP ")		/* Gibraltar Pound  */
  DEFINE_INT_CURR("GMD ")		/* Gambian Dalasi  */
  DEFINE_INT_CURR("GNF ")		/* Guinea Franc  */
 -DEFINE_INT_CURR("GNS ")		/* Guinea Syli  */
 -DEFINE_INT_CURR("GQE ")		/* Equatorial Guinea Ekwele  */
--DEFINE_INT_CURR("GRD ")		/* Greek Drachma  */
+ DEFINE_INT_CURR("GRD ")		/* Greek Drachma  */
  DEFINE_INT_CURR("GTQ ")		/* Guatemala Quetzal  */
 -DEFINE_INT_CURR("GWP ")		/* Guinea-Bissau Peso  */
  DEFINE_INT_CURR("GYD ")		/* Guyana Dollar  */
  DEFINE_INT_CURR("HKD ")		/* Hong Kong Dollar  */
  DEFINE_INT_CURR("HNL ")		/* Honduras Lempira  */
-@@ -83,13 +67,12 @@
- DEFINE_INT_CURR("HTG ")		/* Haiti Gourde  */
- DEFINE_INT_CURR("HUF ")		/* Hungarian Forint  */
+@@ -85,6 +77,7 @@
  DEFINE_INT_CURR("IDR ")		/* Indonesia Rupiah  */
--DEFINE_INT_CURR("IEP ")		/* Irish Pound  */
+ DEFINE_INT_CURR("IEP ")		/* Irish Pound  */
  DEFINE_INT_CURR("ILS ")		/* Israeli Shekel  */
 +DEFINE_INT_CURR("IMP ")		/* Isle of Man Pounds  */
  DEFINE_INT_CURR("INR ")		/* Indian Rupee (Bhutan)  */
  DEFINE_INT_CURR("IQD ")		/* Iraqi Dinar  */
  DEFINE_INT_CURR("IRR ")		/* Iranian Rial  */
- DEFINE_INT_CURR("ISK ")		/* Iceland Krona  */
--DEFINE_INT_CURR("ITL ")		/* Italian Lira (San Marino, Vatican City)  */
- DEFINE_INT_CURR("JMD ")		/* Jamaican Dollar  */
- DEFINE_INT_CURR("JOD ")		/* Jordanian Dinar  */
- DEFINE_INT_CURR("JPY ")		/* Japanese Yen  */
-@@ -108,14 +91,12 @@
- DEFINE_INT_CURR("LRD ")		/* Liberian Dollar  */
- DEFINE_INT_CURR("LSL ")		/* Lesotho Maloti  */
- DEFINE_INT_CURR("LTL ")		/* Lithuanian Litas  */
--DEFINE_INT_CURR("LUF ")		/* Luxembourg Franc  */
- DEFINE_INT_CURR("LVL ")		/* Latvia Lat  */
- DEFINE_INT_CURR("LYD ")		/* Libyan Arab Jamahiriya Dinar  */
- DEFINE_INT_CURR("MAD ")		/* Moroccan Dirham  */
+@@ -115,7 +108,6 @@
  DEFINE_INT_CURR("MDL ")		/* Moldova Lei  */
  DEFINE_INT_CURR("MGF ")		/* Madagasy Franc  */
  DEFINE_INT_CURR("MKD ")		/* Macedonia Denar  */
@@ -1540,7 +1498,7 @@
  DEFINE_INT_CURR("MMK ")		/* Myanmar Kyat  */
  DEFINE_INT_CURR("MNT ")		/* Mongolia Tugrik  */
  DEFINE_INT_CURR("MOP ")		/* Macau Pataca  */
-@@ -130,7 +111,6 @@
+@@ -130,7 +122,6 @@
  DEFINE_INT_CURR("NAD ")		/* Namibia Dollar  */
  DEFINE_INT_CURR("NGN ")		/* Nigeria Naira  */
  DEFINE_INT_CURR("NIO ")		/* Nicaragua Cordoba Oro  */
@@ -1548,17 +1506,16 @@
  DEFINE_INT_CURR("NOK ")		/* Norwegian Krone  */
  DEFINE_INT_CURR("NPR ")		/* Nepalese Rupee  */
  DEFINE_INT_CURR("NZD ")		/* New Zealand Dollar  */
-@@ -140,8 +120,7 @@
+@@ -140,7 +131,7 @@
  DEFINE_INT_CURR("PGK ")		/* Papau New Guinea Kina  */
  DEFINE_INT_CURR("PHP ")		/* Philippines Peso  */
  DEFINE_INT_CURR("PKR ")		/* Pakistan Rupee  */
 -DEFINE_INT_CURR("PLZ ")		/* Polish Zloty  */
--DEFINE_INT_CURR("PTE ")		/* Portugese Escudo  */
 +DEFINE_INT_CURR("PLN ")		/* Polish Zloty  */
+ DEFINE_INT_CURR("PTE ")		/* Portugese Escudo  */
  DEFINE_INT_CURR("PYG ")		/* Paraguay Guarani  */
  DEFINE_INT_CURR("QAR ")		/* Qatar Rial  */
- DEFINE_INT_CURR("ROL ")		/* Romanian Leu  */
-@@ -150,7 +129,7 @@
+@@ -150,7 +141,7 @@
  DEFINE_INT_CURR("SAR ")		/* Saudi Arabia Riyal  */
  DEFINE_INT_CURR("SBD ")		/* Solomon Islands Dollar  */
  DEFINE_INT_CURR("SCR ")		/* Seychelles Rupee  */
@@ -1567,7 +1524,7 @@
  DEFINE_INT_CURR("SEK ")		/* Swedish Krona  */
  DEFINE_INT_CURR("SGD ")		/* Singapore Dollar  */
  DEFINE_INT_CURR("SHP ")		/* St. Helena Pound  */
-@@ -158,9 +137,9 @@
+@@ -158,9 +149,9 @@
  DEFINE_INT_CURR("SKK ")		/* Slovakian Koruna  */
  DEFINE_INT_CURR("SLL ")		/* Sierra Leone Leone  */
  DEFINE_INT_CURR("SOS ")		/* Somalia Schilling  */
@@ -1578,7 +1535,7 @@
  DEFINE_INT_CURR("SVC ")		/* El Salvador Colon  */
  DEFINE_INT_CURR("SYP ")		/* Syrian Arab Republic Pound  */
  DEFINE_INT_CURR("SZL ")		/* Swaziland Lilangeni  */
-@@ -169,17 +148,14 @@
+@@ -169,17 +160,14 @@
  DEFINE_INT_CURR("TMM ")		/* Turkmenistan Manet  */
  DEFINE_INT_CURR("TND ")		/* Tunisian Dinar  */
  DEFINE_INT_CURR("TOP ")		/* Tonga Pa'Anga  */
@@ -1597,7 +1554,7 @@
  DEFINE_INT_CURR("UYU ")		/* Uruguay Peso Uruguayo  */
  DEFINE_INT_CURR("UZS ")		/* Uzbekistan Sum  */
  DEFINE_INT_CURR("VEB ")		/* Venezuelan Bolivar  */
-@@ -189,13 +165,10 @@
+@@ -189,13 +177,10 @@
  DEFINE_INT_CURR("XAF ")		/* Central African Franc (United Republic of Cameroon, Central African Republic, Chad, Congo, Gabon)  */
  DEFINE_INT_CURR("XCD ")		/* East Caribbean Dollar (Antiqua, Dominica, Grenada, Montserrat, St. Kitts-Nevis-Anguilla, Saint Lucia, Saint Vincent and the Grenadines)  */
  DEFINE_INT_CURR("XDR ")		/* International Monetary Fund  */

Second, is a bunch of various bug fixes. These go 'til the end of this
mail and work fine as a .dpatch on their own (with the appropriate script
header, obviously). These don't include the nice() changes, though.

FWIW, the modified glibc-cvs.dpatch file is at:
  http://people.debian.org/~ajt/lsb/patches/glibc-cvs.dpatch.gz

and the following patch in dpatch format is at:
  http://people.debian.org/~ajt/lsb/patches/various-lsb-fixes-suse.dpatch.gz

>From suse's glibc 2.2.5-55. Fixes:
    LSB.os/devclass/grantpt_L/T.grantpt_L-2       FAIL
    LSB.os/devclass/grantpt_L/T.grantpt_L-3       FAIL
    LSB.os/genuts/ftw/T.ftw-4                     FAIL
    LSB.os/genuts/nftw/T.nftw-10                  FAIL
    POSIX.os/procenv/sysconf/T.sysconf-10         FAIL

--- sysdeps/posix/sysconf.c	Fri Jul  6 06:56:01 2001
+++ sysdeps/posix/sysconf.c	Wed Dec 19 08:55:13 2001
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <unistd.h>
+#include <sys/param.h>
 #include <sys/sysinfo.h>
 #include <sys/types.h>
 #include <regex.h>
@@ -75,7 +76,7 @@
 #endif
 
     case _SC_TZNAME_MAX:
-      return __tzname_max ();
+      return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
 
     case _SC_JOB_CONTROL:
 #ifdef	_POSIX_JOB_CONTROL
--- sysdeps/generic/sysconf.c	Fri Jul  6 06:55:50 2001
+++ sysdeps/generic/sysconf.c	Wed Dec 19 08:55:11 2001
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1995,1996,1997,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
 #include <unistd.h>
 #include <time.h>
 #include <limits.h>
+#include <sys/param.h>
 #include <sys/sysinfo.h>
 
 
@@ -36,7 +37,7 @@
       return -1;
 
     case _SC_TZNAME_MAX:
-      return __tzname_max ();
+      return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
 
     case _SC_CHARCLASS_NAME_MAX:
 #ifdef	CHARCLASS_NAME_MAX
--- sysdeps/unix/sysv/linux/grantpt.c	Fri Jul  6 06:56:12 2001
+++ sysdeps/unix/sysv/linux/grantpt.c	Wed Dec 19 08:55:13 2001
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +16,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
+#include <fcntl.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <sys/statfs.h>
@@ -25,7 +27,7 @@
 /* Prototype for function that changes ownership and access permission
    for slave pseudo terminals that do not live on a `devpts'
    filesystem.  */
-int __unix_grantpt (int fd);
+static int __unix_grantpt (int fd);
 
 /* Prototype for private function that gets the name of the slave
    pseudo terminal in a safe way.  */
@@ -45,9 +47,24 @@
 #endif
   char *buf = _buf;
 
-  if (pts_name (fd, &buf, sizeof (_buf)))
-    return -1;
-  
+  if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf)), 0))
+    {
+      int save_errno = errno;
+
+      /* Check, if the file descriptor is valid. pts_name returns the
+	 wrong errno number, so we cannot use that.  */
+      if (__libc_fcntl (fd, F_GETFD) == -1 && errno == EBADF)
+	return -1;
+
+      __set_errno (save_errno);
+
+       /* If the filedescriptor is no TTY, grantpt has to set errno
+          to EINVAL.  */
+       if (errno == ENOTTY)
+         __set_errno (EINVAL);
+       return -1;
+    }
+
   if (__statfs (buf, &fsbuf) < 0)
     return -1;
 
@@ -59,5 +76,5 @@
   return __unix_grantpt (fd);
 }
 
-#define grantpt __unix_grantpt
+#define grantpt static __unix_grantpt
 #include <sysdeps/unix/grantpt.c>
--- login/Makefile	Fri Jul  6 06:55:34 2001
+++ login/Makefile	Wed Dec 19 08:54:15 2001
@@ -37,7 +37,7 @@
 subdir-dirs = programs
 vpath %.c programs
 
-tests := tst-utmp tst-utmpx
+tests := tst-utmp tst-utmpx tst-grantpt
 
 # Build the -lutil library with these extra functions.
 extra-libs      := libutil
--- login/tst-grantpt.c	Thu Jan  1 01:00:00 1970
+++ login/tst-grantpt.c	Wed Dec 19 01:06:45 2001
@@ -0,0 +1,78 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+static int
+test_ebadf (void)
+{
+  int fd, ret, err;
+
+  fd = posix_openpt (O_RDWR);
+  if (fd == -1)
+    {
+      printf ("posix_openpt(O_RDWR) failed\nerrno %d (%s)\n",
+	      errno, strerror (errno));
+      /* We don't fail because of this; maybe the system does not have
+	 SUS pseudo terminals.  */
+      return 0;
+    }
+  unlockpt (fd);
+  close (fd);
+
+  ret = grantpt (fd);
+  err = errno;
+  if (ret != -1 || err != EBADF)
+    {
+      printf ("grantpt(): expected: return = %d, errno = %d\n", -1, EBADF);
+      printf ("           got: return = %d, errno = %d\n", ret, err);
+      return 1;
+    }
+  return 0;
+}
+
+static int
+test_einval (void)
+{
+  int fd, ret, err;
+  const char file[] = "./grantpt-einval";
+
+  fd = open (file, O_RDWR | O_CREAT);
+  if (fd == -1)
+    {
+      printf ("open(\"%s\", O_RDWR) failed\nerrno %d (%s)\n",
+	      file, errno, strerror (errno));
+      return 0;
+    }
+  unlink (file);
+
+  ret = grantpt (fd);
+  err = errno;
+  if (ret != -1 || err != EINVAL)
+    {
+      printf ("grantpt(): expected: return = %d, errno = %d\n", -1, EINVAL);
+      printf ("           got: return = %d, errno = %d\n", ret, err);
+      ret = 1;
+    }
+  else
+    ret = 0;
+
+  close (fd);
+
+  return ret;
+}
+
+int
+main (void)
+{
+  int result = 0;
+
+  result += test_ebadf ();
+  result += test_einval ();
+
+  return result;
+}
--- io/ftw.c	Tue Dec 11 00:51:23 2001
+++ io/ftw.c	Wed Dec 19 08:54:12 2001
@@ -473,9 +473,6 @@
       return -1;
     }
 
-  if (__access (dir, R_OK) != 0)
-    return -1;
-
   data.maxdir = descriptors < 1 ? 1 : descriptors;
   data.actdir = 0;
   data.dirstreams = (struct dir_data **) alloca (data.maxdir
@@ -552,12 +549,10 @@
 	   ? LXSTAT (_STAT_VER, data.dirbuf, &st)
 	   : XSTAT (_STAT_VER, data.dirbuf, &st)) < 0)
 	{
-	  if (errno == EACCES)
-	    result = (*data.func) (data.dirbuf, &st, FTW_NS, &data.ftw);
-	  else if (!(flags & FTW_PHYS)
-		   && errno == ENOENT
-		   && LXSTAT (_STAT_VER, dir, &st) == 0
-		   && S_ISLNK (st.st_mode))
+	  if (!(flags & FTW_PHYS)
+	      && errno == ENOENT
+	      && LXSTAT (_STAT_VER, dir, &st) == 0
+	      && S_ISLNK (st.st_mode))
 	    result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN],
 				   &data.ftw);
 	  else




Reply to: