2.5.6: a number of minor issues

der Mouse mouse at Rodents.Montreal.QC.CA
Wed Oct 8 20:03:55 EST 2003


I just picked up rsync 2.5.6 and installed it.  I haven't actually
_used_ it for anything yet; this is entirely about a handful of minor
issues I noticed while building it.  You may care or you may not; for
simplicity of language (to avoid many repeated "in case you care" and
such), the text below is written assuming you care about them all.

On a (32-bit) SPARC system, I noticed:

The code prints size_t values with %d.  This is always wrong with
respect to signedness and often wrong with respect to size.

Several routines have unused arguments with, in most cases, no obvious
reason for their presence.

Here are patches to fix the printf mistakes and shut the compiler
warnings up about the unused arguments.

--- OLD/clientname.c	Thu Jan  1 00:00:00 1970
+++ NEW/clientname.c	Thu Jan  1 00:00:00 1970
@@ -277,8 +277,8 @@
 
 		if (ai->ai_addrlen < sizeof(struct sockaddr_in6)) {
 			rprintf(FERROR,
-				"%s: too short sockaddr_in6; length=%d\n",
-				fn, ai->ai_addrlen);
+				"%s: too short sockaddr_in6; length=%lu\n",
+				fn, (unsigned long int) ai->ai_addrlen);
 			return 1;
 		}
 
--- OLD/generator.c	Thu Jan  1 00:00:00 1970
+++ NEW/generator.c	Thu Jan  1 00:00:00 1970
@@ -189,8 +189,8 @@
 
 		if (verbose > 3) {
 			rprintf(FINFO,
-				"chunk[%d] offset=%.0f len=%d sum1=%08lx\n",
-				i, (double) offset, n1, (unsigned long) sum1);
+				"chunk[%lu] offset=%.0f len=%d sum1=%08lx\n",
+				(unsigned long int) i, (double) offset, n1, (unsigned long) sum1);
 		}
 		write_int(f_out, sum1);
 		write_buf(f_out, sum2, csum_length);
--- OLD/io.c	Thu Jan  1 00:00:00 1970
+++ NEW/io.c	Thu Jan  1 00:00:00 1970
@@ -316,8 +316,8 @@
 		}
 
 		if (remaining > sizeof(line) - 1) {
-			rprintf(FERROR, "multiplexing overflow %d\n\n",
-				remaining);
+			rprintf(FERROR, "multiplexing overflow %lu\n\n",
+				(unsigned long int) remaining);
 			exit_cleanup(RERR_STREAMIO);
 		}
 
--- OLD/log.c	Thu Jan  1 00:00:00 1970
+++ NEW/log.c	Thu Jan  1 00:00:00 1970
@@ -582,5 +582,6 @@
 
 	if (!verbose) return;
 
+file=file;
 	rprintf(FINFO, "%s\n", fname);
 }
--- OLD/popt/popt.c	Thu Jan  1 00:00:00 1970
+++ NEW/popt/popt.c	Thu Jan  1 00:00:00 1970
@@ -1058,6 +1058,7 @@
 		/*@unused@*/ int flags)
 {
     poptItem item = (poptItem) alloca(sizeof(*item));
+flags=flags;
     memset(item, 0, sizeof(*item));
     item->option.longName = alias.longName;
     item->option.shortName = alias.shortName;
--- OLD/popt/poptconfig.c	Thu Jan  1 00:00:00 1970
+++ NEW/popt/poptconfig.c	Thu Jan  1 00:00:00 1970
@@ -167,6 +167,7 @@
     if (!con->appName) return 0;
     /*@=type@*/
 
+useEnv=useEnv;
     rc = poptReadConfigFile(con, "/etc/popt");
     if (rc) return rc;
     if (getuid() != geteuid()) return 0;
--- OLD/popt/popthelp.c	Thu Jan  1 00:00:00 1970
+++ NEW/popt/popthelp.c	Thu Jan  1 00:00:00 1970
@@ -23,6 +23,7 @@
 	/*@globals fileSystem@*/
 	/*@modifies fileSystem@*/
 {
+foo=foo; arg=arg; data=data;
     if (key->shortName == '?')
 	poptPrintHelp(con, stdout, 0);
     else
@@ -89,7 +90,7 @@
 	/*@*/
 {
     if (!(opt->argInfo & POPT_ARG_MASK)) return NULL;
-
+translation_domain=translation_domain;
     if (opt == (poptHelpOptions + 1) || opt == (poptHelpOptions + 2))
 	if (opt->argDescrip) return POPT_(opt->argDescrip);
 
@@ -123,6 +124,7 @@
     char * le = malloc(4*lineLength + 1);
     char * l = le;
 
+translation_domain=translation_domain;
     if (le == NULL) return NULL;	/* XXX can't happen */
     *le = '\0';
     *le++ = '(';
@@ -479,6 +481,7 @@
 {
     int leftColWidth;
 
+flags=flags;
     (void) showHelpIntro(con, fp);
     if (con->otherHelp)
 	fprintf(fp, " %s\n", con->otherHelp);
@@ -638,6 +641,7 @@
 {
     int cursor;
 
+flags=flags;
     cursor = showHelpIntro(con, fp);
     cursor += showShortOptions(con->options, fp, NULL);
     (void) singleTableUsage(con, fp, cursor, con->options, NULL);
--- OLD/zlib/inftrees.c	Thu Jan  1 00:00:00 1970
+++ NEW/zlib/inftrees.c	Thu Jan  1 00:00:00 1970
@@ -445,6 +445,8 @@
     ZFREE(z, c);
     fixed_built = 1;
   }
+#else
+  z=z;
 #endif
   *bl = fixed_bl;
   *bd = fixed_bd;

With the above patches, I built it on a peecee (i386 architecture,
actually a K6-2 - still a 32-bit machine).  No warnings.

Then I tried it on an alpha (LP64).  With the above patches, I got

gcc -I. -I. -g -O2 -DHAVE_CONFIG_H -Wall -W -I./popt  -c match.c -o match.o
match.c: In function `hash_search':
"match.c", line 199: warning: comparison between signed and unsigned
"match.c", line 235: warning: comparison between signed and unsigned
"match.c", line 265: warning: comparison between signed and unsigned

These appear to come from applying MIN to a size_t and the difference
of two off_ts (of which the former is unsigned and the latter is
signed); these didn't show up on the sparc and i386 machines because
off_t is signed 64-bit and size_t is unsigned 32, there, so the
promotion of size_t to 64-bit also made it signed, which papered over
the issue - but on the alpha, size_t is unsigned 64-bit and there's no
promotion involved.

I'm not including patches to fix these last warnings since, in contrast
to the warnings I did give fixes for, it's not immediately obvious what
the right fix is.

I also note some manpage bugs.  There are a few cosmetic issues which
aren't really _bugs_, such as a lot of lines having trailing
whitespace, the mysterious use of \& before most (but not quite all)
dots in the files, and gratuitous \s before most 's.  I'm ignoring
those, since they don't affect the output.

But there are a few obvious content mistakes.  Here are patches for
them.

--- OLD/rsync.1	Thu Jan  1 00:00:00 1970
+++ NEW/rsync.1	Thu Jan  1 00:00:00 1970
@@ -53,7 +53,7 @@
 .PP 
 .IP o 
 for copying local files\&. This is invoked when neither
-source nor destination path contains a : separator
+source nor destination path contains a : separator.
 .IP 
 .IP o 
 for copying from the local machine to a remote machine using
@@ -288,11 +288,11 @@
 .RS 
 get:
 .br 
-rsync -avuzb --exclude \'*~\' samba:samba/ \&.
+\ \ \ \ \ \ \ \ rsync -avuzb --exclude \'*~\' samba:samba/ \&.
 .PP 
 put:
 .br 
-rsync -Cavuzb \&. samba:samba/
+\ \ \ \ \ \ \ \ rsync -Cavuzb \&. samba:samba/
 .PP 
 sync: get put
 .RE 
@@ -348,7 +348,7 @@
  -e, --rsh=COMMAND           specify the remote shell to use
      --rsync-path=PATH       specify path to rsync on the remote machine
  -C, --cvs-exclude           auto ignore files in the same way CVS does
-     --existing              only update files that already exist
+     --existing              update only files that already exist
      --ignore-existing       ignore files that already exist on the receiving side
      --delete                delete files that don\'t exist on the sending side
      --delete-excluded       also delete excluded files on the receiving side
@@ -360,7 +360,7 @@
      --numeric-ids           don\'t map uid/gid values by user/group name
      --timeout=TIME          set IO timeout in seconds
  -I, --ignore-times          don\'t exclude files that match length and time
-     --size-only             only use file size when determining if a file should be transferred
+     --size-only             use only file size when determining if a file should be transferred
      --modify-window=NUM     Timestamp window (seconds) for file match (default=0)
  -T  --temp-dir=DIR          create temporary files in directory DIR
      --compare-dest=DIR      also compare destination files relative to DIR
@@ -375,8 +375,8 @@
      --daemon                run as a rsync daemon
      --no-detach             do not detach from the parent
      --address=ADDRESS       bind to the specified address
-     --config=FILE           specify alternate rsyncd\&.conf file
-     --port=PORT             specify alternate rsyncd port number
+     --config=FILE           specify alternative rsyncd\&.conf file
+     --port=PORT             specify alternative rsyncd port number
      --blocking-io           use blocking IO for the remote shell
      --no-blocking-io        turn off --blocking-io
      --stats                 give some file transfer stats
@@ -544,7 +544,7 @@
 the  remote system  to  be the same as the local system\&. Without this
 option hard links are treated like regular files\&.
 .IP 
-Note that rsync can only detect hard links if both parts of the link
+Note that rsync can detect hard links only if both parts of the link
 are in the list of files being sent\&.
 .IP 
 This option can be quite slow, so only use it if you need it\&.
@@ -577,7 +577,7 @@
 destination file to be the same as the source file\&.  If the receiving
 program is not running as the super-user, only groups that the
 receiver is a member of will be preserved (by group name, not group id
-number)\&.
+number, unless --numeric-ids is given)\&.
 .IP 
 .IP "\fB-D, --devices\fP" 
 This option causes rsync to transfer character and
@@ -612,7 +612,7 @@
 .IP 
 .IP "\fB--existing\fP" 
 This tells rsync not to create any new files -
-only update files that already exist on the destination\&.
+update only files that already exist on the destination\&.
 .IP 
 .IP "\fB--ignore-existing\fP" 
 This tells rsync not to update files that already exist on 
@@ -659,7 +659,7 @@
 .IP "\fB--force\fP" 
 This options tells rsync to delete directories even if
 they are not empty when they are to be replaced by non-directories\&.  This
-is only relevant without --delete because deletions are now done depth-first\&.
+is relevant only without --delete because deletions are now done depth-first\&.
 Requires the --recursive option (which is implied by -a) to have any effect\&.
 .IP 
 .IP "\fB-B , --block-size=BLOCKSIZE\fP" 
@@ -686,7 +686,7 @@
 -e "ssh -p 2234"
 .RE 
 .IP 
-(Note that ssh users can alternately customize site-specific connect
+(Note that ssh users can alternatively customize site-specific connect
 options in their \&.ssh/config file\&.)
 .IP 
 You can also choose the remote shell program using the RSYNC_RSH
@@ -769,8 +769,8 @@
 .IP 
 Current versions of rsync actually use an adaptive algorithm for the
 checksum length by default, using a 16 byte file checksum to determine
-if a 2nd pass is required with a longer block checksum\&. Only use this
-option if you have read the source code and know what you are doing\&.
+if a 2nd pass is required with a longer block checksum\&. Use this
+option only if you have read the source code and know what you are doing\&.
 .IP 
 .IP "\fB-T, --temp-dir=DIR\fP" 
 This option instructs rsync to use DIR as a
@@ -852,20 +852,20 @@
 .IP 
 .IP "\fB--address\fP" 
 By default rsync will bind to the wildcard address
-when run as a daemon with the --daemon option or when connecting to a
+when run as a daemon with the --daemon option or when connecting to an
 rsync server\&. The --address option allows you to specify a specific IP
 address (or hostname) to bind to\&. This makes virtual hosting possible
 in conjunction with the --config option\&.
 .IP 
 .IP "\fB--config=FILE\fP" 
-This specifies an alternate config file than
-the default\&.  This is only relevant when --daemon is specified\&. 
+This specifies an alternative config file than
+the default\&.  This is relevant only when --daemon is specified\&. 
 The default is /etc/rsyncd\&.conf unless the daemon is running over
 a remote shell program and the remote user is not root; in that case
 the default is rsyncd\&.conf in the current directory (typically $HOME)\&.
 .IP 
 .IP "\fB--port=PORT\fP" 
-This specifies an alternate TCP port number to use
+This specifies an alternative TCP port number to use
 rather than the default port 873\&.
 .IP 
 .IP "\fB--blocking-io\fP" 
@@ -914,7 +914,7 @@
 .IP "\fB--password-file\fP" 
 This option allows you to provide a password
 in a file for accessing a remote rsync server\&. Note that this option
-is only useful when accessing a rsync server using the built in
+is useful only when accessing a rsync server using the built in
 transport, not when using a remote shell as the transport\&. The file
 must not be world readable\&. It should contain just the password as a
 single line\&.
@@ -988,7 +988,7 @@
 if the pattern contains a / (not counting a trailing /) then it
 is matched against the full filename, including any leading
 directory\&. If the pattern doesn\'t contain a / then it is matched
-only against the final component of the filename\&.  Again, remember
+against only the final component of the filename\&.  Again, remember
 that the algorithm is applied recursively so "full filename" can 
 actually be any portion of a path\&.
 .IP 
@@ -1072,7 +1072,7 @@
 .PP 
 The \&.rsync_argvs file contains a command-line suitable for updating a
 destination tree using that batch update fileset\&. It can be executed
-using a Bourne(-like) shell, optionally passing in an alternate
+using a Bourne(-like) shell, optionally passing in an alternative
 destination tree pathname which is then used instead of the original
 path\&. This is useful when the destination tree path differs from the
 original destination tree path\&.
@@ -1171,7 +1171,7 @@
 .nf 
  
 
-   rsh remotehost /bin/true > out\&.dat
+   rsh remotehost true > out\&.dat
 
 .fi 
  
--- OLD/rsyncd.conf.5	Thu Jan  1 00:00:00 1970
+++ NEW/rsyncd.conf.5	Thu Jan  1 00:00:00 1970
@@ -250,7 +250,7 @@
 .IP "\fBsecrets file\fP" 
 The "secrets file" option specifies the name of
 a file that contains the username:password pairs used for
-authenticating this module\&. This file is only consulted if the "auth
+authenticating this module\&. This file is consulted only if the "auth
 users" option is specified\&. The file is line based and contains
 username:password pairs separated by a single colon\&. Any line starting
 with a hash (#) is considered a comment and is skipped\&. The passwords
@@ -397,7 +397,7 @@
 .IP 
 .IP "\fBtimeout\fP" 
 The "timeout" option allows you to override the
-clients choice for IO timeout for this module\&. Using this option you
+client's choice for IO timeout for this module\&. Using this option you
 can ensure that rsync won\'t wait on a dead client forever\&. The timeout
 is specified in seconds\&. A value of zero means no timeout and is the
 default\&. A good choice for anonymous rsync servers may be 600 (giving

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse at rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B



More information about the rsync mailing list