Compare commits

..
19 Commits
Author SHA1 Message Date
Joachim Wiberg 34097d33b6 Update changelog and bump version for v2.5.3 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 07:05:58 +02:00
Joachim Wiberg 311288eec9 test: major refactor and cleanup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 06:51:25 +02:00
Joachim Wiberg 63cf8867c5 test: refactor, each test in separate func
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 06:00:47 +02:00
Joachim Wiberg ac7b4194cf Fix copyfile() regression introduced in 4e9b5c13
Caught in release cycle.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 05:55:48 +02:00
Joachim Wiberg e44aaa4fd5 test: slight refactor to add diff -q A B check to fcopyfile()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 05:55:48 +02:00
Joachim Wiberg 97cb2cb87c test: reproduce copyfile() off by one regression
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-08 05:55:39 +02:00
Joachim Wiberg 837c3f23be Prepare for v2.5.3 bug fix release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 22:20:03 +02:00
Joachim Wiberg 4e9b5c13c1 copyfile: allow copying empty files to non-existing destination dirs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 22:17:47 +02:00
Joachim Wiberg d61b847e55 rsync: fix check for missing dst when dst is a directory
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 22:17:09 +02:00
Joachim Wiberg 90fdcdeb39 rsync: fix return value when copying a single file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 22:16:50 +02:00
Joachim Wiberg e36ac8f462 test: finalize rsync unit test to reproduce bugs
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-04-02 22:16:21 +02:00
Joachim Wiberg eb3bb94cfa Update changelog and bump version for v2.5.2 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 14:19:11 +02:00
Joachim Wiberg 11b9c88732 Add printf format attribute to all vararg functions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-17 14:11:31 +02:00
Joachim Wiberg 11d4aafce1 Merge pull request #20 from yangfl/upstream
Fix for some non-linux
2022-01-27 11:34:50 +01:00
yangfl 5cdc5736f3 Replace mknod() with creat()
For mknod(), mode must be S_IFIFO otherwise the behaviour is unspecified
according to SUS, and apparently Debian/kFreeBSD is in the hater list.
2022-01-27 00:11:00 +08:00
yangfl 059bfd7806 test: use sleep() for mtime delay
For filesystems without high-resolution time support, an usleep() is too short
to alter mtime. Though 1s is quite safe, sleep for 2s in case it gets awaken
right within that second.
2022-01-26 23:57:27 +08:00
yangfl 0cda6339a4 Fix fisdir sigfault on Hurd
Apparently Hurd's stat() does not like NULL and will sigfault, this patch takes
care of it.
2022-01-26 02:11:08 +08:00
Joachim Wiberg 8120492fc8 Update changelogs and bump version for v2.5.1
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-12-02 00:43:02 +01:00
Joachim Wiberg 2065165ae9 debian: use dh_link(1) instead to create /usr/inclute/lite symlink
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-12-02 00:42:19 +01:00
15 changed files with 294 additions and 109 deletions

No files matched your search

+38 -1
View File
@@ -4,6 +4,41 @@ Change Log
All notable changes to the project are documented in this file. All notable changes to the project are documented in this file.
[v2.5.3][] - 2023-04-08
-----------------------
### Changes
- Refactor `copyfile()` unit test and verify number of bytes copied
- Add missing `rsync()` unit test to ensure proper function
### Fixes
- `rsync()` does not copy single files correctly
- `copyfile()` does not handle empty source files correctly (error)
- `copyfile()` does not properly create destination dir
[v2.5.2][] - 2022-04-17
-----------------------
### Changes
- Add printf format attribute hint to all vararg functions. This will
help users of these functions by telling CC what to look for
### Fixes
- Fix `fisdir()` segfault on GNU/Hurd
- Fix `touch)` on Debian/kFreeBSD, use `creat()` instad of `mknod()`
[v2.5.1][] - 2021-12-02
-----------------------
Debian-only fix.
### Fixes
- Use `dh_link(1)` to install `/usr/include/lite -> libite/`. The
symlink created by libite installer itself is not kept.
[v2.5.0][] - 2021-11-30 [v2.5.0][] - 2021-11-30
----------------------- -----------------------
@@ -453,7 +488,9 @@ problems this may cause!
Initial extraction of frog DNA from [Finit][]. See [README][] for API details. Initial extraction of frog DNA from [Finit][]. See [README][] for API details.
[UNRELEASED]: https://github.com/troglobit/libite/compare/v2.4.1...HEAD [UNRELEASED]: https://github.com/troglobit/libite/compare/v2.5.2...HEAD
[v2.5.2]: https://github.com/troglobit/libite/compare/v2.5.1...v2.5.2
[v2.5.1]: https://github.com/troglobit/libite/compare/v2.5.0...v2.5.1
[v2.5.0]: https://github.com/troglobit/libite/compare/v2.4.1...v2.5.0 [v2.5.0]: https://github.com/troglobit/libite/compare/v2.4.1...v2.5.0
[v2.4.1]: https://github.com/troglobit/libite/compare/v2.4.0...v2.4.1 [v2.4.1]: https://github.com/troglobit/libite/compare/v2.4.0...v2.4.1
[v2.4.0]: https://github.com/troglobit/libite/compare/v2.3.1...v2.4.0 [v2.4.0]: https://github.com/troglobit/libite/compare/v2.3.1...v2.4.0
+1 -1
View File
@@ -1,4 +1,4 @@
AC_INIT(libite, 2.5.0, https://github.com/troglobit/libite/issues) AC_INIT(libite, 2.5.3, https://github.com/troglobit/libite/issues)
AC_CONFIG_AUX_DIR(aux) AC_CONFIG_AUX_DIR(aux)
AM_INIT_AUTOMAKE([1.11 foreign dist-xz]) AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
+17
View File
@@ -1,3 +1,20 @@
libite (2.5.3) stable; urgency=medium
* rsync() does not copy single files correctly
* copyfile() does not handle empty source files correctly (error)
* copyfile() does not properly create destination dir
* Add printf format attribute hint to all vararg functions
* Fix fisdir() segfault on GNU/Hurd
* Fix touch() on Debian/kFreeBSD, use creat() instad of mknod()
-- Joachim Wiberg <troglobit@gmail.com> Sat, 08 Apr 2023 07:04:00 +0200
libite (2.5.1) stable; urgency=medium
* Use dh_link(1) to install `/usr/include/lite -> libite/`.
-- Joachim Wiberg <troglobit@gmail.com> Thu, 02 Dec 2021 00:08:41 +0100
libite (2.5.0) stable; urgency=medium libite (2.5.0) stable; urgency=medium
* Header files have moved from `lite/*.h` to `libite/*.h` to prevent * Header files have moved from `lite/*.h` to `libite/*.h` to prevent
-1
View File
@@ -1,5 +1,4 @@
usr/include/libite/*.h usr/include/libite/*.h
usr/include/lite
usr/lib/*/lib*.a usr/lib/*/lib*.a
usr/lib/*/lib*.so usr/lib/*/lib*.so
usr/lib/*/pkgconfig/lib*.pc usr/lib/*/pkgconfig/lib*.pc
+1
View File
@@ -0,0 +1 @@
/usr/include/libite /usr/include/lite
+3
View File
@@ -6,6 +6,9 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%: %:
dh $@ --with autoreconf dh $@ --with autoreconf
override_dh_auto_configure:
dh_auto_configure -- --without-symlink
override_dh_installchangelogs: override_dh_installchangelogs:
dh_installchangelogs ChangeLog.md dh_installchangelogs ChangeLog.md
+1 -1
View File
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libite.la
libite_la_CPPFLAGS = -D_GNU_SOURCE libite_la_CPPFLAGS = -D_GNU_SOURCE
libite_la_CFLAGS = -W -Wall -Wextra libite_la_CFLAGS = -W -Wall -Wextra
libite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 8:1:3 libite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 8:2:3
libite_la_SOURCES = chomp.c copyfile.c \ libite_la_SOURCES = chomp.c copyfile.c \
conio.c conio.h dir.c \ conio.c conio.h dir.c \
erasef.c fopenf.c fremove.c \ erasef.c fopenf.c fremove.c \
+20 -5
View File
@@ -38,6 +38,7 @@ static int adjust_target(const char *src, char **dst)
{ {
int isdir = 0; int isdir = 0;
retry:
if (fisdir(*dst)) { if (fisdir(*dst)) {
int slash = 0; int slash = 0;
char *tmp, *ptr = strrchr(src, '/'); char *tmp, *ptr = strrchr(src, '/');
@@ -58,16 +59,25 @@ static int adjust_target(const char *src, char **dst)
sprintf(tmp, "%s%s%s", *dst, slash ? "" : "/", ptr); sprintf(tmp, "%s%s%s", *dst, slash ? "" : "/", ptr);
*dst = tmp; *dst = tmp;
} else {
struct stat st;
if (stat(*dst, &st) && fisslashdir(*dst)) {
makedir(*dst, 0755);
goto retry;
}
} }
return isdir; return isdir;
} }
/* Actual copy loop, used by both copyfile() and fcopyfile() /*
* breaks loop on error and EOF */ * Actual copy loop, used by both copyfile() and fcopyfile() breaks loop
* on error and EOF
*/
static ssize_t do_copy(int in, int out, size_t num, char *buffer, size_t len) static ssize_t do_copy(int in, int out, size_t num, char *buffer, size_t len)
{ {
ssize_t ret = 0, size = 0; ssize_t ret = 0, size = -1;
do { do {
size_t count = num > len ? len : num; size_t count = num > len ? len : num;
@@ -76,11 +86,16 @@ static ssize_t do_copy(int in, int out, size_t num, char *buffer, size_t len)
if (ret <= 0) { if (ret <= 0) {
if (ret == -1 && EINTR == errno) if (ret == -1 && EINTR == errno)
continue; continue;
if (ret == 0 && size == -1)
size = 0;
break; break;
} }
if (ret > 0) if (ret > 0) {
if (size == -1)
size = 0;
size += write(out, buffer, ret); size += write(out, buffer, ret);
}
num -= count; num -= count;
} while (num > 0); } while (num > 0);
@@ -194,7 +209,7 @@ ssize_t copyfile(const char *src, const char *dst, int len, int opt)
} }
size = do_copy(in, out, num, buffer, BUFSIZ); size = do_copy(in, out, num, buffer, BUFSIZ);
if (!size && errno) if (size < 0)
saved_errno = errno; saved_errno = errno;
else if (keep_mtim) else if (keep_mtim)
set_mtime(in, out); set_mtime(in, out);
+1 -1
View File
@@ -41,7 +41,7 @@ int fisdir(const char *path)
{ {
struct stat sb; struct stat sb;
if (!stat(path, &sb) && S_ISDIR(sb.st_mode)) if (path && !stat(path, &sb) && S_ISDIR(sb.st_mode))
return 1; return 1;
return 0; return 0;
+16 -11
View File
@@ -72,21 +72,21 @@ typedef struct sdbuf sdbuf_t; /**< Opqaue context struct for telnet APIs */
char *chomp (char *str); char *chomp (char *str);
int erasef (const char *fmt, ...); int erasef (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
char *fparseln (FILE *, size_t *, size_t *, const char[3], int); char *fparseln (FILE *, size_t *, size_t *, const char[3], int);
int fexist (const char *file); int fexist (const char *file);
int fisdir (const char *path); int fisdir (const char *path);
FILE *fopenf (const char *mode, const char *fmt, ...); FILE *fopenf (const char *mode, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int fremove (const char *fmt, ...); int fremove (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
FILE *tempfile (void); FILE *tempfile (void);
ssize_t copyfile (const char *src, const char *dst, int len, int opt); ssize_t copyfile (const char *src, const char *dst, int len, int opt);
int movefile (const char *src, const char *dst); int movefile (const char *src, const char *dst);
int fcopyfile (FILE *src, FILE *dst); int fcopyfile (FILE *src, FILE *dst);
ssize_t fsendfile (FILE *src, FILE *dst, size_t len); ssize_t fsendfile (FILE *src, FILE *dst, size_t len);
int truncatef (off_t length, const char *fmt, ...); int truncatef (off_t length, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int ifconfig (const char *ifname, const char *addr, const char *mask, int up); int ifconfig (const char *ifname, const char *addr, const char *mask, int up);
@@ -97,7 +97,7 @@ char *lfgetkey (lfile_t *lf, const char *key);
int lfgetint (lfile_t *lf, const char *key); int lfgetint (lfile_t *lf, const char *key);
int fgetint (const char *file, const char *sep, const char *key); int fgetint (const char *file, const char *sep, const char *key);
int fmkpath (mode_t mode, const char *fmt, ...); int fmkpath (mode_t mode, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
int mkpath (const char *dir, mode_t mode); int mkpath (const char *dir, mode_t mode);
int makepath (const char *dir); int makepath (const char *dir);
@@ -114,16 +114,16 @@ void *reallocarray(void *optr, size_t nmemb, size_t size);
void progress (int percent, int max_width); void progress (int percent, int max_width);
void progress_simple(int percent); void progress_simple(int percent);
int systemf (const char *fmt, ...); int systemf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
sdbuf_t*telnet_open (int addr, short port); sdbuf_t*telnet_open (int addr, short port);
int telnet_close (sdbuf_t *ctx); int telnet_close (sdbuf_t *ctx);
int telnet_expect (sdbuf_t *ctx, char *script[], FILE *output); int telnet_expect (sdbuf_t *ctx, char *script[], FILE *output);
int telnet_session (int addr, short port, char *script[], FILE *output); int telnet_session (int addr, short port, char *script[], FILE *output);
int touchf (const char *fmt, ...); int touchf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int yorn (const char *fmt, ...); int yorn (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
char *which (const char *cmd); char *which (const char *cmd);
int whichp (const char *cmd); int whichp (const char *cmd);
@@ -139,10 +139,15 @@ int whichp (const char *cmd);
*/ */
static inline int touch(const char *path) static inline int touch(const char *path)
{ {
int fd;
if (utimensat(AT_FDCWD, path, NULL, 0)) { if (utimensat(AT_FDCWD, path, NULL, 0)) {
if (errno == ENOENT) if (errno != ENOENT)
return mknod((path), S_IFREG|0644, 0); return -1;
return -1; fd = creat(path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (fd < 0)
return -1;
close(fd);
} }
return 0; return 0;
} }
+5 -3
View File
@@ -77,7 +77,9 @@ int rsync(char *src, char *dst, int opt, int (*filter)(const char *file))
char **files; /* Array of file names. */ char **files; /* Array of file names. */
struct stat st; struct stat st;
if (!fisdir(dst)) errno = 0;
if (stat(dst, &st) && fisslashdir(dst))
makedir(dst, 0755); makedir(dst, 0755);
if (!fisdir(src)) { if (!fisdir(src)) {
@@ -85,9 +87,9 @@ int rsync(char *src, char *dst, int opt, int (*filter)(const char *file))
return 1; return 1;
if (copy(src, dst, keep_mtim)) if (copy(src, dst, keep_mtim))
result++; return 1;
return errno; return 0;
} }
/* Copy dir as well? */ /* Copy dir as well? */
+124 -48
View File
@@ -2,54 +2,130 @@
#include <errno.h> #include <errno.h>
#include "check.h" #include "check.h"
#define ERR(fmt, args...) { printf(fmt ": %s\n", ##args, strerror(errno)); rc = 1; }
#define ERRX(fmt, args...) { printf(fmt "\n", ##args); rc = 1; }
static char *files[] = {
"/etc/passwd", "/tmp/mypwd", "/tmp/mypwd",
"/etc/passwd", "/tmp/", "/tmp/passwd",
"/etc/passwd", "/tmp", "/tmp/passwd",
NULL
};
static int one_sz(const char *src, const char *dst, int sz)
{
struct stat st;
ssize_t len;
int rc = 0;
len = copyfile(src, dst, sz, 0);
if (!len) {
ERR("failed copying any bytes from %s", src);
} else {
if (stat(dst, &st))
ERR("copied but cannot find destination %s", dst);
if (st.st_size != sz)
ERR("file only %ld bytes, expected %d", st.st_size, sz);
if (len != st.st_size)
ERRX("copied expected data %d, but copyfile() says %ld", sz, len);
}
return rc;
}
static int _sz()
{
const int sz = 32768;
return test(one_sz("/dev/zero", "/tmp/zeroes", sz), "copyfile(/dev/zero, %d)", sz);
}
static int fcopyfile_one(const char *src, const char *dst, const char *expected)
{
FILE *from, *to;
int rc;
from = fopen(src, "r");
to = fopen(dst, "w");
rc = fcopyfile(from, to);
if (from)
fclose(from);
if (to)
fclose(to);
if (rc) {
if (!src || !dst)
rc = 0; /* expected */
else if (fisdir(dst))
rc = 0; /* expected */
} else {
if (fexist(expected)) {
if (systemf("diff -q %s %s", src, expected))
rc = 1;
} else
ERR("cannot find %s", expected);
}
erase(expected);
return rc;
}
static int _fcopyfile()
{
int i, rc = 0;
for (i = 0; files[i]; i += 3) {
char *src = files[i];
char *dst = files[i + 1];
char *res = files[i + 2];
rc += test(fcopyfile_one(src, dst, res), "fcopyfile(%s, %s)", src, dst);
}
return rc;
}
/* only checks success, correct file size verified by _sz() */
static int copyfile_one(const char *src, const char *dst, const char *expected)
{
int rc;
rc = copyfile(src, dst, 0, 0);
if (!rc)
rc = 1;
else if (!fexist(expected))
rc = 1;
else
rc = 0;
erase(expected);
return rc;
}
static int _copyfile()
{
int i, rc = 0;
for (i = 0; files[i]; i += 3) {
char *src = files[i];
char *dst = files[i + 1];
char *res = files[i + 2];
rc += test(copyfile_one(src, dst, res), "copyfile(%s, %s)", src, dst);
}
return rc;
}
int main(void) int main(void)
{ {
int i = 0; return _fcopyfile() ||
char *files[] = { _copyfile() ||
"/etc/passwd", "/tmp/mypwd", "/tmp/mypwd", _sz();
"/etc/passwd", "/tmp/", "/tmp/passwd",
"/etc/passwd", "/tmp", "/tmp/passwd",
NULL
};
FILE *src, *dst;
printf("=>Start testing fcopyfile()\n");
while (files[i]) {
printf("fcopyfile(%s, %s)\t", files[i], files[i + 1]);
src = fopen(files[i], "r");
dst = fopen(files[i + 1], "w");
if (fcopyfile(src, dst)) {
if (!fisdir(files[i + 1]))
err(1, "Failed fcopyfile(%s, %s)", files[i], files[i + 1]);
}
if (src)
fclose(src);
if (dst)
fclose(dst);
if (fexist(files[i + 2]))
printf("OK => %s", files[i + 2]);
printf("\n");
erase(files[i + 2]);
i += 3;
}
printf("\n=>Start testing copyfile()\n");
i = 0;
while (files[i]) {
printf("copyfile(%s, %s)\t", files[i], files[i + 1]);
if (!copyfile(files[i], files[i + 1], 0, 0))
err(1, "Failed copyfile(%s, %s)", files[i], files[i + 1]);
if (fexist(files[i + 2]))
printf("OK => %s", files[i + 2]);
printf("\n");
erase(files[i + 2]);
i += 3;
}
return 0;
} }
+1 -1
View File
@@ -41,7 +41,7 @@ static int mtime()
char buf[80]; char buf[80];
/* Must sleep a while here otherwise we execute too fast => no mtime change :-( */ /* Must sleep a while here otherwise we execute too fast => no mtime change :-( */
usleep(10000); sleep(2);
PRINT("Calling pidfile() again to update mtime ...\n"); PRINT("Calling pidfile() again to update mtime ...\n");
if (pidfile(pidfile_arg)) if (pidfile(pidfile_arg))
+65 -35
View File
@@ -48,52 +48,82 @@ void setup_test(void)
} }
} }
static void check_tree(char *heading, char *dir) int check_dir_to_dir(void)
{ {
if (verbose) { int rc = 0;
if (heading)
puts(heading); rc += rsync(SRC, DST, LITE_FOPT_KEEP_MTIME, NULL);
rc += systemf("diff -rq %s %s", SRC, DST);
systemf("rm -rf %s/*", DST);
return rc;
}
int check_file_to_file(void)
{
int rc = 0;
touch(SRC "foo.txt");
PRINT("SRC ==========================\n");
if (verbose) system("ls -l " SRC);
rc += rsync(SRC "foo.txt", DST "foo.txt", LITE_FOPT_KEEP_MTIME, NULL);
if (!fexist(DST "foo.txt") || fisdir(DST "foo.txt")) {
PRINT("No dst file or it's a directory\n");
rc++;
} }
// XXX: Fixme, add code to list tree, nftw() possibly PRINT("DST ==========================\n");
if (verbose) system("ls -l " DST);
systemf("rm -rf %s %s/*", SRC "foo.txt" , DST);
return rc;
}
int check_file_to_dir(void)
{
int rc = 0;
touch(SRC "foo.txt");
PRINT("SRC ==========================\n");
if (verbose) system("ls -l " SRC);
rc += rsync(SRC "foo.txt", DST, LITE_FOPT_KEEP_MTIME, NULL);
if (!fexist(DST "foo.txt") || fisdir(DST "foo.txt"))
rc++;
PRINT("DST ==========================\n");
if (verbose) system("ls -l " DST);
systemf("rm -rf %s %s/*", SRC "foo.txt" , DST);
return rc;
}
int check_file_to_nodir(void)
{
int rc = 0;
touch(SRC "foo.txt");
PRINT("SRC ==========================\n");
if (verbose) system("ls -l " SRC);
system("rm -rf " DST);
rc += rsync(SRC "foo.txt", DST, LITE_FOPT_KEEP_MTIME, NULL);
if (!fexist(DST "foo.txt") || fisdir(DST "foo.txt"))
rc++;
PRINT("DST ==========================\n");
if (verbose) system("ls -l " DST);
systemf("rm -rf %s %s/*", SRC "foo.txt" , DST);
return rc;
} }
int run_test(void) int run_test(void)
{ {
int result = 0; int result = 0;
#if 0
setup_test(); setup_test();
check_tree("Before:", BASE);
result += rsync(SRC, DST, 0, NULL); result += test(check_dir_to_dir(), "Verifying src/ -> dst/");
check_tree("After:", BASE); result += test(check_file_to_file(), "Verifying src/foo.txt -> dst/foo.txt");
cleanup_test(); result += test(check_file_to_dir(), "Verifying src/foo.txt -> dst/");
#endif result += test(check_file_to_nodir(),"Verifying src/foo.txt -> dst/ (non-existing target dir)");
setup_test();
sleep(1);
result += rsync(BASE "src", DST, LITE_FOPT_KEEP_MTIME, NULL);
check_tree("Only partial rsync of src <-- No slash!", BASE);
#if 0
cleanup_test();
setup_test();
result += rsync(BASE "src/sub1", BASE "dst", 0, NULL);
check_tree("Only partial rsync of src/sub1 <-- No slashes!!", BASE);
cleanup_test();
setup_test();
result += rsync(BASE "src/sub1/", DST, 0, NULL);
check_tree("Only partial rsync of src/sub1/", BASE);
cleanup_test();
setup_test();
result += rsync(BASE "src/sub1", DST, 0, NULL);
check_tree("Only partial rsync of src/sub1 <-- No slash!", BASE);
result += rsync("/etc", "/var/tmp", 0, NULL);
check_tree("Real life test:", "/var/tmp");
#endif
return result; return result;
} }
+1 -1
View File
@@ -23,7 +23,7 @@ static int mtime(char *file)
stat(file, &before); stat(file, &before);
/* Must sleep a while here otherwise we execute too fast => no mtime change :-( */ /* Must sleep a while here otherwise we execute too fast => no mtime change :-( */
usleep(10000); sleep(2);
PRINT("Calling touch() again to update mtime ...\n"); PRINT("Calling touch() again to update mtime ...\n");
if (touch(file)) { if (touch(file)) {