I'm writing a custom Redis replication protocol receiver and I've noticed that the bulk transfer of dump.rdb lacks the \r\n which usually follows the reply. The result is that a custom parser is required - hiredis and other client-side parsers can't decode the protocol out-of-the-box.

I've tried the following quick-fix (note: is ugly, lacks error checking) and it seems to work - slaves can still connect (they interpret the extra newline as an extra empty old-style command), and hiredis parses the SYNC output properly:

diff --git a/src/replication.c b/src/replication.c
index 36afd83..61f3876 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -259,6 +259,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) {
     }
     slave->repldboff += nwritten;
     if (slave->repldboff == slave->repldbsize) {
+        write(fd,"\r\n",2);
         close(slave->repldbfd);
         slave->repldbfd = -1;
         aeDeleteFileEvent(server.el,slave->fd,AE_WRITABLE);

Are there any reasons against fixing this in upstream Redis?