Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package entr for openSUSE:Factory checked in at 2021-01-30 13:56:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/entr (Old) and /work/SRC/openSUSE:Factory/.entr.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "entr" Sat Jan 30 13:56:45 2021 rev:8 rq:867824 version:4.7 Changes: -------- --- /work/SRC/openSUSE:Factory/entr/entr.changes 2020-07-07 13:00:32.238169960 +0200 +++ /work/SRC/openSUSE:Factory/.entr.new.28504/entr.changes 2021-01-30 13:57:49.754403314 +0100 @@ -1,0 +2,9 @@ +Fri Jan 29 23:43:44 UTC 2021 - Dirk M??ller <dmuel...@suse.com> + +- update to 4.7: + * Use system file descriptor limits when max_user_watches is not accessible + * Return the exit status of the child process when the '-z' option is used + * Handle SIGHUP so child process are terminated when a terminal is closed + * More accurately return shell exit code using '-s' option + +------------------------------------------------------------------- Old: ---- entr-4.6.tar.gz entr-4.6.tar.gz.sig New: ---- entr-4.7.tar.gz entr-4.7.tar.gz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ entr.spec ++++++ --- /var/tmp/diff_new_pack.fErHpA/_old 2021-01-30 13:57:50.274404191 +0100 +++ /var/tmp/diff_new_pack.fErHpA/_new 2021-01-30 13:57:50.278404198 +0100 @@ -1,7 +1,7 @@ # # spec file for package entr # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # Copyright (c) 2016 Daniel Lichtenberger # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: entr -Version: 4.6 +Version: 4.7 Release: 0 Summary: A utility for running arbitrary commands when files change License: ISC ++++++ entr-4.6.tar.gz -> entr-4.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.6/Makefile.bsd new/entr-4.7/Makefile.bsd --- old/entr-4.6/Makefile.bsd 2020-07-01 17:33:17.000000000 +0200 +++ new/entr-4.7/Makefile.bsd 2021-01-29 15:36:21.000000000 +0100 @@ -1,19 +1,10 @@ PREFIX ?= /usr/local MANPREFIX ?= ${PREFIX}/man -RELEASE = 4.6 +RELEASE = 4.7 CPPFLAGS += -DRELEASE=\"${RELEASE}\" all: versioncheck entr -env: - @echo "CC = ${CC}" - @echo "DESTDIR = ${DESTDIR}" - @echo "EXTRA_SRC = ${EXTRA_SRC}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "MANPREFIX = ${MANPREFIX}" - @echo "PREFIX = ${PREFIX}" - @echo "SRC = ${SRC}" - test: entr_spec entr @echo "Running unit tests" @./entr_spec @@ -50,4 +41,4 @@ versioncheck: @head -n3 NEWS | egrep -q "^= Next Release: ${RELEASE}|^== ${RELEASE}: " -.PHONY: all env test gcc-lint regress clean distclean install uninstall versioncheck +.PHONY: all test gcc-lint regress clean distclean install uninstall versioncheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.6/NEWS new/entr-4.7/NEWS --- old/entr-4.6/NEWS 2020-07-01 17:33:17.000000000 +0200 +++ new/entr-4.7/NEWS 2021-01-29 15:36:21.000000000 +0100 @@ -1,5 +1,12 @@ = Release History +== 4.7: January 29, 2021 + + - Use system file descriptor limits when max_user_watches is not accessible + - Return the exit status of the child process when the '-z' option is used + - Handle SIGHUP so child process are terminated when a terminal is closed + - More accurately return shell exit code using '-s' option + == 4.6: July 1, 2020 - Always call waitpid(2) to avoid dead processes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.6/README.md new/entr-4.7/README.md --- old/entr-4.6/README.md 2020-07-01 17:33:17.000000000 +0200 +++ new/entr-4.7/README.md 2021-01-29 15:36:21.000000000 +0100 @@ -44,7 +44,7 @@ Rebuild project if a source file is modified or added to the src/ directory: - $ while true; do find . -name 'src/*.rb' | entr -d make; done + $ while sleep 0.1; do find src -name '*.rb' | entr -d make; done Self-terminate after a file is updated @@ -54,8 +54,7 @@ ---- A release history as well as features in the upcoming release are covered in the -[NEWS] file. +[NEWS](NEWS) file. [kqueue(2)]: http://man.openbsd.org/kqueue.2 [inotify(7)]: http://man.he.net/?section=all&topic=inotify -[NEWS]: https://raw.githubusercontent.com/eradman/entr/master/NEWS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.6/entr.1 new/entr-4.7/entr.1 --- old/entr-4.6/entr.1 2020-07-01 17:33:17.000000000 +0200 +++ new/entr-4.7/entr.1 2021-01-29 15:36:21.000000000 +0100 @@ -13,7 +13,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd April 17, 2020 +.Dd January 02, 2021 .Dt ENTR 1 .Os .Sh NAME @@ -21,7 +21,7 @@ .Nd run arbitrary commands when files change .Sh SYNOPSIS .Nm -.Op Fl acdprs +.Op Fl acdnprsz .Ar utility .Op Ar argument /_ ... .Sh DESCRIPTION @@ -141,19 +141,20 @@ will use .Pa /bin/sh . .Sh EXIT STATUS -The +If the +.Fl z +flag is set and the +.Ar utility +is successfully executed, the status of the child process is +returned. +Otherwise .Nm -utility exits with one of the following values: +normally returns one of the following values: .Pp .Bl -tag -width Ds -offset indent -compact .It 0 Normal termination after receiving .Dv SIGINT -or the -.Fl z -flag was set and the -.Ar utility -was executed successfully .It 1 No regular files were provided as input or an error occurred .It 2 @@ -174,7 +175,7 @@ .Pp Rebuild project if a source file is modified or added to the src/ directory: .Pp -.Dl $ while true; do ls src/*.rb | entr -d make; done +.Dl $ while sleep 0.1; do ls src/*.rb | entr -d make; done .Pp Auto-reload a web server, or terminate if the server exits .Pp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.6/entr.c new/entr-4.7/entr.c --- old/entr-4.6/entr.c 2020-07-01 17:33:17.000000000 +0200 +++ new/entr-4.7/entr.c 2021-01-29 15:36:21.000000000 +0100 @@ -72,6 +72,7 @@ WatchFile **files; WatchFile *leading_edge; int child_pid; +int child_exitstatus; int terminating; int aggressive_opt; @@ -105,6 +106,7 @@ int main(int argc, char *argv[]) { struct rlimit rl; + rlim_t max_watches; int kq; struct sigaction act; int ttyfd; @@ -147,6 +149,8 @@ err(1, "Failed to set SIGINT handler"); if (sigaction(SIGTERM, &act, NULL) != 0) err(1, "Failed to set SIGTERM handler"); + if (sigaction(SIGHUP, &act, NULL) != 0) + err(1, "Failed to set SIGHUP handler"); /* notification used to combine the one-shot and restart options */ act.sa_flags = 0; @@ -155,14 +159,20 @@ err(1, "Failed to set SIGCHLD handler"); getrlimit(RLIMIT_NOFILE, &rl); + #if defined(_LINUX_PORT) - rl.rlim_cur = (rlim_t)fs_sysctl(INOTIFY_MAX_USER_WATCHES); -#else + max_watches = (rlim_t)fs_sysctl(INOTIFY_MAX_USER_WATCHES); + if(max_watches > 0) { + rl.rlim_cur = max_watches; + goto rlim_set; + } +#endif /* raise soft limit */ rl.rlim_cur = min((rlim_t)sysconf(_SC_OPEN_MAX), rl.rlim_max); if (setrlimit(RLIMIT_NOFILE, &rl) != 0) err(1, "setrlimit cannot set rlim_cur to %d", (int)rl.rlim_cur); -#endif + +rlim_set: /* prevent interactive utilities from paging output */ setenv("PAGER", "/bin/cat", 0); @@ -218,7 +228,7 @@ void usage() { fprintf(stderr, "release: %s\n", RELEASE); - fprintf(stderr, "usage: entr [-acdnprs] utility [argument [/_] ...] < filenames\n"); + fprintf(stderr, "usage: entr [-acdnprsz] utility [argument [/_] ...] < filenames\n"); exit(1); } @@ -230,7 +240,8 @@ if (child_pid > 0) { xkillpg(child_pid, SIGTERM); - xwaitpid(child_pid, &status, 0); + if (xwaitpid(child_pid, &status, 0) > 0) + child_exitstatus = WEXITSTATUS(status); child_pid = 0; } @@ -244,7 +255,7 @@ if (!noninteractive_opt) xtcsetattr(0, TCSADRAIN, &canonical_tty); terminate_utility(); - if (sig == SIGINT) + if ((sig == SIGINT || sig == SIGHUP)) exit(0); else raise(sig); @@ -254,16 +265,14 @@ proc_exit(int sig) { int status; - xwaitpid(child_pid, &status, 0); + if (wait(&status) > 0) + child_exitstatus = WEXITSTATUS(status); if ((oneshot_opt == 1) && (terminating == 0)) { if ((shell_opt == 1) && (restart_opt == 0)) { fprintf(stdout, "%s returned exit code %d\n", - basename(getenv("SHELL")), WEXITSTATUS(status)); + basename(getenv("SHELL")), child_exitstatus); } - if (WEXITSTATUS(status) == 99) - exit(1); - else - exit(0); + exit(child_exitstatus); } } @@ -460,18 +469,19 @@ else break; } if (ret != 0) - err(99, "exec %s", new_argv[0]); + err(1, "exec %s", new_argv[0]); } child_pid = pid; if (restart_opt == 0) { - xwaitpid(pid, &status, 0); + if (xwaitpid(pid, &status, 0) > 0) + child_exitstatus = WEXITSTATUS(status); if (shell_opt == 1) fprintf(stdout, "%s returned exit code %d\n", - basename(getenv("SHELL")), WEXITSTATUS(status)); + basename(getenv("SHELL")), child_exitstatus); if (oneshot_opt == 1) - exit(0); + exit(child_exitstatus); } xfree(arg_buf); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.6/missing/kqueue_inotify.c new/entr-4.7/missing/kqueue_inotify.c --- old/entr-4.6/missing/kqueue_inotify.c 2020-07-01 17:33:17.000000000 +0200 +++ new/entr-4.7/missing/kqueue_inotify.c 2021-01-29 15:36:21.000000000 +0100 @@ -57,16 +57,21 @@ fs_sysctl(const int name) { FILE *file; char line[8]; - int value = 0; + int value; switch(name) { case INOTIFY_MAX_USER_WATCHES: file = fopen("/proc/sys/fs/inotify/max_user_watches", "r"); - if (file == NULL || fgets(line, sizeof(line), file) == NULL) - err(1, "max_user_watches"); - value = atoi(line); - fclose(file); + if (file == NULL || fgets(line, sizeof(line), file) == NULL) { + /* failed to read max_user_watches; sometimes inaccessible on Android */ + value = 0; + } + else + value = atoi(line); + + if (file) + fclose(file); break; } return value; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.6/system_test.sh new/entr-4.7/system_test.sh --- old/entr-4.6/system_test.sh 2020-07-01 17:33:17.000000000 +0200 +++ new/entr-4.7/system_test.sh 2021-01-29 15:36:21.000000000 +0100 @@ -93,7 +93,7 @@ # file system tests -try "exec a command an exit using one-shot option" +try "exec a command using one-shot option" setup ls $tmp/file* | ./entr -zp cat $tmp/file2 >$tmp/exec.out 2>$tmp/exec.err & bgpid=$! ; zz @@ -102,12 +102,18 @@ assert "$(cat $tmp/exec.err)" "" assert "$(head -n1 $tmp/exec.out)" "$(printf '456\n')" -try "fail to exec an command using one-shot option" +try "fail to exec a command using one-shot option" setup ls $tmp/file* | ./entr -z /usr/bin/false_X >$tmp/exec.out 2>$tmp/exec.err & bgpid=$! ; zz wait $bgpid || assert "$?" "1" +try "exec a command using one-shot option exit code from child" + setup + ls $tmp/file* | ./entr -z sh -c 'exit 4' & + bgpid=$! ; zz + wait $bgpid || assert "$?" "4" + try "restart a server when a file is modified using one-shot option" setup if [ $(uname) == 'Linux' ]; then @@ -294,6 +300,19 @@ kill -INT $bgpid ; zz assert "$(cat $tmp/exec.out)" "$(printf 'running\ncaught signal')" +try "ensure that all shell subprocesses are terminated when terminal is closed" + setup + cat <<-SCRIPT > $tmp/go.sh + #!/bin/sh + trap 'echo "caught signal"; exit' TERM + echo "running"; sleep 10 + SCRIPT + chmod +x $tmp/go.sh + ls $tmp/file2 | ./entr -r sh -c "$tmp/go.sh" 2> /dev/null > $tmp/exec.out & + bgpid=$! ; zz + kill -HUP $bgpid ; zz + assert "$(cat $tmp/exec.out)" "$(printf 'running\ncaught signal')" + try "exit with no action when restart and dirwatch flags are combined" setup echo "started." > $tmp/file1