Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Feb 2013 15:02:52 -0600
From:      Mark Felder <feld@feld.me>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        toxic@doobie.com
Subject:   ports/175846: [PATCH] archivers/libpar2: update nzbget patches
Message-ID:  <E1U2TBk-0009PU-B3@feld.me>
Resent-Message-ID: <201302042110.r14LA01c046202@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         175846
>Category:       ports
>Synopsis:       [PATCH] archivers/libpar2: update nzbget patches
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 04 21:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     feld
>Release:        FreeBSD 9.1-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD mwi1.coffeenet.org 9.1-RELEASE FreeBSD 9.1-RELEASE #6 r243808: Mon Dec  3 07:51:34
>Description:
Update patches required by nzbget (the only libpar2 consumer in the ports tree AFAICT)

Port maintainer (toxic@doobie.com) is cc'd.

Generated with FreeBSD Port Tools 0.99_6 (mode: change, diff: suffix)
>How-To-Repeat:
>Fix:

--- libpar2-0.2_4.patch begins here ---
diff -ruN --exclude=CVS ../libpar2.orig/Makefile ./Makefile
--- ../libpar2.orig/Makefile	2012-12-18 02:04:12.000000000 -0600
+++ ./Makefile	2013-02-04 15:02:02.778343756 -0600
@@ -3,7 +3,7 @@
 
 PORTNAME=	libpar2
 PORTVERSION=	0.2
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	archivers
 MASTER_SITES=	SF/parchive/${PORTNAME}/${PORTVERSION}
 
diff -ruN --exclude=CVS ../libpar2.orig/files/patch-par2repairer.cpp ./files/patch-par2repairer.cpp
--- ../libpar2.orig/files/patch-par2repairer.cpp	2010-05-10 01:04:30.000000000 -0500
+++ ./files/patch-par2repairer.cpp	2013-02-04 14:52:59.197302366 -0600
@@ -1,14 +1,9 @@
-#####
-# This patch is maintained by Andrei Prygounkov, author of news/nzbget
-# It fixes a memory leak and a segfault triggered by a corrupted par2 file.
-#
-# For more details, see:
-#       http://sf.net/tracker/?func=detail&aid=2209433&group_id=30568&atid=399700
-#####
-diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
+diff -aud -U 5 ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
 --- ../libpar2-0.2-original/par2repairer.cpp	2006-01-20 18:25:20.000000000 +0100
-+++ ../libpar2-0.2/par2repairer.cpp	2008-02-06 12:02:53.226050300 +0100
-@@ -78,6 +78,7 @@
++++ ../libpar2-0.2/par2repairer.cpp	2012-11-30 14:23:31.000000000 +0100
+@@ -76,10 +76,11 @@
+     ++sf;
+   }
  
    delete mainpacket;
    delete creatorpacket;
@@ -16,7 +11,11 @@
  }
  
  
-@@ -1261,7 +1262,7 @@
+ Result Par2Repairer::PreProcess(const CommandLine &commandline)
+ {
+@@ -1259,11 +1260,11 @@
+         string path;
+         string name;
          DiskFile::SplitFilename(filename, path, name);
  
          cout << "Target: \"" << name << "\" - missing." << endl;
@@ -25,12 +24,37 @@
        }
      }
  
-@@ -1804,7 +1805,7 @@
+     ++sf;
+   }
+@@ -1802,11 +1803,11 @@
+              << "\" - no data found." 
+              << endl;
        }
      }
    }
 -  sig_done.emit(name,count,sourcefile->GetVerificationPacket()->BlockCount()); 
-+  sig_done.emit(name,count, sourcefile->GetVerificationPacket() ? sourcefile->GetVerificationPacket()->BlockCount() : 0); 
++  sig_done.emit(name,count, count>0 && sourcefile->GetVerificationPacket() ? sourcefile->GetVerificationPacket()->BlockCount() : 0); 
    sig_progress.emit(1000.0);
    return true;
  }
+ 
+ // Find out how much data we have found
+diff -aud -U 5 ../libpar2-0.2-original/par2repairer.h ../libpar2-0.2/par2repairer.h
+--- ../libpar2-0.2-original/par2repairer.h	2006-01-20 00:38:27.000000000 +0100
++++ ../libpar2-0.2/par2repairer.h	2012-11-30 14:24:46.000000000 +0100
+@@ -34,10 +34,15 @@
+   sigc::signal<void, std::string> sig_filename;
+   sigc::signal<void, double> sig_progress;
+   sigc::signal<void, ParHeaders*> sig_headers;
+   sigc::signal<void, std::string, int, int> sig_done;
+ 
++  // This method allows to determine whether libpar2 includes the patches
++  // ("libpar2-0.2-bugfixes.patch") submitted to libpar2 project.
++  // Use the method in configure scripts for detection.
++  void BugfixesPatchVersion2() { }
++
+ protected:
+   // Steps in verifying and repairing files:
+ 
+   // Load packets from the specified file
+   bool LoadPacketsFromFile(string filename);
diff -ruN --exclude=CVS ../libpar2.orig/files/xpatch-addcancel-par2repairer.cpp ./files/xpatch-addcancel-par2repairer.cpp
--- ../libpar2.orig/files/xpatch-addcancel-par2repairer.cpp	2010-05-10 01:04:30.000000000 -0500
+++ ./files/xpatch-addcancel-par2repairer.cpp	2013-02-04 14:52:37.612341983 -0600
@@ -1,14 +1,9 @@
-#####
-# This patch is maintained by Andrei Prygounkov, author of news/nzbget
-# It adds a graceful method to cancel file repair operations in progress.
-#
-# For more details, see: 
-#	http://sf.net/tracker/?func=detail&aid=2209488&group_id=30568&atid=399700 
-#####
-diff -aud ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
---- ../libpar2-0.2-original/par2repairer.cpp	2008-10-26 19:54:33.000000000 +0100
-+++ ../libpar2-0.2/par2repairer.cpp	2008-10-29 10:24:48.000000000 +0100
-@@ -52,6 +52,8 @@
+diff -aud -U 5 ../libpar2-0.2-original/par2repairer.cpp ../libpar2-0.2/par2repairer.cpp
+--- ../libpar2-0.2-original/par2repairer.cpp	2012-12-03 10:47:04.000000000 +0100
++++ ../libpar2-0.2/par2repairer.cpp	2012-12-03 10:48:13.000000000 +0100
+@@ -50,10 +50,12 @@
+   outputbuffer = 0;
+ 
    noiselevel = CommandLine::nlNormal;
    headers = new ParHeaders;
    alreadyloaded = false;
@@ -17,7 +12,11 @@
  }
  
  Par2Repairer::~Par2Repairer(void)
-@@ -406,6 +408,10 @@
+ {
+   delete [] (u8*)inputbuffer;
+@@ -404,10 +406,14 @@
+         {
+           cout << "Loading: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
            progress = offset;
  	sig_progress.emit(newfraction);
  
@@ -28,7 +27,11 @@
          }
        }
  
-@@ -584,6 +590,11 @@
+       // Attempt to read the next packet header
+       PACKET_HEADER header;
+@@ -582,10 +588,15 @@
+     if (noiselevel > CommandLine::nlQuiet)
+       cout << "No new packets found" << endl;
      delete diskfile;
    }
    
@@ -40,7 +43,11 @@
    return true;
  }
  
-@@ -833,9 +844,17 @@
+ // Finish loading a recovery packet
+ bool Par2Repairer::LoadRecoveryPacket(DiskFile *diskfile, u64 offset, PACKET_HEADER &header)
+@@ -831,26 +842,42 @@
+ 
+     // Load packets from each file that was found
      for (list<string>::const_iterator s=files->begin(); s!=files->end(); ++s)
      {
        LoadPacketsFromFile(*s);
@@ -58,7 +65,10 @@
    }
  
    {
-@@ -846,9 +865,17 @@
+     string wildcard = name.empty() ? "*.PAR2" : name + ".*.PAR2";
+     list<string> *files = DiskFile::FindFiles(path, wildcard);
+ 
+     // Load packets from each file that was found
      for (list<string>::const_iterator s=files->begin(); s!=files->end(); ++s)
      {
        LoadPacketsFromFile(*s);
@@ -76,7 +86,11 @@
    }
  
    return true;
-@@ -866,9 +893,18 @@
+ }
+ 
+@@ -864,13 +891,22 @@
+     // If the filename contains ".par2" anywhere
+     if (string::npos != filename.find(".par2") ||
          string::npos != filename.find(".PAR2"))
      {
        LoadPacketsFromFile(filename);
@@ -95,7 +109,11 @@
    return true;
  }
  
-@@ -1210,6 +1246,11 @@
+ // Check that the packets are consistent and discard any that are not
+ bool Par2Repairer::CheckPacketConsistency(void)
+@@ -1208,10 +1244,15 @@
+ 
+   // Start verifying the files
    sf = sortedfiles.begin();
    while (sf != sortedfiles.end())
    {
@@ -107,7 +125,11 @@
      // Do we have a source file
      Par2RepairerSourceFile *sourcefile = *sf;
  
-@@ -1562,6 +1603,10 @@
+     // What filename does the file use
+     string filename = sourcefile->TargetFileName();
+@@ -1560,10 +1601,14 @@
+       if (oldfraction != newfraction)
+       {
          cout << "Scanning: \"" << shortname << "\": " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
  	sig_progress.emit(newfraction);
  
@@ -118,7 +140,11 @@
        }
      }
  
-@@ -1651,6 +1696,11 @@
+     // If we fail to find a match, it might be because it was a duplicate of a block
+     // that we have already found.
+@@ -1649,10 +1694,15 @@
+           return false;
+       }
      }
    }
  
@@ -130,7 +156,11 @@
    // Get the Full and 16k hash values of the file
    filechecksummer.GetFileHashes(hashfull, hash16k);
  
-@@ -2291,10 +2341,19 @@
+   // Did we make any matches at all
+   if (count > 0)
+@@ -2289,14 +2339,23 @@
+           if (oldfraction != newfraction)
+           {
              cout << "Repairing: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
  	    sig_progress.emit(newfraction);
  
@@ -150,7 +180,11 @@
        ++inputblock;
        ++inputindex;
      }
-@@ -2348,9 +2407,18 @@
+   }
+   else
+@@ -2346,13 +2405,22 @@
+         if (oldfraction != newfraction)
+         {
            cout << "Processing: " << newfraction/10 << '.' << newfraction%10 << "%\r" << flush;
  	sig_progress.emit(newfraction);
  
@@ -169,7 +203,11 @@
        ++copyblock;
        ++inputblock;
      }
-@@ -2362,6 +2430,11 @@
+   }
+ 
+@@ -2360,10 +2428,15 @@
+   if (lastopenfile != NULL)
+   {
      lastopenfile->Close();
    }
  
@@ -181,10 +219,14 @@
    if (noiselevel > CommandLine::nlQuiet)
      cout << "Writing recovered data\r";
  
-diff -aud ../libpar2-0.2-original/par2repairer.h ../libpar2-0.2/par2repairer.h
---- ../libpar2-0.2-original/par2repairer.h	2006-01-20 00:38:27.000000000 +0100
-+++ ../libpar2-0.2/par2repairer.h	2008-10-26 19:01:08.000000000 +0100
-@@ -183,6 +183,7 @@
+   // For each output block that has been recomputed
+   vector<DataBlock*>::iterator outputblock = outputblocks.begin();
+diff -aud -U 5 ../libpar2-0.2-with-bugfixes-patch/par2repairer.h ../libpar2-0.2/par2repairer.h
+--- ../libpar2-0.2-original/par2repairer.h	2012-12-03 10:47:04.000000000 +0100
++++ ../libpar2-0.2/par2repairer.h	2012-12-03 10:48:13.000000000 +0100
+@@ -186,8 +186,9 @@
+ 
+   u64                       progress;                // How much data has been processed.
    u64                       totaldata;               // Total amount of data to be processed.
    u64                       totalsize;               // Total data size
  
--- libpar2-0.2_4.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1U2TBk-0009PU-B3>