[Bug 2455] New: rsync --daemon segfaults if "log file = <file>" dir does not exist

samba-bugs at samba.org samba-bugs at samba.org
Tue Mar 15 19:58:40 GMT 2005


https://bugzilla.samba.org/show_bug.cgi?id=2455

           Summary: rsync --daemon segfaults if "log file = <file>" dir does
                    not exist
           Product: rsync
           Version: 2.6.3
          Platform: Sparc
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P3
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: rsync at baldwin.users.panix.com
         QAContact: rsync-qa at samba.org


# ./rsync --version
rsync  version 2.6.2  protocol version 28
[etc. ... same bug with 2.6.3 and others]
# ./rsync --daemon --no-detach
Segmentation Fault(coredump)
# grep log /etc/rsyncd.conf
log file = /var/rsyncd/rsyncd.log
syslog facility = daemon
# ls -l /var/rsyncd
/var/rsyncd: No such file or directory
# mkdir /var/rsyncd
# ./rsync --daemon --no-detach
(runs great)

This was mystifying and required truss and/or gdb to figure out.

I added some code for a new category of error, a printed error message and a
proper error-exit.  Here is the context diff of the changes; I hope this is helpful:

Common subdirectories: rsync-2.6.3/doc and rsync-2.6.3_jdb/doc
diff -c rsync-2.6.3/errcode.h rsync-2.6.3_jdb/errcode.h
*** rsync-2.6.3/errcode.h       Mon Dec 15 08:04:14 2003
--- rsync-2.6.3_jdb/errcode.h   Tue Mar 15 19:36:28 2005
***************
*** 42,48 ****
  #define RERR_VANISHED   24      /* file(s) vanished on sender side */
  
  #define RERR_TIMEOUT    30      /* timeout in data send/receive */
! 
  /* Although it doesn't seem to be specified anywhere,
   * ssh and the shell seem to return these values:
   *
--- 42,49 ----
  #define RERR_VANISHED   24      /* file(s) vanished on sender side */
  
  #define RERR_TIMEOUT    30      /* timeout in data send/receive */
! #define RERR_LOG_NOTOPENED 31   /* logfile could not be opened for appending */
!       
  /* Although it doesn't seem to be specified anywhere,
   * ssh and the shell seem to return these values:
   *
Common subdirectories: rsync-2.6.3/lib and rsync-2.6.3_jdb/lib
diff -c rsync-2.6.3/log.c rsync-2.6.3_jdb/log.c
*** rsync-2.6.3/log.c   Sun Sep  5 21:30:00 2004
--- rsync-2.6.3_jdb/log.c       Tue Mar 15 19:47:19 2005
***************
*** 63,68 ****
--- 63,69 ----
        { RERR_PARTIAL    , "some files could not be transferred" },
        { RERR_VANISHED   , "some files vanished before they could be
transferred" },
        { RERR_TIMEOUT    , "timeout in data send/receive" },
+       { RERR_LOG_NOTOPENED, "log file could not be opened" },
        { RERR_CMD_FAILED , "remote shell failed" },
        { RERR_CMD_KILLED , "remote shell killed" },
        { RERR_CMD_RUN,     "remote command could not be run" },
***************
*** 89,96 ****
  static void logit(int priority, char *buf)
  {
        if (logfname) {
!               if (!logfile)
                        log_open();
                fprintf(logfile,"%s [%d] %s",
                        timestring(time(NULL)), (int)getpid(), buf);
                fflush(logfile);
--- 90,103 ----
  static void logit(int priority, char *buf)
  {
        if (logfname) {
!               if (!logfile)     /* Try opening log file for appending */
                        log_open();
+ 
+               if (!logfile) {   /* log file is still not open for some reason */
+                       printf("ERROR: log file %s cannot be opened for
append\n", logfname);
+                       exit_cleanup(RERR_LOG_NOTOPENED);
+               }
+ 
                fprintf(logfile,"%s [%d] %s",
                        timestring(time(NULL)), (int)getpid(), buf);
                fflush(logfile);
Common subdirectories: rsync-2.6.3/packaging and rsync-2.6.3_jdb/packaging
Common subdirectories: rsync-2.6.3/patches and rsync-2.6.3_jdb/patches
Common subdirectories: rsync-2.6.3/popt and rsync-2.6.3_jdb/popt
diff -c rsync-2.6.3/rsync.yo rsync-2.6.3_jdb/rsync.yo
*** rsync-2.6.3/rsync.yo        Thu Sep 30 16:35:56 2004
--- rsync-2.6.3_jdb/rsync.yo    Tue Mar 15 19:36:23 2005
***************
*** 1389,1394 ****
--- 1389,1395 ----
  dit(bf(23)) Partial transfer due to error
  dit(bf(24)) Partial transfer due to vanished source files
  dit(bf(30)) Timeout in data send/receive 
+ dit(bf(31)) Log file could not be opened for appending
  enddit()
  
  manpagesection(ENVIRONMENT VARIABLES)
Common subdirectories: rsync-2.6.3/testhelp and rsync-2.6.3_jdb/testhelp
Common subdirectories: rsync-2.6.3/testsuite and rsync-2.6.3_jdb/testsuite
Common subdirectories: rsync-2.6.3/zlib and rsync-2.6.3_jdb/zlib

-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the rsync mailing list