Package: postal
Version: 0.74
Followup-For: Bug #830472
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu yakkety ubuntu-patch

Dear Maintainer,

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

  * Fix FTBFS:
    - smtp.h:
      + Qualify std::tr1::hash.
      + Include <cstdlib>.
      + Use rand() instead of random().
    - postal.cpp: Include <cstdlib>.
    - bhmusers.h: Qualify std::tr1::hash.
    - bhmusers.cpp: Include <cstdlib>.
    - bhm.cpp: Include <cstdlib>.

Thanks for considering the patch.

Logan Rosen

-- System Information:
Debian Release: stretch/sid
  APT prefers xenial-updates
  APT policy: (500, 'xenial-updates'), (500, 'xenial-security'), (500, 
'xenial'), (100, 'xenial-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-21-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.utf8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru postal-0.74/bhm.cpp postal-0.74ubuntu1/bhm.cpp
--- postal-0.74/bhm.cpp	2016-06-30 05:04:24.000000000 -0400
+++ postal-0.74ubuntu1/bhm.cpp	2016-07-10 20:47:47.000000000 -0400
@@ -14,6 +14,7 @@
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #include <netinet/ip.h>
+#include <cstdlib>
 
 #include "postal.h"
 #include "logit.h"
diff -Nru postal-0.74/bhmusers.cpp postal-0.74ubuntu1/bhmusers.cpp
--- postal-0.74/bhmusers.cpp	2008-04-09 21:36:27.000000000 -0400
+++ postal-0.74ubuntu1/bhmusers.cpp	2016-07-10 20:44:21.000000000 -0400
@@ -2,6 +2,7 @@
 #include <stdio.h>
 #include <cstring>
 #include "expand.h"
+#include <cstdlib>
 
 BHMUsers::BHMUsers(const char *userListFile)
 {
diff -Nru postal-0.74/bhmusers.h postal-0.74ubuntu1/bhmusers.h
--- postal-0.74/bhmusers.h	2016-06-30 04:57:25.000000000 -0400
+++ postal-0.74ubuntu1/bhmusers.h	2016-07-10 20:43:48.000000000 -0400
@@ -18,7 +18,7 @@
   int sync_time;
 } BHM_DATA;
 
-typedef std::tr1::unordered_map<string, BHM_DATA, hash<string> > NAME_MAP;
+typedef std::tr1::unordered_map<string, BHM_DATA, std::tr1::hash<string> > NAME_MAP;
 
 class BHMUsers
 {
diff -Nru postal-0.74/changes.txt postal-0.74ubuntu1/changes.txt
--- postal-0.74/changes.txt	2016-06-30 05:04:53.000000000 -0400
+++ postal-0.74ubuntu1/changes.txt	2016-07-10 20:53:58.000000000 -0400
@@ -1,3 +1,17 @@
+postal (0.74ubuntu1) yakkety; urgency=medium
+
+  * Fix FTBFS:
+    - smtp.h:
+      + Qualify std::tr1::hash.
+      + Include <cstdlib>.
+      + Use rand() instead of random().
+    - postal.cpp: Include <cstdlib>.
+    - bhmusers.h: Qualify std::tr1::hash.
+    - bhmusers.cpp: Include <cstdlib>.
+    - bhm.cpp: Include <cstdlib>.
+
+ -- Logan Rosen <lo...@ubuntu.com>  Sun, 10 Jul 2016 20:29:41 -0400
+
 postal (0.74) unstable; urgency=medium
 
   * Add -b option to bind to an address to bhm
diff -Nru postal-0.74/postal.cpp postal-0.74ubuntu1/postal.cpp
--- postal-0.74/postal.cpp	2014-08-18 13:24:20.000000000 -0400
+++ postal-0.74ubuntu1/postal.cpp	2016-07-10 20:41:32.000000000 -0400
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include "postal.h"
 #include "logit.h"
+#include <cstdlib>
 #ifdef USE_GNUTLS
 #include <errno.h>
 #if GNUTLS_VERSION_NUMBER <= 0x020b00
diff -Nru postal-0.74/smtp.cpp postal-0.74ubuntu1/smtp.cpp
--- postal-0.74/smtp.cpp	2016-06-30 04:11:35.000000000 -0400
+++ postal-0.74ubuntu1/smtp.cpp	2016-07-10 20:39:42.000000000 -0400
@@ -9,6 +9,7 @@
 #include "logit.h"
 #include "results.h"
 #include <cstring>
+#include <cstdlib>
 
 smtpData::smtpData()
  : m_quit("QUIT\r\n")
@@ -66,7 +67,7 @@
     return;
 
   for(int i = 0; i < MAP_SIZE; i++)
-    m_randBuf[i] = m_randomLetters[random() % m_randomLen];
+    m_randBuf[i] = m_randomLetters[rand() % m_randomLen];
   m_timeLastAction = time(NULL);
 }
 
@@ -76,7 +77,7 @@
     return;
   if(len > 2)
   {
-    int offset = random() % (MAP_SIZE - (len - 2));
+    int offset = rand() % (MAP_SIZE - (len - 2));
     memcpy(buf, &m_randBuf[offset], len - 2);
   }
   strcpy(buf + len - 2, "\r\n");
@@ -88,7 +89,7 @@
 {
   while(len)
   {
-    int line_len = random() % max_line_len;
+    int line_len = rand() % max_line_len;
     if(line_len < 2)
       line_len = 2;
     if(len - line_len < 2)
@@ -106,7 +107,7 @@
   time_t t = time(NULL);
   struct tm broken;
 
-  t += 60 - random() % 600;
+  t += 60 - rand() % 600;
 
   if(!gmtime_r(&t, &broken) || !strftime(buf, 34, "%a, %d %b %Y %H:%M:%S %z\r\n", &broken))
     strcpy(buf, "Error making date");
@@ -161,7 +162,7 @@
       else if(m_msgsPerConnection < 0)
         msgs = 0;
       else
-        msgs = random() % m_msgsPerConnection + 1;
+        msgs = rand() % m_msgsPerConnection + 1;
 
       if(rc)
         msgs = 0;
@@ -285,7 +286,7 @@
   int rc;
   int size = 0;
   if(m_maxMsgSize > m_minMsgSize)
-    size = random() % (m_maxMsgSize - m_minMsgSize) + m_minMsgSize;
+    size = rand() % (m_maxMsgSize - m_minMsgSize) + m_minMsgSize;
   else
     size = m_maxMsgSize;
   m_md5.init();
@@ -318,7 +319,7 @@
     subject += " ";
   char subj_buf[61];
   // random string from 2 to buffer len
-  int subj_len = random() % (sizeof(subj_buf) - 3) + 2;
+  int subj_len = rand() % (sizeof(subj_buf) - 3) + 2;
   m_data->randomString(subj_buf, subj_len);
   subj_buf[subj_len] = 0;
   subject += subj_buf;
diff -Nru postal-0.74/smtp.h postal-0.74ubuntu1/smtp.h
--- postal-0.74/smtp.h	2016-06-30 04:51:27.000000000 -0400
+++ postal-0.74ubuntu1/smtp.h	2016-07-10 20:29:39.000000000 -0400
@@ -25,7 +25,7 @@
   }
 };
 
-typedef std::tr1::unordered_map<unsigned long, string *, hash<unsigned long>, eqlng> NAME_MAP;
+typedef std::tr1::unordered_map<unsigned long, string *, std::tr1::hash<unsigned long>, eqlng> NAME_MAP;
 
 class smtpData
 {

Reply via email to