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

r1219 - in glibc-package/trunk/debian: . patches



Author: aurel32
Date: 2006-02-23 10:04:15 +0000 (Thu, 23 Feb 2006)
New Revision: 1219

Added:
   glibc-package/trunk/debian/patches/ldconfig-multiarch.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
 * Multiarch support:
   - Add ldconfig-multiarch.diff (add directories pointed from /lib/ldconfig/
     to the search path).



Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2006-02-23 09:59:27 UTC (rev 1218)
+++ glibc-package/trunk/debian/changelog	2006-02-23 10:04:15 UTC (rev 1219)
@@ -94,6 +94,8 @@
     - Add ld-multiarch.diff (Add (/usr)/lib/$(config-machine)-$(config-os)) 
       to the search path of the dynamic linker) from Tollef Fog Heen.
       (Closes: #295855)
+    - Add ldconfig-multiarch.diff (add directories pointed from /lib/ldconfig
+      to the search path).
 
  -- Clint Adams <schizo@debian.org>  Sun, 12 Feb 2006 11:04:38 -0500
 

Added: glibc-package/trunk/debian/patches/ldconfig-multiarch.diff
===================================================================
--- glibc-package/trunk/debian/patches/ldconfig-multiarch.diff	2006-02-23 09:59:27 UTC (rev 1218)
+++ glibc-package/trunk/debian/patches/ldconfig-multiarch.diff	2006-02-23 10:04:15 UTC (rev 1219)
@@ -0,0 +1,147 @@
+2006-02-23  Aurelien Jarno  <aurel32@debian.org> 
+
+	* elf/ldconfig.c: add directories pointed from /lib/ldconfig
+	  to the search path.
+
+--- glibc-2.3.6/elf/ldconfig.c	2006-02-21 16:00:32.000000000 +0100
++++ glibc-2.3.6/elf/ldconfig.c	2006-02-23 03:08:45.000000000 +0100
+@@ -1052,6 +1027,129 @@
+   fclose (file);
+ }
+ 
++static void
++add_multiarch_dirs (const char *path)
++{
++  DIR *dir;
++  struct dirent64 *direntry;
++  char *file_name, *dir_name, *real_file_name, *link_path;
++  int file_name_len, real_file_name_len, link_path_len, len;
++  struct stat64 lstat_buf, stat_buf;
++  int is_link, is_dir;
++
++  file_name_len = PATH_MAX;
++  file_name = alloca (file_name_len);
++  
++  link_path_len = PATH_MAX;
++  link_path = alloca (link_path_len);
++ 
++  if (opt_chroot)
++    {
++      dir_name = chroot_canon (opt_chroot, path);
++      real_file_name_len = PATH_MAX;
++      real_file_name = alloca (real_file_name_len);
++    }
++  else
++    {
++      dir_name = xstrdup(path);
++      real_file_name_len = 0;
++      real_file_name = file_name;
++    }
++
++  if (dir_name == NULL || (dir = opendir (dir_name)) == NULL)
++    {
++      if (opt_verbose)
++        error (0, errno, _("Can't open directory %s"), path);
++      if (opt_chroot && dir_name)
++        free (dir_name);
++      return;
++    }
++
++  while ((direntry = readdir64 (dir)) != NULL)
++    {
++#ifdef _DIRENT_HAVE_D_TYPE
++      /* We only look at links.  */
++      if (direntry->d_type != DT_LNK)
++	continue;
++#endif /* _DIRENT_HAVE_D_TYPE  */
++    
++      len = strlen (path) + strlen (direntry->d_name);
++      if (len > file_name_len)
++	{
++	  file_name_len = len + 1;
++	  file_name = alloca (file_name_len);
++	  if (!opt_chroot)
++	    real_file_name = file_name;
++	}
++      sprintf (file_name, "%s/%s", path, direntry->d_name);
++      if (opt_chroot)
++        {
++          len = strlen (dir_name) + strlen (direntry->d_name);
++          if (len > real_file_name_len)
++            {
++              real_file_name_len = len + 1;
++              real_file_name = alloca (real_file_name_len);
++            }
++          sprintf (real_file_name, "%s/%s", dir_name, direntry->d_name);
++        }
++
++      if (__builtin_expect (lstat64 (real_file_name, &lstat_buf), 0))
++        {
++          error (0, errno, _("Cannot lstat %s"), file_name);
++          continue;
++        }
++
++      /* We only look at links.  */
++      is_link = S_ISLNK (lstat_buf.st_mode);
++      if (!is_link)
++        {
++	  if (opt_verbose)
++	    error (0, errno, _("%s is not a symlink"), file_name);
++          continue;
++        }
++
++      /* Check the symlink refers to a directory.  */
++      if (__builtin_expect (stat64 (real_file_name, &stat_buf), 0))
++        {
++	  if (opt_verbose)
++	    error (0, errno, _("Cannot stat %s"), file_name);
++          continue;
++        }
++
++      is_dir = S_ISDIR (stat_buf.st_mode);
++      if (!is_dir)
++        {
++	  if (opt_verbose)
++	    error (0, errno, _("%s is not a directory"), file_name);
++          continue;
++        }
++
++      /* Read the link.  */
++      if (realpath(real_file_name, link_path) == NULL)
++	{
++	  if (opt_verbose)
++	    error (0, errno, _("Cannot read link %s"), file_name);
++          continue;
++	}
++
++      if (opt_chroot)
++	{
++	   len = strlen(opt_chroot);
++	   if (strncmp(opt_chroot, link_path, len) == 0)
++	     add_dir(link_path + len);		  
++	   else
++	     error (0, errno, _("Link %s refers to outside of the chroot"), file_name);
++	}
++      else
++	{	      
++          add_dir(link_path);
++	}	 
++    }
++
++  closedir (dir);
++  free (dir_name);
++}
++
+ /* Handle one word in an `include' line, a glob pattern of additional
+    config files to read.  */
+ static void
+@@ -1240,6 +1338,9 @@
+       add_system_dir (SLIBDIR);
+       if (strcmp (SLIBDIR, LIBDIR))
+ 	add_system_dir (LIBDIR);
++
++      /* Add multiarch directories.  */
++      add_multiarch_dirs("/lib/ldconfig");
+     }
+ 
+   search_dirs ();

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2006-02-23 09:59:27 UTC (rev 1218)
+++ glibc-package/trunk/debian/patches/series	2006-02-23 10:04:15 UTC (rev 1219)
@@ -127,3 +127,4 @@
 hurd-ioctl-decode-argument.diff -p0
 glibc-manual-string.diff -p1
 ld-multiarch.diff -p1
+ldconfig-multiarch.diff -p1



Reply to: