Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libite for openSUSE:Factory checked in at 2023-04-28 16:23:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libite (Old) and /work/SRC/openSUSE:Factory/.libite.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libite" Fri Apr 28 16:23:34 2023 rev:10 rq:1083360 version:2.5.3 Changes: -------- --- /work/SRC/openSUSE:Factory/libite/libite.changes 2022-12-03 12:48:36.510145181 +0100 +++ /work/SRC/openSUSE:Factory/.libite.new.1533/libite.changes 2023-04-28 16:24:31.130413152 +0200 @@ -1,0 +2,12 @@ +Thu Apr 27 22:26:34 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 2.5.3: + * Refactor `copyfile()` unit test and verify number of bytes + copied + * Add missing `rsync()` unit test to ensure proper function + * `rsync()` does not copy single files correctly + * `copyfile()` does not handle empty source files correctly + (error) + * `copyfile()` does not properly create destination dir + +------------------------------------------------------------------- Old: ---- libite-2.5.2.tar.gz New: ---- libite-2.5.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libite.spec ++++++ --- /var/tmp/diff_new_pack.4r2hr8/_old 2023-04-28 16:24:33.102424663 +0200 +++ /var/tmp/diff_new_pack.4r2hr8/_new 2023-04-28 16:24:33.106424686 +0200 @@ -1,7 +1,7 @@ # # spec file for package libite # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # Copyright (c) 2018-2021, Martin Hauke <mar...@gmx.de> # # All modifications and additions to the file contributed by third parties @@ -19,7 +19,7 @@ %define sover 5 Name: libite -Version: 2.5.2 +Version: 2.5.3 Release: 0 Summary: BSD function library License: MIT AND X11 ++++++ libite-2.5.2.tar.gz -> libite-2.5.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.5.2/ChangeLog.md new/libite-2.5.3/ChangeLog.md --- old/libite-2.5.2/ChangeLog.md 2022-04-17 14:19:11.000000000 +0200 +++ new/libite-2.5.3/ChangeLog.md 2023-04-08 07:05:58.000000000 +0200 @@ -4,6 +4,19 @@ 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 ----------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.5.2/configure.ac new/libite-2.5.3/configure.ac --- old/libite-2.5.2/configure.ac 2022-04-17 14:19:11.000000000 +0200 +++ new/libite-2.5.3/configure.ac 2023-04-08 07:05:58.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT(libite, 2.5.2, https://github.com/troglobit/libite/issues) +AC_INIT(libite, 2.5.3, https://github.com/troglobit/libite/issues) AC_CONFIG_AUX_DIR(aux) AM_INIT_AUTOMAKE([1.11 foreign dist-xz]) AM_SILENT_RULES([yes]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.5.2/debian/changelog new/libite-2.5.3/debian/changelog --- old/libite-2.5.2/debian/changelog 2022-04-17 14:19:11.000000000 +0200 +++ new/libite-2.5.3/debian/changelog 2023-04-08 07:05:58.000000000 +0200 @@ -1,3 +1,14 @@ +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 <troglo...@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/`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.5.2/src/copyfile.c new/libite-2.5.3/src/copyfile.c --- old/libite-2.5.2/src/copyfile.c 2022-04-17 14:19:11.000000000 +0200 +++ new/libite-2.5.3/src/copyfile.c 2023-04-08 07:05:58.000000000 +0200 @@ -38,6 +38,7 @@ { int isdir = 0; + retry: if (fisdir(*dst)) { int slash = 0; char *tmp, *ptr = strrchr(src, '/'); @@ -58,16 +59,25 @@ sprintf(tmp, "%s%s%s", *dst, slash ? "" : "/", ptr); *dst = tmp; + } else { + struct stat st; + + if (stat(*dst, &st) && fisslashdir(*dst)) { + makedir(*dst, 0755); + goto retry; + } } 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) { - ssize_t ret = 0, size = 0; + ssize_t ret = 0, size = -1; do { size_t count = num > len ? len : num; @@ -76,11 +86,16 @@ if (ret <= 0) { if (ret == -1 && EINTR == errno) continue; + if (ret == 0 && size == -1) + size = 0; break; } - if (ret > 0) + if (ret > 0) { + if (size == -1) + size = 0; size += write(out, buffer, ret); + } num -= count; } while (num > 0); @@ -194,7 +209,7 @@ } size = do_copy(in, out, num, buffer, BUFSIZ); - if (!size && errno) + if (size < 0) saved_errno = errno; else if (keep_mtim) set_mtime(in, out); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.5.2/src/rsync.c new/libite-2.5.3/src/rsync.c --- old/libite-2.5.2/src/rsync.c 2022-04-17 14:19:11.000000000 +0200 +++ new/libite-2.5.3/src/rsync.c 2023-04-08 07:05:58.000000000 +0200 @@ -77,7 +77,9 @@ char **files; /* Array of file names. */ struct stat st; - if (!fisdir(dst)) + errno = 0; + + if (stat(dst, &st) && fisslashdir(dst)) makedir(dst, 0755); if (!fisdir(src)) { @@ -85,9 +87,9 @@ return 1; if (copy(src, dst, keep_mtim)) - result++; + return 1; - return errno; + return 0; } /* Copy dir as well? */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.5.2/test/copyfile.c new/libite-2.5.3/test/copyfile.c --- old/libite-2.5.2/test/copyfile.c 2022-04-17 14:19:11.000000000 +0200 +++ new/libite-2.5.3/test/copyfile.c 2023-04-08 07:05:58.000000000 +0200 @@ -2,54 +2,130 @@ #include <errno.h> #include "check.h" -int main(void) +#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) { - int i = 0; - char *files[] = { - "/etc/passwd", "/tmp/mypwd", "/tmp/mypwd", - "/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"); + 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); - erase(files[i + 2]); - i += 3; + 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); } - 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"); + 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; - erase(files[i + 2]); - i += 3; + 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 0; + return rc; +} + +int main(void) +{ + return _fcopyfile() || + _copyfile() || + _sz(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.5.2/test/rsync.c new/libite-2.5.3/test/rsync.c --- old/libite-2.5.2/test/rsync.c 2022-04-17 14:19:11.000000000 +0200 +++ new/libite-2.5.3/test/rsync.c 2023-04-08 07:05:58.000000000 +0200 @@ -48,52 +48,82 @@ } } -static void check_tree(char *heading, char *dir) +int check_dir_to_dir(void) { - if (verbose) { - if (heading) - puts(heading); + int rc = 0; + + 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 run_test(void) +int check_file_to_dir(void) { - int result = 0; + int rc = 0; -#if 0 - setup_test(); - check_tree("Before:", BASE); + 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); - result += rsync(SRC, DST, 0, NULL); - check_tree("After:", BASE); - cleanup_test(); -#endif + return rc; +} - 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); +int check_file_to_nodir(void) +{ + int rc = 0; - cleanup_test(); - setup_test(); - result += rsync(BASE "src/sub1/", DST, 0, NULL); - check_tree("Only partial rsync of src/sub1/", BASE); + 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 result = 0; - 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 + result += test(check_dir_to_dir(), "Verifying src/ -> dst/"); + result += test(check_file_to_file(), "Verifying src/foo.txt -> dst/foo.txt"); + result += test(check_file_to_dir(), "Verifying src/foo.txt -> dst/"); + result += test(check_file_to_nodir(),"Verifying src/foo.txt -> dst/ (non-existing target dir)"); return result; }