OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  r...@openpkg.org
  Module: openpkg-src                      Date:   05-Jan-2009 20:32:24
  Branch: HEAD                             Handle: 2009010519322300

  Added files:
    openpkg-src/monotone    monotone.patch
  Modified files:
    openpkg-src/monotone    monotone.spec

  Log:
    apply an upstream fix

  Summary:
    Revision    Changes     Path
    1.21        +107 -0     openpkg-src/monotone/monotone.patch
    1.41        +3  -1      openpkg-src/monotone/monotone.spec
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/monotone/monotone.patch
  ============================================================================
  $ cvs diff -u -r0 -r1.21 monotone.patch
  --- /dev/null 2009-01-05 20:32:22 +0100
  +++ monotone.patch    2009-01-05 20:32:24 +0100
  @@ -0,0 +1,107 @@
  +In certain cases, especially also on FreeBSD, netsync called select()
  +even after read() returned 0 bytes to indicate the end of the file,
  +resulting in a confusing error message. This is fixed by treating EOF
  +specially and prevent further calls to select() on the file handle, as
  +recommended by the select_tut man page.
  +
  +Index: netsync.cc
  +--- netsync.cc       e549bac580f407665575fb8cd40178f0b3c3acf5
  ++++ netsync.cc       944dac317f3f3d55d0fd8bc286512cb7c2fded9a
  +@@ -353,7 +353,7 @@ class session_base : public reactable
  + 
  + class session_base : public reactable
  + {
  +-  bool read_some();
  ++  void read_some(bool & failed, bool & eof);
  +   bool write_some();
  +   void mark_recent_io()
  +   {
  +@@ -468,10 +468,12 @@ session_base::which_events()
  +   return ret;
  + }
  + 
  +-bool
  +-session_base::read_some()
  ++void
  ++session_base::read_some(bool & failed, bool & eof)
  + {
  +   I(inbuf.size() < constants::netcmd_maxsz);
  ++  eof = false;
  ++  failed = false;
  +   char tmp[constants::bufsz];
  +   Netxx::signed_size_type count = str->read(tmp, sizeof(tmp));
  +   if (count > 0)
  +@@ -479,17 +481,38 @@ session_base::read_some()
  +       L(FL("read %d bytes from fd %d (peer %s)")
  +         % count % str->get_socketfd() % peer_id);
  +       if (encountered_error)
  +-        {
  +-          L(FL("in error unwind mode, so throwing them into the bit 
bucket"));
  +-          return true;
  +-        }
  ++        L(FL("in error unwind mode, so throwing them into the bit bucket"));
  ++
  +       inbuf.append(tmp,count);
  +       mark_recent_io();
  +       note_bytes_in(count);
  +-      return true;
  +     }
  ++  else if (count == 0)
  ++    {
  ++      // Returning 0 bytes after select() marks the file descriptor as
  ++      // ready for reading signifies EOF.
  ++
  ++      switch (protocol_state)
  ++        {
  ++        case working_state:
  ++          P(F("peer %s IO terminated connection in working state (error)")
  ++            % peer_id);
  ++          break;
  ++
  ++        case shutdown_state:
  ++          P(F("peer %s IO terminated connection in shutdown state "
  ++              "(possibly client misreported error)")
  ++            % peer_id);
  ++          break;
  ++
  ++        case confirmed_state:
  ++          break;
  ++        }
  ++
  ++      eof = true;
  ++    }
  +   else
  +-    return false;
  ++    failed = true;
  + }
  + 
  + bool
  +@@ -531,11 +554,14 @@ session_base::do_io(Netxx::Probe::ready_
  + session_base::do_io(Netxx::Probe::ready_type what)
  + {
  +   bool ok = true;
  ++  bool eof = false;
  +   try
  +     {
  +       if (what & Netxx::Probe::ready_read)
  +         {
  +-          if (!read_some())
  ++          bool failed;
  ++          read_some(failed, eof);
  ++          if (failed)
  +             ok = false;
  +         }
  +       if (what & Netxx::Probe::ready_write)
  +@@ -578,7 +604,11 @@ session_base::do_io(Netxx::Probe::ready_
  +         % peer_id);
  +       ok = false;
  +     }
  +-  return ok;
  ++
  ++  // Return false in case we reached EOF, so as to prevent further calls
  ++  // to select()s on this stream, as recommended by the select_tut man
  ++  // page.
  ++  return ok && !eof;
  + }
  + 
  + ////////////////////////////////////////////////////////////////////////
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/monotone/monotone.spec
  ============================================================================
  $ cvs diff -u -r1.40 -r1.41 monotone.spec
  --- openpkg-src/monotone/monotone.spec        28 Dec 2008 14:11:15 -0000      
1.40
  +++ openpkg-src/monotone/monotone.spec        5 Jan 2009 19:32:23 -0000       
1.41
  @@ -32,7 +32,7 @@
   Group:        SCM
   License:      GPL
   Version:      0.42
  -Release:      20081228
  +Release:      20090105
   
   #   package options
   %option       with_rse  yes
  @@ -44,6 +44,7 @@
   Source4:      monotone-colorize.pl
   Source5:      monotone-colorize.bashrc
   Source6:      monotone.bashrc
  +Patch0:       monotone.patch
   Patch1:       monotone.patch.rse
   
   #   build information
  @@ -76,6 +77,7 @@
   
   %prep
       %setup -q
  +    %patch -p0 -P 0
   %if "%{with_rse}" == "yes"
       %patch -p0 -P 1
   %endif
  @@ .
______________________________________________________________________
OpenPKG                                             http://openpkg.org
CVS Repository Commit List                     openpkg-cvs@openpkg.org

Reply via email to