[PATCH] Updated patch to rsync for Stratus VOS

Paul_GreenVOS at vos.stratus.com Paul_GreenVOS at vos.stratus.com
Wed Nov 20 13:08:01 EST 2002


This is an updated version of my patches to get rsync to build
and run its tests on the Stratus VOS operating system.

I have updated this patch to apply cleanly to the current copy
of HEAD.  I also ran the test suite and discovered that I needed
to tweak a few spots in the Makefile to append the executable
suffix (VOS is one of the few systems that has a required
executable suffix).  There are a few tests we do not pass, and
eventually I may submit further patches to fix them.  But for
now, this patch is sufficient.

There is perhaps one other change that is "interesting".  Unlike
Unix, VOS does not allow the sharp sign (#) in file names.
Thus, I had to change the install-sh script to use a different
character to create its temporary file name.  I picked
underscore.  I know of no reason why this is not an appropriate
alternative, but if the maintainers disagree, please let me
know, and we can work on a different fix.  (If you stick to the
POSIX portable character set, you will be okay).

The other changes, as before, as mostly to use POSIX rather than
Unix data types, and to work on systems that don't yet implement
IPv6.

Lastly, please update the copies of config.guess and config.sub
to the current versions.  VOS is handled by the current versions
of these standard files, but not by the old versions that are
still part of rsync.

This patch was tested by me here on VOS.  I know of no reason
why these changs should not be safe on all other POSIX or Unix
systems.

My official email address is Paul.Green at stratus.com; I use this
one when sending patches because I know they won't get wrapped.

### START OF PATCH ###

diff -urp oldrsync/Makefile.in newrsync/Makefile.in
--- oldrsync/Makefile.in	Sun Nov 17 05:00:41 2002
+++ newrsync/Makefile.in	Wed Nov 20 07:18:37 2002
@@ -9,6 +9,8 @@ mandir=@mandir@
 LIBS=@LIBS@
 CC=@CC@
 CFLAGS=@CFLAGS@
+CPPFLAGS=@CPPFLAGS@
+EXEEXT=@EXEEXT@
 LDFLAGS=@LDFLAGS@
 
 INSTALLCMD=@INSTALL@
@@ -41,21 +43,21 @@ OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON
 TLS_OBJ = tls.o syscall.o lib/permstring.o 
 
 # Programs we must have to run the test cases
-CHECK_PROGS = rsync tls getgroups trimslash t_unsafe
+CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) trimslash$(EXEEXT) t_unsafe$(EXEEXT)
 
 # note that the -I. is needed to handle config.h when using VPATH
 .c.o:
 @OBJ_SAVE@
-	$(CC) -I. -I$(srcdir) $(CFLAGS) -c $< @CC_SHOBJ_FLAG@
+	$(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
 @OBJ_RESTORE@
 
-all: rsync
+all: rsync$(EXEEXT)
 
 man: rsync.1 rsyncd.conf.5
 
 install: all
 	-mkdir -p ${DESTDIR}${bindir}
-	${INSTALLCMD} ${STRIP} -m 755 rsync ${DESTDIR}${bindir}
+	${INSTALLCMD} ${STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
 	-mkdir -p ${DESTDIR}${mandir}/man1
 	-mkdir -p ${DESTDIR}${mandir}/man5
 	${INSTALLMAN} -m 644 $(srcdir)/rsync.1 ${DESTDIR}${mandir}/man1
@@ -64,24 +66,24 @@ install: all
 install-strip:
 	$(MAKE) STRIP='-s' install
 
-rsync: $(OBJS)
+rsync$(EXEEXT): $(OBJS)
 	@echo "Please ignore warnings below about mktemp -- it is used in a safe way"
-	$(CC) $(CFLAGS) $(LDFLAGS) -o rsync $(OBJS) $(LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
 
 $(OBJS): config.h
 
-tls: $(TLS_OBJ)
+tls$(EXEEXT): $(TLS_OBJ)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
 
-getgroups: getgroups.o
+getgroups$(EXEEXT): getgroups.o
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
 
 TRIMSLASH_OBJ = trimslash.o syscall.o
-trimslash: $(TRIMSLASH_OBJ)
+trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
 
 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o t_stub.o lib/compat.o lib/snprintf.o
-t_unsafe: $(T_UNSAFE_OBJ)
+t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
 
 # I don't like these rules because CVS can skew the timestamps and
@@ -106,7 +108,7 @@ proto:
 	cat $(srcdir)/*.c $(srcdir)/lib/compat.c | awk -f $(srcdir)/mkproto.awk > $(srcdir)/proto.h
 
 clean: cleantests
-	rm -f *~ $(OBJS) rsync $(TLS_OBJ) $(CHECK_PROGS)
+	rm -f *~ $(OBJS) $(TLS_OBJ) $(CHECK_PROGS)
 
 cleantests:
 	rm -rf ./testtmp*
@@ -151,14 +153,14 @@ test: check
 # might lose in the future where POSIX diverges from old sh.
 
 check: all $(CHECK_PROGS)
-	POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin=`pwd`/rsync srcdir="$(srcdir)" $(srcdir)/runtests.sh
+	POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin=`pwd`/rsync$(EXEEXT) srcdir="$(srcdir)" $(srcdir)/runtests.sh
 
 # This does *not* depend on building or installing: you can use it to
 # check a version installed from a binary or some other source tree,
 # if you want.
 
 installcheck: $(CHECK_PROGS)
-	POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync" srcdir="$(srcdir)" $(srcdir)/runtests.sh
+	POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
 
 # TODO: Add 'dist' target; need to know which files will be included
 
diff -urp oldrsync/install-sh newrsync/install-sh
--- oldrsync/install-sh	Tue Nov 19 18:57:34 2002
+++ newrsync/install-sh	Tue Nov 19 18:58:11 2002
@@ -208,7 +208,7 @@ else
 
 # Make a temp file name in the proper directory.
 
-	dsttmp=$dstdir/#inst.$$#
+	dsttmp=$dstdir/_inst.$$_
 
 # Move or copy the file name to the temp name
 
diff -urp oldrsync/lib/getaddrinfo.c newrsync/lib/getaddrinfo.c
--- oldrsync/lib/getaddrinfo.c	Sun Nov 17 04:52:57 2002
+++ newrsync/lib/getaddrinfo.c	Sun Nov 17 05:05:28 2002
@@ -73,9 +73,9 @@ static const char in6_loopback[] = {
 };
 
 struct sockinet {
-	u_char	si_len;
-	u_char	si_family;
-	u_short	si_port;
+	uchar_t	si_len;
+	uchar_t	si_family;
+	ushort_t	si_port;
 };
 
 static struct afd {
@@ -223,7 +223,7 @@ getaddrinfo(hostname, servname, hints, r
 	char pton[PTON_MAX];
 	struct addrinfo ai;
 	struct addrinfo *pai;
-	u_short port;
+	ushort_t port;
 
 #ifdef FAITH
 	static int firsttime = 1;
@@ -395,7 +395,7 @@ getaddrinfo(hostname, servname, hints, r
 	/* hostname as numeric name */
 	for (i = 0; afdl[i].a_af; i++) {
 		if (inet_pton(afdl[i].a_af, hostname, pton)) {
-			u_long v4a;
+			ulong_t v4a;
 
 			switch (afdl[i].a_af) {
 			case AF_INET:
@@ -520,7 +520,7 @@ get_addr(hostname, af, res, pai, port0)
 	struct addrinfo *pai;
 	int port0;
 {
-	u_short port = port0 & 0xffff;
+	ushort_t port = port0 & 0xffff;
 	struct addrinfo sentinel;
 	struct hostent *hp;
 	struct addrinfo *top, *cur;
diff -urp oldrsync/lib/getnameinfo.c newrsync/lib/getnameinfo.c
--- oldrsync/lib/getnameinfo.c	Sun Nov 17 04:52:31 2002
+++ newrsync/lib/getnameinfo.c	Tue Nov 19 12:37:13 2002
@@ -85,11 +85,10 @@ getnameinfo(sa, salen, host, hostlen, se
 	struct afd *afd;
 	struct servent *sp;
 	struct hostent *hp;
-	u_short port;
+	ushort_t port;
 	int family, i;
 	char *addr, *p;
-	u_long v4a;
-	u_char pfx;
+	ulong_t v4a;
 	int h_error;
 	char numserv[512];
 	char numaddr[512];
@@ -143,10 +142,13 @@ getnameinfo(sa, salen, host, hostlen, se
 		break;
 #ifdef INET6
 	case AF_INET6:
+	{
+		uchar_t pfx;
 		pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[0];
 		if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
 			flags |= NI_NUMERICHOST;
 		break;
+	}
 #endif
 	}
 	if (host == NULL || hostlen == 0) {
diff -urp oldrsync/lib/inet_pton.c newrsync/lib/inet_pton.c
--- oldrsync/lib/inet_pton.c	Tue Aug 27 14:45:14 2002
+++ newrsync/lib/inet_pton.c	Sun Nov 17 04:59:35 2002
@@ -27,10 +27,12 @@
  */
 
 static int inet_pton4(const char *src, unsigned char *dst);
+#ifdef INET6
 static int inet_pton6(const char *src, unsigned char *dst);
+#endif
 
 /* int
- * isc_net_pton(af, src, dst)
+ * inet_pton(af, src, dst)
  *	convert from presentation format (which usually means ASCII printable)
  *	to network format (which is usually some kind of binary format).
  * return:
diff -urp oldrsync/lib/permstring.c newrsync/lib/permstring.c
--- oldrsync/lib/permstring.c	Tue Aug 27 10:05:47 2002
+++ newrsync/lib/permstring.c	Sun Nov 17 04:58:47 2002
@@ -47,8 +47,10 @@ void permstring(char *perms,
 	if (mode & S_ISGID)
 		perms[6] = (mode & S_IXGRP) ? 's' : 'S';
 	
+#ifdef S_ISVTX
 	if (mode & S_ISVTX)
 		perms[9] = (mode & S_IXOTH) ? 't' : 'T';
+#endif
 		
 	if (S_ISLNK(mode)) perms[0] = 'l';
 	if (S_ISDIR(mode)) perms[0] = 'd';
diff -urp oldrsync/rsync.h newrsync/rsync.h
--- oldrsync/rsync.h	Sun Nov 17 05:00:06 2002
+++ newrsync/rsync.h	Sun Nov 17 05:00:19 2002
@@ -331,6 +331,10 @@ enum logcode {FNONE=0, FERROR=1, FINFO=2
 #define INADDR_NONE 0xffffffff
 #endif
 
+#ifndef IN_LOOPBACKNET
+#define IN_LOOPBACKNET 127
+#endif
+
 struct file_struct {
 	unsigned flags;
 	time_t modtime;
@@ -615,7 +619,7 @@ inet_ntop(int af, const void *src, char 
 #endif /* !HAVE_INET_NTOP */
 
 #ifndef HAVE_INET_PTON
-int isc_net_pton(int af, const char *src, void *dst);
+int inet_pton(int af, const char *src, void *dst);
 #endif
 
 #ifdef MAINTAINER_MODE

### END OF PATCH ###

Thanks
PG
--
Paul Green                  | Mail: Paul.Green at stratus.com
Senior Technical Consultant | Voice: +1 978-461-7557   FAX: +1 978-461-3610
Stratus Technologies        | Video: PictureTel/AT&T by request.
Maynard, MA  01754          | Disclaimer: I speak for myself, not Stratus.





More information about the rsync mailing list