Hello community,

here is the log from the commit of package entr for openSUSE:Factory checked in 
at 2020-07-07 12:59:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/entr (Old)
 and      /work/SRC/openSUSE:Factory/.entr.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "entr"

Tue Jul  7 12:59:30 2020 rev:7 rq:819045 version:4.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/entr/entr.changes        2020-01-06 
15:22:24.164487548 +0100
+++ /work/SRC/openSUSE:Factory/.entr.new.3060/entr.changes      2020-07-07 
13:00:32.238169960 +0200
@@ -1,0 +2,17 @@
+Thu Jul  2 19:25:35 UTC 2020 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 4.6
+  * Always call waitpid(2) to avoid dead processes
+  * Duplicate STDIN file descriptor before closing; for the '-r'
+    option
+
+-------------------------------------------------------------------
+Tue Apr 21 19:39:03 UTC 2020 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 4.5
+  * New '-z' "one-shot" option self-terminates after the utility
+    exits
+  * Termination by 'q' or 'SIGINT' results in an exit status of 0
+- Add source verification
+
+-------------------------------------------------------------------

Old:
----
  entr-4.4.tar.gz

New:
----
  entr-4.6.tar.gz
  entr-4.6.tar.gz.sig
  entr.keyring

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ entr.spec ++++++
--- /var/tmp/diff_new_pack.9pRn7k/_old  2020-07-07 13:00:37.654187632 +0200
+++ /var/tmp/diff_new_pack.9pRn7k/_new  2020-07-07 13:00:37.658187646 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package entr
 #
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 # Copyright (c) 2016 Daniel Lichtenberger
 #
 # All modifications and additions to the file contributed by third parties
@@ -18,13 +18,15 @@
 
 
 Name:           entr
-Version:        4.4
+Version:        4.6
 Release:        0
 Summary:        A utility for running arbitrary commands when files change
 License:        ISC
 Group:          Development/Tools/Other
 URL:            https://bitbucket.org/eradman/entr
 Source:         http://eradman.com/entrproject/code/%{name}-%{version}.tar.gz
+Source1:        
http://eradman.com/entrproject/code/%{name}-%{version}.tar.gz.asc#/%{name}-%{version}.tar.gz.sig
+Source99:       %{name}.keyring
 
 %description
 A utility for running arbitrary commands when files change. Uses

++++++ entr-4.4.tar.gz -> entr-4.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/Makefile.bsd new/entr-4.6/Makefile.bsd
--- old/entr-4.4/Makefile.bsd   2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/Makefile.bsd   2020-07-01 17:33:17.000000000 +0200
@@ -1,6 +1,6 @@
 PREFIX ?= /usr/local
 MANPREFIX ?= ${PREFIX}/man
-RELEASE = 4.4
+RELEASE = 4.6
 CPPFLAGS += -DRELEASE=\"${RELEASE}\"
 
 all: versioncheck entr
@@ -50,4 +50,4 @@
 versioncheck:
        @head -n3 NEWS | egrep -q "^= Next Release: ${RELEASE}|^== ${RELEASE}: "
 
-.PHONY: all env test gcc-lint clean distclean install uninstall versioncheck
+.PHONY: all env test gcc-lint regress clean distclean install uninstall 
versioncheck
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/NEWS new/entr-4.6/NEWS
--- old/entr-4.4/NEWS   2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/NEWS   2020-07-01 17:33:17.000000000 +0200
@@ -1,6 +1,16 @@
 = Release History
 
-== 4.4: January 02, 2019
+== 4.6: July 1, 2020
+
+ - Always call waitpid(2) to avoid dead processes
+ - Duplicate STDIN file descriptor before closing; for the '-r' option
+
+== 4.5: April 20, 2020
+
+ - New '-z' "one-shot" option self-terminates after the utility exits
+ - Termination by 'q' or 'SIGINT' results in an exit status of 0
+
+== 4.4: January 02, 2020
 
  - Use a single inotify queue on Linux, limited by
    /proc/sys/fs/inotify/max_user_watches
@@ -222,7 +232,7 @@
 
 == 1.8: May 12, 2013
 
- - Ensure that loosing a file under watch is results in an error
+ - Ensure that losing a file under watch is results in an error
 
 == 1.7: November 20, 2012
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/README.md new/entr-4.6/README.md
--- old/entr-4.4/README.md      2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/README.md      2020-07-01 17:33:17.000000000 +0200
@@ -17,8 +17,15 @@
 Docker and Windows Subsystem for Linux
 --------------------------------------
 
-To enable a workaround for incomplete inotify support on WSL or Docker for Mac,
-set the environment variable `ENTR_INOTIFY_WORKAROUND`.
+Incomplete inotify support on WSL and Docker for Mac can cause `entr`
+to respond inconsistently. Since version 4.4, `entr` includes a workaround:
+Set the environment variable `ENTR_INOTIFY_WORKAROUND`.
+
+`entr` will confirm the workaround is enabled:
+
+```
+entr: broken inotify workaround enabled
+```
 
 Man Page Examples
 -----------------
@@ -29,7 +36,7 @@
 
 Launch and auto-reload a node.js server:
 
-    $ ls *.js | entr -r node app.js
+    $ find . -name '*.js' | entr -r node app.js
 
 Clear the screen and run a query after the SQL script is updated:
 
@@ -37,11 +44,11 @@
 
 Rebuild project if a source file is modified or added to the src/ directory:
 
-    $ while true; do ls src/*.rb | entr -d make; done
+    $ while true; do find . -name 'src/*.rb' | entr -d make; done
 
 Self-terminate after a file is updated
 
-    $ ls * | entr -p 'kill $PPID'
+    $ find . -type f | entr -p 'kill $PPID'
 
 News
 ----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/data.h new/entr-4.6/data.h
--- old/entr-4.4/data.h 2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/data.h 2020-07-01 17:33:17.000000000 +0200
@@ -29,5 +29,5 @@
        ino_t ino;
 } WatchFile;
 
-/* declare as extern in source */
-WatchFile **files;
+/* defined in entr.c */
+extern WatchFile **files;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/entr.1 new/entr-4.6/entr.1
--- old/entr-4.4/entr.1 2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/entr.1 2020-07-01 17:33:17.000000000 +0200
@@ -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 November 27, 2019
+.Dd April 17, 2020
 .Dt ENTR 1
 .Os
 .Sh NAME
@@ -90,6 +90,16 @@
 environment variable.
 If standard output is a TTY, the name of the shell and exit code is printed
 after each invocation.
+.It Fl z
+Exit after the
+.Ar utility
+completes.
+When combined with
+.Fl r
+the
+.Ar utility
+will be restarted again only in response to commands or file system
+events.
 .El
 .Pp
 The first argument named
@@ -137,10 +147,13 @@
 .Pp
 .Bl -tag -width Ds -offset indent -compact
 .It 0
+Normal termination after receiving
 .Dv SIGINT
-or
-.Dv SIGTERM
-was received
+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
@@ -163,6 +176,6 @@
 .Pp
 .Dl $ while true; do ls src/*.rb | entr -d make; done
 .Pp
-Self-terminate after a file is updated
+Auto-reload a web server, or terminate if the server exits
 .Pp
-.Dl $ ls * | entr -p 'kill $PPID'
+.Dl $ ls * | entr -rz ./httpd
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/entr.c new/entr-4.6/entr.c
--- old/entr-4.4/entr.c 2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/entr.c 2020-07-01 17:33:17.000000000 +0200
@@ -69,9 +69,10 @@
 /* globals */
 
 extern int optind;
-extern WatchFile **files;
+WatchFile **files;
 WatchFile *leading_edge;
 int child_pid;
+int terminating;
 
 int aggressive_opt;
 int clear_opt;
@@ -80,6 +81,7 @@
 int postpone_opt;
 int restart_opt;
 int shell_opt;
+int oneshot_opt;
 struct termios canonical_tty;
 
 /* forwards */
@@ -87,6 +89,7 @@
 static void usage();
 static void terminate_utility();
 static void handle_exit(int sig);
+static void proc_exit(int sig);
 static int process_input(FILE *, WatchFile *[], int);
 static int set_options(char *[]);
 static int list_dir(char *);
@@ -135,15 +138,22 @@
        if (argc < 2) usage();
        argv_index = set_options(argv);
 
+       sigemptyset(&act.sa_mask);
+
        /* normally a user will exit this utility by do_execting Ctrl-C */
-       act.sa_flags = 0;
        act.sa_flags = SA_RESETHAND;
        act.sa_handler = handle_exit;
-       if (sigemptyset(&act.sa_mask) & (sigaction(SIGINT, &act, NULL) != 0))
+       if (sigaction(SIGINT, &act, NULL) != 0)
                err(1, "Failed to set SIGINT handler");
-       if (sigemptyset(&act.sa_mask) & (sigaction(SIGTERM, &act, NULL) != 0))
+       if (sigaction(SIGTERM, &act, NULL) != 0)
                err(1, "Failed to set SIGTERM handler");
 
+       /* notification used to combine the one-shot and restart options */
+       act.sa_flags = 0;
+       act.sa_handler = proc_exit;
+       if (sigaction(SIGCHLD, &act, NULL) != 0)
+               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);
@@ -216,11 +226,15 @@
 terminate_utility() {
        int status;
 
+       terminating = 1;
+
        if (child_pid > 0) {
                xkillpg(child_pid, SIGTERM);
                xwaitpid(child_pid, &status, 0);
                child_pid = 0;
        }
+
+       terminating = 0;
 }
 
 /* Callbacks */
@@ -230,9 +244,30 @@
        if (!noninteractive_opt)
                xtcsetattr(0, TCSADRAIN, &canonical_tty);
        terminate_utility();
-       raise(sig);
+       if (sig == SIGINT)
+           exit(0);
+       else
+           raise(sig);
 }
 
+void
+proc_exit(int sig) {
+       int status;
+
+       xwaitpid(child_pid, &status, 0);
+       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));
+               }
+               if (WEXITSTATUS(status) == 99)
+                       exit(1);
+               else
+                       exit(0);
+       }
+}
+
+
 /*
  * Read lines from a file stream (normally STDIN).  Returns the number of
  * regular files to be watched or -1 if max_files is exceeded.
@@ -246,7 +281,6 @@
        int i, matches;
 
        while (fgets(buf, sizeof(buf), file) != NULL) {
-               buf[PATH_MAX-1] = '\0';
                if ((p = strchr(buf, '\n')) != NULL)
                        *p = '\0';
                if (buf[0] == '\0')
@@ -316,7 +350,7 @@
 
        /* read arguments until we reach a command */
        for (argc=1; argv[argc] != 0 && argv[argc][0] == '-'; argc++);
-       while ((ch = getopt(argc, argv, "acdnprs")) != -1) {
+       while ((ch = getopt(argc, argv, "acdnprsz")) != -1) {
                switch (ch) {
                case 'a':
                        aggressive_opt = 1;
@@ -339,6 +373,9 @@
                case 's':
                        shell_opt = 1;
                        break;
+               case 'z':
+                       oneshot_opt = 1;
+                       break;
                default:
                        usage();
                }
@@ -363,10 +400,16 @@
        char **new_argv;
        char *p, *arg_buf;
        int argc;
+       int stdin_pipe[2];
 
-       if (restart_opt == 1)
+       if (restart_opt == 1) {
                terminate_utility();
 
+               if (pipe(stdin_pipe) != 0)
+                       err(1, "Failed to create stdin pipe");
+               close(stdin_pipe[1]);
+       }
+
        if (shell_opt == 1) {
                /* run argv[1] with a shell using the leading edge as $0 */
                argc = 4;
@@ -407,16 +450,17 @@
                /* Set process group so subprocess can be signaled */
                if (restart_opt == 1) {
                        setpgid(0, getpid());
-                       close(STDIN_FILENO);
+                       dup2(stdin_pipe[0], STDIN_FILENO);
                }
                /* wait up to 1 seconds for each file to become available */
                for (i=0; i < 10; i++) {
                        ret = xexecvp(new_argv[0], new_argv);
-                       if (errno == ETXTBSY) nanosleep(&delay, NULL);
+                       if (errno == ETXTBSY)
+                               nanosleep(&delay, NULL);
                        else break;
                }
                if (ret != 0)
-                       err(1, "exec %s", new_argv[0]);
+                       err(99, "exec %s", new_argv[0]);
        }
        child_pid = pid;
 
@@ -425,6 +469,9 @@
                if (shell_opt == 1)
                        fprintf(stdout, "%s returned exit code %d\n",
                            basename(getenv("SHELL")), WEXITSTATUS(status));
+
+               if (oneshot_opt == 1)
+                       exit(0);
        }
 
        xfree(arg_buf);
@@ -537,8 +584,8 @@
                dir_modified = 0;
        }
 
-       if (nev == -1)
-               err(1, "kevent failed");
+       if ((nev == -1) && (errno != EINTR))
+               warn("kevent failed");
 
        /* escape for test runner */
        if ((nev == -2) && (collate_only == 0))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/entr_spec.c new/entr-4.6/entr_spec.c
--- old/entr-4.4/entr_spec.c    2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/entr_spec.c    2020-07-01 17:33:17.000000000 +0200
@@ -87,6 +87,7 @@
        postpone_opt = 0;
        restart_opt = 0;
        shell_opt = 0;
+       oneshot_opt = 0;
 
        leading_edge = 0;
        files = calloc(max_files, sizeof(WatchFile *));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/entr-4.4/system_test.sh new/entr-4.6/system_test.sh
--- old/entr-4.4/system_test.sh 2020-01-02 21:20:12.000000000 +0100
+++ new/entr-4.6/system_test.sh 2020-07-01 17:33:17.000000000 +0200
@@ -93,6 +93,36 @@
 
 # file system tests
 
+try "exec a command an exit using one-shot option"
+       setup
+       ls $tmp/file* | ./entr -zp cat $tmp/file2 >$tmp/exec.out 
2>$tmp/exec.err &
+       bgpid=$! ; zz
+       echo 456 >> $tmp/file2 ; zz
+       wait $bgpid || assert "$?" "0"
+       assert "$(cat $tmp/exec.err)" ""
+       assert "$(head -n1 $tmp/exec.out)" "$(printf '456\n')"
+
+try "fail to exec an 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 "restart a server when a file is modified using one-shot option"
+       setup
+       if [ $(uname) == 'Linux' ]; then
+               skip "GNU nc spins while retrying SELECT(2); busybox does not 
support domain sockets"
+       else
+               ls $tmp/file2 | ./entr -rz nc -l -U $tmp/nc.s >> $tmp/exec.out &
+               bgpid=$! ; zz
+               echo "123" | nc -NU $tmp/nc.s 2> /dev/null || {
+                       echo "123" | nc -U $tmp/nc.s
+               } ; zz
+               echo 456 >> $tmp/file2 ; zz
+               wait $bgpid || assert "$?" "130"
+               assert "$(cat $tmp/exec.out)" "123"
+       fi
+
 try "exec a command in non-intertive mode"
        setup
        ls $tmp/file* | ./entr -n tty >$tmp/exec.out &
@@ -109,6 +139,14 @@
        wait $bgpid || assert "$?" "130"
        assert "$(cat $tmp/exec.out)" "1"
 
+try "exec a command as a background task, and verify that read from stdin 
doesn't complain"
+       setup
+       ls $tmp/file* | ./entr -r sh -c 'read X' 2>$tmp/exec.err &
+       bgpid=$! ; zz
+       kill -INT $bgpid
+       wait $bgpid || assert "$?" "130"
+       assert "$(cat $tmp/exec.err)" ""
+
 try "exec single shell utility and exit when a file is added to an implicit 
watch path"
        setup
        ls $tmp/file* | ./entr -dp sh -c 'echo ping' >$tmp/exec.out 
2>$tmp/exec.err \
@@ -183,7 +221,7 @@
        git init -q
        git add *.h
        git commit -m "initial checkin" -q
-       for f in `ls *.h`; do
+       for f in `ls *.h | head`; do
                chmod 644 $f
                echo "" >> $f
        done


Reply via email to