Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libite for openSUSE:Factory checked in at 2021-04-01 14:17:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libite (Old) and /work/SRC/openSUSE:Factory/.libite.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libite" Thu Apr 1 14:17:07 2021 rev:6 rq:882003 version:2.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libite/libite.changes 2021-02-15 23:21:02.827821191 +0100 +++ /work/SRC/openSUSE:Factory/.libite.new.2401/libite.changes 2021-04-01 14:18:23.836081415 +0200 @@ -1,0 +2,17 @@ +Sun Mar 28 13:37:43 UTC 2021 - Martin Hauke <[email protected]> + +- Update to version 2.4.0 + Changes + * Add support for touchf(), formatted string support for touch() + * Add support for erasef(), formatted string support for erase() + * Add support for strtrim(), trims leading and trailing + white-space from a string + Fixes + * Fix systemf() improper handling of system() return value. Now + checks if exited OK, then returning the exit status of the + command, or if not exited OK, then checks if the command was + signaled, and returns -1 with errno set. This also allows for + returning 127, like system(), if the shell, or the program + itself, did not exist + +------------------------------------------------------------------- Old: ---- libite-2.3.1.tar.gz New: ---- libite-2.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libite.spec ++++++ --- /var/tmp/diff_new_pack.uOs8Jk/_old 2021-04-01 14:18:25.260083631 +0200 +++ /var/tmp/diff_new_pack.uOs8Jk/_new 2021-04-01 14:18:25.260083631 +0200 @@ -19,7 +19,7 @@ %define sover 5 Name: libite -Version: 2.3.1 +Version: 2.4.0 Release: 0 Summary: BSD function library License: MIT AND X11 ++++++ libite-2.3.1.tar.gz -> libite-2.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/.travis.yml new/libite-2.4.0/.travis.yml --- old/libite-2.3.1/.travis.yml 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/.travis.yml 2021-03-27 10:24:05.000000000 +0100 @@ -25,15 +25,15 @@ name: "troglobit/libite" description: "That missing frog DNA you've been looking for" notification_email: [email protected] - build_command_prepend: "./autogen.sh && ./configure --prefix=/tmp --disable-silent-rules" + build_command_prepend: "./autogen.sh && ./configure --prefix= --disable-silent-rules" build_command: "make clean all" branch_pattern: dev script: - ./autogen.sh - - ./configure --prefix=/tmp --disable-silent-rules + - ./configure --prefix= --disable-silent-rules - make clean - make -j5 - - make install-strip - - ls -lR /tmp - - make check + - make install-strip DESTDIR=/tmp/foo + - ls -lR /tmp/foo + - make distcheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/ChangeLog.md new/libite-2.4.0/ChangeLog.md --- old/libite-2.3.1/ChangeLog.md 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/ChangeLog.md 2021-03-27 10:24:05.000000000 +0100 @@ -3,6 +3,26 @@ All notable changes to the project are documented in this file. + +[v2.4.0][] - 2021-03-27 +----------------------- + +### Changes + +- Add support for `touchf()`, formatted string support for `touch()` +- Add support for `erasef()`, formatted string support for `erase()` +- Add support for `strtrim()`, trims leading and trailing white-space + from a string + +### Fixes + +- Fix `systemf()` improper handling of `system()` return value. Now + checks if exited OK, then returning the exit status of the command, or + if not exited OK, then checks if the command was signaled, and returns + -1 with `errno` set. This also allows for returning 127, like + `system()`, if the shell, or the program itself, did not exist + + [v2.3.1][] - 2021-02-12 ----------------------- @@ -393,7 +413,9 @@ Initial extraction of frog DNA from [Finit][]. See [README][] for API details. -[UNRELEASED]: https://github.com/troglobit/libite/compare/v2.3.0...HEAD +[UNRELEASED]: https://github.com/troglobit/libite/compare/v2.4.0...HEAD +[v2.4.0]: https://github.com/troglobit/libite/compare/v2.3.1...v2.4.0 +[v2.3.1]: https://github.com/troglobit/libite/compare/v2.3.0...v2.3.1 [v2.3.0]: https://github.com/troglobit/libite/compare/v2.2.1...v2.3.0 [v2.2.1]: https://github.com/troglobit/libite/compare/v2.2.0...v2.2.1 [v2.2.0]: https://github.com/troglobit/libite/compare/v2.1.2...v2.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/README.md new/libite-2.4.0/README.md --- old/libite-2.3.1/README.md 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/README.md 2021-03-27 10:24:05.000000000 +0100 @@ -94,6 +94,10 @@ Erase file/directory with `remove()`. Errors on `stderr` +- `erasef(fmt, ...)` + + Like `erase()` but takes a formatted printf-like string as argument. + - `makedir(path)` Create directory, like `mkdir()`. Errors on `stderr` @@ -110,6 +114,10 @@ Create a file, or update mtime. Errors on `stderr` +- `touchf(fmt, ...)` + + Like `touch()` but takes a formatted printf-like string as argument. + - `S_ISEXEC(mode_t m)` Mysteriously missing from GLIBC @@ -311,6 +319,11 @@ match, or `-1` on error or not found. `strnmatch()` takes an extra arg to compare only `len` number of characters from `str`. +- `strtrim(str)` + + Trims a string from any leading and trailing white-space, returns the + trimmed result in the same buffer. + - `systemf(fmt, ...)` Like `system()`, but takes a formatted string as argument. This @@ -442,6 +455,7 @@ to generate a `configure` script. It is a generated file and otherwise only included in released tarballs. + Origin & References ------------------- @@ -461,7 +475,7 @@ [ISC]: https://en.wikipedia.org/wiki/ISC_license [BSD]: https://en.wikipedia.org/wiki/BSD_licenses [Travis]: https://travis-ci.org/troglobit/libite -[Travis Status]: https://travis-ci.org/troglobit/libite.png?branch=master +[Travis Status]: https://travis-ci.org/troglobit/libite.svg?branch=master [Coverity Scan]: https://scan.coverity.com/projects/20602 [Coverity Status]: https://img.shields.io/coverity/scan/20602.svg [Claudio Matsuoka]: https://github.com/cmatsuoka diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/configure.ac new/libite-2.4.0/configure.ac --- old/libite-2.3.1/configure.ac 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/configure.ac 2021-03-27 10:24:05.000000000 +0100 @@ -1,4 +1,4 @@ -AC_INIT(libite, 2.3.1, https://github.com/troglobit/libite/issues) +AC_INIT(libite, 2.4.0, 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.3.1/debian/changelog new/libite-2.4.0/debian/changelog --- old/libite-2.3.1/debian/changelog 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/debian/changelog 2021-03-27 10:24:05.000000000 +0100 @@ -1,3 +1,17 @@ +libite (2.4.0) stable; urgency=medium + + * New functions: + - touchf(), formatted string support for touch() + - erasef(), formatted string support for erase() + - strtrim(), trims leading and trailing white-space from a string + * Fix systemf() improper handling of system() return value. Now checks + if exited OK, then returning the exit status of the command, or if not + exited OK, then checks if the command was signaled, and returns -1 with + errno set. This also allows for returning 127, like system(), if the + shell, or the program itself, did not exist. + + -- Joachim Wiberg <[email protected]> Sat, 27 Mar 2021 09:12:32 +0100 + libite (2.3.1) stable; urgency=medium * Minor packaging fixes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/debian/libite5.symbols new/libite-2.4.0/debian/libite5.symbols --- old/libite-2.3.1/debian/libite5.symbols 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/debian/libite5.symbols 2021-03-27 10:24:05.000000000 +0100 @@ -5,6 +5,7 @@ chomp@Base 2.0.0 copyfile@Base 2.0.0 dir@Base 2.0.0 + erasef@Base 2.4.0 fcopyfile@Base 2.0.0 fexist@Base 2.0.0 fgetint@Base 2.0.0 @@ -38,12 +39,14 @@ strmatch@Base 2.1.0 strnmatch@Base 2.1.0 strtonum@Base 2.1.0 + strtrim@Base 2.4.0 systemf@Base 2.2.0 telnet_close@Base 2.1.0 telnet_expect@Base 2.1.0 telnet_open@Base 2.1.0 telnet_session@Base 2.1.0 tempfile@Base 2.0.0 + touchf@Base 2.4.0 truncatef@Base 2.3.0 which@Base 2.0.0 whichp@Base 2.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/Makefile.am new/libite-2.4.0/src/Makefile.am --- old/libite-2.3.1/src/Makefile.am 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/src/Makefile.am 2021-03-27 10:24:05.000000000 +0100 @@ -2,19 +2,19 @@ libite_la_CPPFLAGS = -D_GNU_SOURCE libite_la_CFLAGS = -W -Wall -Wextra -libite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:0:2 +libite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 8:0:3 libite_la_SOURCES = chomp.c copyfile.c \ - conio.c conio.h \ - dir.c fopenf.c fremove.c \ + conio.c conio.h dir.c \ + erasef.c fopenf.c fremove.c \ fexist.c fisdir.c \ fparseln.c fsendfile.c \ ifconfig.c lfile.c \ makepath.c progress.c \ pidfile.c pidfilefn.c \ - reallocarray.c rsync.c \ + reallocarray.c rsync.c strtrim.c \ strlcpy.c strlcat.c strtonum.c \ strdupa.h strndupa.h strnlen.h \ - strmatch.c systemf.c \ + strmatch.c systemf.c touchf.c \ telnet.c tempfile.c truncatef.c \ yorn.c which.c \ lite.h strlite.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/erasef.c new/libite-2.4.0/src/erasef.c --- old/libite-2.3.1/src/erasef.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libite-2.4.0/src/erasef.c 2021-03-27 10:24:05.000000000 +0100 @@ -0,0 +1,66 @@ +/* Formatted erase() + * + * Copyright (c) 2021 Joachim Wiberg <[email protected]> + * + * Permission to use, copy, modify, and/or 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. + */ + +#include <errno.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <unistd.h> + +#include "lite.h" + +/** + * erasef - Like erase() but with formatted string support + * @fmt: Formatted string to be composed into a pathname + * + * This is a wrapper for the erase() function in lite.h, lessening the + * burden of having to compose the filename from parts in a seprate + * buffer. + * + * Returns: + * Upon successful completion erasef() returns POSIX OK(0), otherwise, + * -1 is returned and errno is set to indicate the error. + */ +int erasef(const char *fmt, ...) +{ + va_list ap; + char *file; + int len; + + va_start(ap, fmt); + len = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + + file = alloca(len + 1); + if (!file) { + errno = ENOMEM; + return -1; + } + + va_start(ap, fmt); + vsnprintf(file, len + 1, fmt, ap); + va_end(ap); + + return erase(file); +} + +/** + * Local Variables: + * indent-tabs-mode: t + * c-file-style: "linux" + * End: + */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/lite.h new/libite-2.4.0/src/lite.h --- old/libite-2.3.1/src/lite.h 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/src/lite.h 2021-03-27 10:24:05.000000000 +0100 @@ -60,6 +60,9 @@ typedef struct sdbuf sdbuf_t; char *chomp (char *str); + +int erasef (const char *fmt, ...); + char *fparseln (FILE *, size_t *, size_t *, const char[3], int); int fexist (const char *file); @@ -107,6 +110,8 @@ int telnet_expect (sdbuf_t *ctx, char *script[], FILE *output); int telnet_session (int addr, short port, char *script[], FILE *output); +int touchf (const char *fmt, ...); + int yorn (const char *fmt, ...); char *which (const char *cmd); @@ -117,9 +122,9 @@ #include <sys/time.h> /* utimensat() on *BSD */ static inline int touch(const char *path) { - if (mknod((path), S_IFREG|0644, 0)) { - if (errno == EEXIST) - return utimensat(AT_FDCWD, path, NULL, 0); + if (utimensat(AT_FDCWD, path, NULL, 0)) { + if (errno == ENOENT) + return mknod((path), S_IFREG|0644, 0); return -1; } return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/strlite.h new/libite-2.4.0/src/strlite.h --- old/libite-2.3.1/src/strlite.h 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/src/strlite.h 2021-03-27 10:24:05.000000000 +0100 @@ -67,6 +67,8 @@ long long strtonum (const char *numstr, long long minval, long long maxval, const char **errstrp); #endif +char *strtrim (char *str); + /* Convert string to natural number (0-2147483647), returns -1 on error. */ static inline int atonum(const char *str) { @@ -107,7 +109,7 @@ */ static inline int string_case_compare(const char *a, const char *b) { - return strlen (a) == strlen (b) && !strcasecmp (a, b); + return strlen(a) == strlen(b) && !strcasecmp(a, b); } #endif /* LITE_STRING_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/strtrim.c new/libite-2.4.0/src/strtrim.c --- old/libite-2.3.1/src/strtrim.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libite-2.4.0/src/strtrim.c 2021-03-27 10:24:05.000000000 +0100 @@ -0,0 +1,70 @@ +/* Trim a string from whitespace + * + * Copyright (c) 2014 Mattias Walstr??m <[email protected]> + * Copyright (c) 2021 Joachim Wiberg <[email protected]> + * + * Permission to use, copy, modify, and/or 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. + */ + +#include <ctype.h> +#include <errno.h> +#include <stdlib.h> + +#include "lite.h" + +/** + * strtrim - Strip leading and trailing whitespace from a string + * @str: The string to trim + * + * Trims a string from any leading and trailing white-space, returns the + * trimmed result in the same buffer. + * + * Returns: + * If @str is a valid, non-NULL, string this function returns the same + * string stripped from whitespace. This function only returns %NULL + * if @str itself is %NULL. + */ +char *strtrim(char *str) +{ + char *start, *end; + + if (!str) { + errno = EINVAL; + return NULL; + } + + start = str; + while (isspace(*start)) + start++; + + if (*start == 0) { + str[0] = 0; + return str; + } + + end = start + strlen(start) - 1; + while (end > start && isspace(*end)) + end--; + *(++end) = 0; + + memmove(str, start, end - start + 1); + + return str; +} + +/** + * Local Variables: + * indent-tabs-mode: t + * c-file-style: "linux" + * End: + */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/systemf.c new/libite-2.4.0/src/systemf.c --- old/libite-2.3.1/src/systemf.c 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/src/systemf.c 2021-03-27 10:24:05.000000000 +0100 @@ -25,8 +25,8 @@ { va_list ap; char *cmd; - int len, status; - int rc = -1; + int len; + int rc; va_start(ap, fmt); len = vsnprintf(NULL, 0, fmt, ap); @@ -42,23 +42,16 @@ vsnprintf(cmd, len, fmt, ap); va_end(ap); - status = system(cmd); + rc = system(cmd); + if (rc == -1) + return -1; - rc = WEXITSTATUS(status); - if (!WIFEXITED(status)) { - if (WIFSIGNALED(status) && - (WTERMSIG(status) == SIGINT || - WTERMSIG(status) == SIGQUIT)) { - errno = EINTR; - rc = -1; - } else if (!rc) { - /* - * Alert callee that command didn't complete - * successfully. Some programs don't change - * their exit code when signaled. - */ - rc = 1; - } + if (WIFEXITED(rc)) { + errno = 0; + rc = WEXITSTATUS(rc); + } else if (WIFSIGNALED(rc)) { + errno = EINTR; + rc = -1; } return rc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/touchf.c new/libite-2.4.0/src/touchf.c --- old/libite-2.3.1/src/touchf.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libite-2.4.0/src/touchf.c 2021-03-27 10:24:05.000000000 +0100 @@ -0,0 +1,66 @@ +/* Formatted touch() + * + * Copyright (c) 2021 Joachim Wiberg <[email protected]> + * + * Permission to use, copy, modify, and/or 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. + */ + +#include <errno.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <unistd.h> + +#include "lite.h" + +/** + * touchf - Like touch() but with formatted string support + * @fmt: Formatted string to be composed into a pathname + * + * This is a wrapper for the touch() function in lite.h, lessening the + * burden of having to compose the filename from parts in a seprate + * buffer. + * + * Returns: + * Upon successful completion touchf() returns POSIX OK(0), otherwise, + * -1 is returned and errno is set to indicate the error. + */ +int touchf(const char *fmt, ...) +{ + va_list ap; + char *file; + int len; + + va_start(ap, fmt); + len = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + + file = alloca(len + 1); + if (!file) { + errno = ENOMEM; + return -1; + } + + va_start(ap, fmt); + vsnprintf(file, len + 1, fmt, ap); + va_end(ap); + + return touch(file); +} + +/** + * Local Variables: + * indent-tabs-mode: t + * c-file-style: "linux" + * End: + */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/src/truncatef.c new/libite-2.4.0/src/truncatef.c --- old/libite-2.3.1/src/truncatef.c 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/src/truncatef.c 2021-03-27 10:24:05.000000000 +0100 @@ -30,7 +30,6 @@ * of having to compose the filename from parts in a seprate buffer. * * Returns: - * Upon successful completion truncate() returns POSIX OK(0), otherwise, * -1 is returned and errno is set to indicate the error. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/tests/systemf.c new/libite-2.4.0/tests/systemf.c --- old/libite-2.3.1/tests/systemf.c 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/tests/systemf.c 2021-03-27 10:24:05.000000000 +0100 @@ -4,9 +4,10 @@ int main(void) { struct { char *cmd; int rc; } list[] = { + { "/app/enoent", 127 }, { "false", 1 }, { "true", 0 }, - { "kill -9 $$", 1 }, + { "kill -9 $$", -1 }, { "kill -QUIT $$", -1 }, { "kill -INT $$", -1 } }; @@ -15,8 +16,12 @@ int rc; rc = systemf("%s", list[i].cmd); - if (rc != list[i].rc) - err(rc, "Failed command %s", list[i].cmd); + if (rc != list[i].rc) { + if (rc == -1) + err(rc, "Failed %s", list[i].cmd); + else + errx(rc, "Failed %s, rc %d vs %d", list[i].cmd, rc, list[i].rc); + } } return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libite-2.3.1/tests/touch.c new/libite-2.4.0/tests/touch.c --- old/libite-2.3.1/tests/touch.c 2021-02-12 15:13:40.000000000 +0100 +++ new/libite-2.4.0/tests/touch.c 2021-03-27 10:24:05.000000000 +0100 @@ -1,3 +1,4 @@ +/* test of touch(), touchf(), erase(), and erasef() */ #include <err.h> #include <paths.h> #include <signal.h> @@ -6,6 +7,8 @@ #include "check.h" +#define FMT "%s-bar" + int verbose = 0; @@ -32,10 +35,38 @@ ret = timespec_newer(&after.st_mtim, &before.st_mtim); PRINT("Before: %s\n", timespec2str(&before.st_mtim, buf, sizeof(buf))); PRINT("After : %s\n", timespec2str(&after.st_mtim, buf, sizeof(buf))); + erase(file); return !ret; } +static int formatted(char *file) +{ + char vrfy[80]; + + if (touchf(FMT, file)) + err(1, "Failed creating " FMT, file); + + PRINT("Created " FMT "\n", file); + + snprintf(vrfy, sizeof(vrfy), FMT, file); + if (!fexist(vrfy)) + errx(1, "touchf() does not detect failure to create file " FMT, file); + + PRINT("File " FMT " really does exist!\n", file); + + erasef(FMT, file); + if (fexist(vrfy)) { + int saved = errno; + + erase(vrfy); + errno = saved; + errx(1, "erasef() failed removing the created file " FMT, file); + } + + return 0; +} + int main(int argc, char *argv[]) { int fd; @@ -49,13 +80,13 @@ err(1, "Failed creating tempfile, %s", file); close(fd); - return mtime(file); + return mtime(file) || formatted(file); } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" - * compile-command: "make pidfile && ./pidfile -v" + * compile-command: "make touch && ./touch -v" * End: */
