pkgsrc-Users archive

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

archivers/dar patch for testing



Hi all,
the attached patch removes some nastiness from archivers/dar that breaks
with libc++. The "char" template parameter for a basic_string must be
POD and this one isn't. It replaces the mess with a proper sorting.
As I don't have a way for testing this, it would be nice if someone
could give it a try...

Joerg
Index: archivers/dar/distinfo
==================================================================
--- archivers/dar/distinfo
+++ archivers/dar/distinfo
@@ -4,11 +4,11 @@
 RMD160 (dar-2.4.10.tar.gz) = 26161a09a60e36a3094f94d8831a157b7c3e4d0a
 Size (dar-2.4.10.tar.gz) = 1760827 bytes
 SHA1 (patch-aa) = 734ec162dbc339b2015a169bb9fe723e45d0a29b
 SHA1 (patch-ab) = f07d55861f21545b0ae8ac6b187a94526e44e345
 SHA1 (patch-ac) = dcbf4e31071c83a167a60a20e4980b35f055a46e
-SHA1 (patch-ad) = df21f72b12ab19123f1c61e8e1645519c43d7f7b
+SHA1 (patch-ad) = e32c33d5670f39a04f8ceef94d6e9d5a6b524016
 SHA1 (patch-ae) = 54220384bf2031df64c38f5abea038382ca37e8e
 SHA1 (patch-af) = 414e58277c946b59f57352e260ac5d49673ef008
 SHA1 (patch-src_dar__suite_command__line.cpp) = 
63d3004bf7d49277c1508fe5d9ac52ec0d5bf11f
 SHA1 (patch-src_dar__suite_crit__action__cmd__line.cpp) = 
bc9484e836fbde98f682f6031aaadd99cc8eb479
 SHA1 (patch-src_dar__suite_dar__manager.cpp) = 
2ed9008b5e7629ef8e279b7d1218a4fae5101df1
@@ -15,13 +15,14 @@
 SHA1 (patch-src_dar__suite_dar__xform.cpp) = 
929e7cbb933a8d58bd1b79ecb50404f5dbbfddfe
 SHA1 (patch-src_dar__suite_line__tools.cpp) = 
076c5213aaa3e6dfa471322b6597c0ce8ccfd2a8
 SHA1 (patch-src_examples_factoriel.cpp) = 
6c9e038b7a3bbfdc96dbbdf1b7e100c159353f87
 SHA1 (patch-src_examples_formula.cpp) = 
583ceeba0a232e657ab0696711f630476ec2e495
 SHA1 (patch-src_examples_prime.cpp) = 09fc3b96642945042a2d13bb4c1995546cdb7607
-SHA1 (patch-src_libdar_mask__list.hpp) = 
b16686706cb7ad7065467decfd93271f01d9c663
+SHA1 (patch-src_libdar_mask__list.hpp) = 
b3b6eaa36875784432e53d5dfbfb33d7623054a3
 SHA1 (patch-src_libdar_secu__string.hpp) = 
6793cb79bf5f8c4d3ac83ba4f2cd2fd9f452afb1
+SHA1 (patch-src_testing_Makefile.in) = e8d48b5fa9fcdd2f5bef3fca240850c0787f6647
 SHA1 (patch-src_testing_test__catalogue.cpp) = 
2d1a8299f01776e3fa9996819aa8be523b73b4cc
 SHA1 (patch-src_testing_test__deci.cpp) = 
053e2123a5219dc0cb827743e348f9463ce84615
 SHA1 (patch-src_testing_test__escape.cpp) = 
b7959b2e5e3675d2e64f232face3b18384f8e3da
 SHA1 (patch-src_testing_test__infinint.cpp) = 
5ee29a1881b05881bb334f1cd7bfd30ea21baf7f
 SHA1 (patch-src_testing_test__terminateur.cpp) = 
79d4efadfc4528d6def28985228a0d25d1fc6e78
 SHA1 (patch-src_testing_testtools.cpp) = 
4cdd4a6fde69f40463464f6ead1d208a685a516b

Index: archivers/dar/patches/patch-ad
==================================================================
--- archivers/dar/patches/patch-ad
+++ archivers/dar/patches/patch-ad
@@ -2,17 +2,133 @@
 
 On Solaris 10 with SunPro, vector<> does not have a method assign().
 
 --- src/libdar/mask_list.cpp.orig      2011-02-11 20:23:42.000000000 +0000
 +++ src/libdar/mask_list.cpp
-@@ -200,7 +200,10 @@ namespace libdar
-           my_tmp.unique(); // remove duplicates
+@@ -55,6 +55,21 @@ using namespace std;
+ namespace libdar
+ {
+ 
++static bool cmp_strings(const std::string &x, const std::string &y)
++{
++  size_t i;
++  for (i = 0; i < x.size(); ++i) {
++    if (x[i] == y[i])
++      continue;
++    if(x[i] == '/')
++      return true;
++    if(y[i] == '/')
++      return false;
++    return x[i] < y[i];
++  }
++  return false;
++}
++
+     mask_list::mask_list(const string & filename_list_st, bool case_sensit, 
const path & prefix_t, bool include)
+     {
+       NLS_SWAP_IN;
+@@ -194,12 +209,14 @@ namespace libdar
+ 
+               // we use a temporary list of string of my_chart to use
+               // the lexicographic sorting with having the / as the lowest 
character
+-          list<basic_string<my_char> > my_tmp = convert_list_string_char(tmp);
+-          my_tmp.sort();   // sort the list ( using the string's < operator 
over "my_char" )
+-          my_tmp.unique(); // remove duplicates
++              tmp.sort(cmp_strings);
++              tmp.unique();
  
                // converting the sorted list to vector, to get the indexing 
feature of this type
 -          contenu.assign(my_tmp.begin(), my_tmp.end());
 +              contenu.clear();
-+              for (list< basic_string<my_char> >::const_iterator it = 
my_tmp.begin(); it != my_tmp.end(); it++)
++              for (list< string >::const_iterator it = tmp.begin(); it != 
tmp.end(); it++)
 +                      contenu.push_back(*it);
 +
            taille = contenu.size();
            if(taille < contenu.size())
                throw Erange("mask_list::mask_list", tools_printf(gettext("Too 
much line in file %S (integer overflow)"), &filename_list_st));
+@@ -218,23 +235,23 @@ namespace libdar
+           return false;
+ 
+       U_I min = 0, max = taille-1, tmp;
+-        basic_string<my_char> target;
++        string target;
+         bool ret;
+ 
+         if(case_s)
+-            target = convert_string_char(expression);
++            target = expression;
+         else
+         {
+             string hidden = expression;
+             tools_to_upper(hidden);
+-            target = convert_string_char(hidden);
++            target = hidden;
+         }
+ 
+             // divide & conquer algorithm on a sorted list (aka binary search)
+         while(max - min > 1)
+         {
+             tmp = (min + max)/2;
+-            if(contenu[tmp] < target)
++            if(cmp_strings(contenu[tmp], target))
+                 min = tmp;
+             else
+                 if(contenu[tmp] == target)
+@@ -246,57 +263,11 @@ namespace libdar
+         ret = contenu[max] == target || contenu[min] == target;
+         if(including && !ret) // if including files, we must also include 
directories leading to a listed file
+       {
+-          string c_max = convert_string_my_char(contenu[max]);
++          string c_max = contenu[max];
+             ret = path(c_max).is_subdir_of(expression, case_s);
+       }
+ 
+         return ret;
+     }
+ 
+-
+-      //////// private routines implementation
+-
+-
+-    list<basic_string<mask_list::my_char> > 
mask_list::convert_list_string_char(const list<string> & src)
+-    {
+-      list<basic_string<my_char> > ret;
+-      list<string>::const_iterator it = src.begin();
+-
+-      while(it != src.end())
+-      {
+-          ret.push_back(convert_string_char(*it));
+-          ++it;
+-      }
+-      return ret;
+-    }
+-
+-    basic_string<mask_list::my_char> mask_list::convert_string_char(const 
string & src)
+-    {
+-      basic_string<my_char> ret;
+-
+-      string::const_iterator ut = src.begin();
+-      while(ut != src.end())
+-      {
+-          ret += my_char(*ut);
+-          ++ut;
+-      }
+-
+-      return ret;
+-    }
+-
+-    string mask_list::convert_string_my_char(const 
basic_string<mask_list::my_char> & src)
+-    {
+-      string ret;
+-
+-      basic_string<my_char>::const_iterator ut = src.begin();
+-      while(ut != src.end())
+-      {
+-          ret += char(*ut);
+-          ++ut;
+-      }
+-
+-      return ret;
+-    }
+-
+-
+ } // end of namespace

Index: archivers/dar/patches/patch-src_libdar_mask__list.hpp
==================================================================
--- archivers/dar/patches/patch-src_libdar_mask__list.hpp
+++ archivers/dar/patches/patch-src_libdar_mask__list.hpp
@@ -1,13 +1,52 @@
 $NetBSD: patch-src_libdar_mask__list.hpp,v 1.1 2013/06/26 15:49:31 joerg Exp $
 
---- src/libdar/mask_list.hpp.orig      2013-06-20 19:11:02.000000000 +0000
+--- src/libdar/mask_list.hpp.orig      2012-11-30 20:51:11.000000000 +0000
 +++ src/libdar/mask_list.hpp
-@@ -80,7 +80,7 @@ namespace libdar
-       class my_char
-       {
-       public:
+@@ -70,46 +70,10 @@ namespace libdar
+ 
+     private:
+ 
+-          // we need to change to lexicographical order relationship for the 
'/' character be the most lower of all. This way
+-          // the first entry listed from a set a file sharing the same first 
characters will be the one corresponding
+-          // to the directory with this common prefix.
+-
+-      class my_char
+-      {
+-      public:
 -          my_char() { val = 0; };
-+          my_char() = default;
-           my_char(const char x) : val(x) {};
-           bool operator < (const my_char & x) const
-           {
+-          my_char(const char x) : val(x) {};
+-          bool operator < (const my_char & x) const
+-          {
+-              if(val == '/')
+-                  if(x.val == '/')
+-                      return false;
+-                  else
+-                      return true;
+-              else
+-                  if(x.val == '/')
+-                      return false;
+-                  else
+-                      return val < x.val;
+-          };
+-
+-          operator char() const
+-          {
+-              return val;
+-          };
+-
+-      private:
+-          char val;
+-      };
+-
+-        std::vector <std::basic_string<my_char> > contenu;
++        std::vector <std::string > contenu;
+         U_I taille;
+         bool case_s;
+         bool including;   // mask is used for including files (not for 
excluding files)
+-
+-      static std::list<std::basic_string<my_char> > 
convert_list_string_char(const std::list<std::string> & src);
+-      static std::basic_string<my_char> convert_string_char(const std::string 
& src);
+-      static std::string convert_string_my_char(const 
std::basic_string<my_char> & src);
+     };
+ 
+         /// @}



Home | Main Index | Thread Index | Old Index