diff --git a/.gitignore b/.gitignore index 1d2e2e1..e2d6fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -cpdup-1.14.tgz +/cpdup-1.17.tgz diff --git a/Makefile.linux b/Makefile.linux index 8a62832..acc844b 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -4,9 +4,9 @@ BINDIR=${PREFIX}/bin MANDIR=${PREFIX}/share/man build: - ${CC} ${CFLAGS} -D__cpdup_unused= -D_GNU_SOURCE -D__USE_FILE_OFFSET64 \ + ${CC} ${CFLAGS} -D__sun -D_GNU_SOURCE -D__USE_FILE_OFFSET64 \ -DNOMD5 -c *.c - ${CC} ${CFLAGS} -D__cpdup_unused= -D_GNU_SOURCE -D__USE_FILE_OFFSET64 \ + ${CC} ${CFLAGS} -D__sun -D_GNU_SOURCE -D__USE_FILE_OFFSET64 \ -DNOMD5 *.o -o cpdup install: diff --git a/cpdup-1.14-typos.patch b/cpdup-1.14-typos.patch deleted file mode 100644 index 9d32b3e..0000000 --- a/cpdup-1.14-typos.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- cpdup/cpdup.1.typos 2009-01-09 19:54:00.000000000 -0500 -+++ cpdup/cpdup.1 2009-08-22 06:44:14.670245706 -0400 -@@ -51,7 +51,7 @@ - The - .Nm - utility makes an exact mirror copy of the source in the destination, creating --and deleting files and directories as necessary. UTimes, hardlinks, -+and deleting files and directories as necessary. Utimes, hardlinks, - softlinks, devices, permissions, and flags are mirrored. By default, - .Nm - asks for confirmation if any file or directory needs to be removed from -@@ -119,7 +119,7 @@ - .It Fl o - Do not remove any files, just overwrite/add. - .It Fl m --Generate and maintain a MD5 checkfile in each directory on the source -+Generate and maintain an MD5 checkfile in each directory on the source - and do an MD5 check on each file of the destination when the destination - appears to be the same as the source. If the check fails, - .Nm -@@ -162,7 +162,7 @@ - must record the paths for all files it encounters while it operates - and it is possible that you may run the process out of memory. - .Pp --The file found vi the hardlink path will be byte-by-byte compared with the -+The file found via the hardlink path will be byte-by-byte compared with the - source if the - .Fl V - or -@@ -186,7 +186,7 @@ - into slave mode and is used to initiate the slave protocol on a remote - machine. - .It Fl k --Generate and maintain a FSMID checkfile called .FSMID.CHECK in each -+Generate and maintain an FSMID checkfile called .FSMID.CHECK in each - directory on the target. - .Nm - will check the FSMID for each source file or directory against the checkfile diff --git a/cpdup-1.17-glibc.patch b/cpdup-1.17-glibc.patch new file mode 100644 index 0000000..7084ba2 --- /dev/null +++ b/cpdup-1.17-glibc.patch @@ -0,0 +1,53 @@ +--- cpdup/compat_sun.c.glibc 2010-07-19 21:11:48.000000000 +0200 ++++ cpdup/compat_sun.c 2010-11-02 19:22:14.660562440 +0100 +@@ -5,38 +5,6 @@ + #include "compat_sun.h" + #include + +-int +-vasprintf(char **str, const char *format, va_list ap) +-{ +- char *newstr; +- char dummy[2]; +- int result; +- +- if ((result = vsnprintf(dummy, 2, format, ap)) < 0) { +- *str = NULL; +- return (result); +- } +- if ((*str = malloc(result + 1)) == NULL) +- return (-1); +- if ((result = vsnprintf(*str, result + 1, format, ap)) < 0) { +- free(*str); +- *str = NULL; +- } +- return (result); +-} +- +-int +-asprintf(char **str, const char *format, ...) +-{ +- va_list ap; +- int result; +- +- va_start(ap, format); +- result = vasprintf(str, format, ap); +- va_end(ap); +- return (result); +-} +- + #ifndef NOMD5 + + #include +--- cpdup/compat_sun.h.glibc 2010-07-05 20:02:07.000000000 +0200 ++++ cpdup/compat_sun.h 2010-11-02 19:21:51.302922733 +0100 +@@ -4,8 +4,7 @@ + #include + #include + +-int vasprintf(char **str, const char *format, va_list ap); +-int asprintf(char **str, const char *format, ...); ++size_t strlcpy(char *dst, const char *src, size_t size); + + #ifndef NOMD5 + diff --git a/cpdup-1.17-typos.patch b/cpdup-1.17-typos.patch new file mode 100644 index 0000000..8abc0ec --- /dev/null +++ b/cpdup-1.17-typos.patch @@ -0,0 +1,20 @@ +--- cpdup/cpdup.1.typos 2010-07-19 21:19:25.000000000 +0200 ++++ cpdup/cpdup.1 2010-11-02 18:47:25.992778554 +0100 +@@ -40,7 +40,7 @@ + The + .Nm + utility makes an exact mirror copy of the source in the destination, creating +-and deleting files and directories as necessary. UTimes, hardlinks, ++and deleting files and directories as necessary. utimes, hardlinks, + softlinks, devices, permissions, and flags are mirrored. By default, + .Nm + asks for confirmation if any file or directory needs to be removed from +@@ -118,7 +118,7 @@ + .It Fl o + Do not remove any files, just overwrite/add. + .It Fl m +-Generate and maintain a MD5 checkfile called ++Generate and maintain an MD5 checkfile called + .Pa \&.MD5.CHECKSUMS + in each directory on the source + and do an MD5 check on each file of the destination when the destination diff --git a/cpdup.spec b/cpdup.spec index 55c12ce..24ef705 100644 --- a/cpdup.spec +++ b/cpdup.spec @@ -1,5 +1,5 @@ Name: cpdup -Version: 1.14 +Version: 1.17 Release: 1%{?dist} Summary: Filesystem mirroring utility @@ -7,10 +7,11 @@ Group: Applications/Archiving License: BSD URL: http://apollo.backplane.com/FreeSrc/ Source0: http://apollo.backplane.com/FreeSrc/cpdup-%{version}.tgz -Source1: Makefile.linux +Source1: strlcpy.c +Source2: Makefile.linux Patch0: cpdup-1.14-gcc44.patch -Patch1: cpdup-1.11-unused.patch -Patch2: cpdup-1.14-typos.patch +Patch1: cpdup-1.17-typos.patch +Patch2: cpdup-1.17-glibc.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) #BuildRequires: @@ -31,19 +32,24 @@ destination directory with a file. %prep %setup -q -n %{name} +cp -p %{SOURCE1} . %patch0 -p1 -b .gcc44 -%patch1 -p1 -b .unused -%patch2 -p1 -b .typos -rm md5.c +%patch1 -p1 -b .typos +%patch2 -p1 -b .glibc +# we don't want this to get compiled +mv md5.c{,.off} +# make scripts non-executable for cleanliness +chmod -x scripts/* + %build -make %{?_smp_mflags} CFLAGS="${RPM_OPT_FLAGS}" -f %{SOURCE1} +make %{?_smp_mflags} CFLAGS="${RPM_OPT_FLAGS}" -f %{SOURCE2} %install rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT -f %{SOURCE1} +make install DESTDIR=$RPM_BUILD_ROOT -f %{SOURCE2} %clean @@ -52,13 +58,16 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%doc BACKUPS +%doc BACKUPS PORTING scripts %{_bindir}/* %{_mandir}/man1/* %changelog +* Tue Nov 2 2010 Michel Salim - 1.17-1 +- Update to 1.17 + * Sat Aug 22 2009 Michel Salim - 1.14-1 - Update to 1.14 diff --git a/sources b/sources index f4f0fa0..0609dd8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -872f41683dd0f6d32bff111e22ad50f7 cpdup-1.14.tgz +ca28bc9426049efe8ad761831487a244 cpdup-1.17.tgz diff --git a/strlcpy.c b/strlcpy.c new file mode 100644 index 0000000..b5ada2d --- /dev/null +++ b/strlcpy.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1998 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ + * $FreeBSD: src/lib/libc/string/strlcpy.c,v 1.10 2008/10/19 10:11:35 delphij Exp $ + * $DragonFly: src/lib/libc/string/strlcpy.c,v 1.4 2005/09/18 16:32:34 asmodai Exp $ + */ + +#include +#include + +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +size_t +strlcpy(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0) { + while (--n != 0) { + if ((*d++ = *s++) == '\0') + break; + } + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +}