Hello community, here is the log from the commit of package entr for openSUSE:Factory checked in at 2020-01-06 15:22:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/entr (Old) and /work/SRC/openSUSE:Factory/.entr.new.6675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "entr" Mon Jan 6 15:22:21 2020 rev:6 rq:761023 version:4.4 Changes: -------- --- /work/SRC/openSUSE:Factory/entr/entr.changes 2019-10-08 19:57:41.320240909 +0200 +++ /work/SRC/openSUSE:Factory/.entr.new.6675/entr.changes 2020-01-06 15:22:24.164487548 +0100 @@ -1,0 +2,10 @@ +Sun Jan 5 19:24:47 UTC 2020 - Martin Hauke <[email protected]> + +- Update to version 4.4 + * Use a single inotify queue on Linux, limited by + /proc/sys/fs/inotify/max_user_watches + * Set the environment variable `ENTR_INOTIFY_WORKAROUND` to + enable a compatibility mode for platforms with deformed + inotify support + +------------------------------------------------------------------- Old: ---- entr-4.3.tar.gz New: ---- entr-4.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ entr.spec ++++++ --- /var/tmp/diff_new_pack.p0lcC6/_old 2020-01-06 15:22:24.772487863 +0100 +++ /var/tmp/diff_new_pack.p0lcC6/_new 2020-01-06 15:22:24.772487863 +0100 @@ -1,7 +1,7 @@ # # spec file for package entr # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2016 Daniel Lichtenberger # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: entr -Version: 4.3 +Version: 4.4 Release: 0 Summary: A utility for running arbitrary commands when files change License: ISC ++++++ entr-4.3.tar.gz -> entr-4.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/.gitignore new/entr-4.4/.gitignore --- old/entr-4.3/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/entr-4.4/.gitignore 2020-01-02 21:20:12.000000000 +0100 @@ -0,0 +1,3 @@ +Makefile +entr +entr_spec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/Makefile.bsd new/entr-4.4/Makefile.bsd --- old/entr-4.3/Makefile.bsd 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/Makefile.bsd 2020-01-02 21:20:12.000000000 +0100 @@ -1,6 +1,6 @@ PREFIX ?= /usr/local MANPREFIX ?= ${PREFIX}/man -RELEASE = 4.3 +RELEASE = 4.4 CPPFLAGS += -DRELEASE=\"${RELEASE}\" all: versioncheck entr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/NEWS new/entr-4.4/NEWS --- old/entr-4.3/NEWS 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/NEWS 2020-01-02 21:20:12.000000000 +0100 @@ -1,5 +1,12 @@ = Release History +== 4.4: January 02, 2019 + + - Use a single inotify queue on Linux, limited by + /proc/sys/fs/inotify/max_user_watches + - Set the environment variable `ENTR_INOTIFY_WORKAROUND` to enable a + compatibility mode for platforms with deformed inotify support + == 4.3: September 25, 2019 - Move hosting from bitbucket.org to github.com diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/README.md new/entr-4.4/README.md --- old/entr-4.3/README.md 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/README.md 2020-01-02 21:20:12.000000000 +0100 @@ -14,27 +14,11 @@ To see available build options run `./configure -h` -Source Installation - Windows Subsystem for Linux -------------------------------------------------- +Docker and Windows Subsystem for Linux +-------------------------------------- - wget http://eradman.com/entrproject/patches/entr-3.9-wsl - patch -p1 < entr-3.9-wsl - ./configure - make install - -The source patch is the current workaround for deformed [inotify -support on WSL](https://github.com/Microsoft/BashOnWindows/issues/2507). - -Source Installation - Docker for Mac ------------------------------------- - - wget http://eradman.com/entrproject/patches/entr-3.9-docker - patch -p1 < entr-3.9-docker - ./configure - make install - -The source patch is the current workaround for deformed [inotify -support on Docker for Mac](https://github.com/docker/for-mac/issues/896). +To enable a workaround for incomplete inotify support on WSL or Docker for Mac, +set the environment variable `ENTR_INOTIFY_WORKAROUND`. Man Page Examples ----------------- @@ -47,10 +31,6 @@ $ ls *.js | entr -r node app.js -Launch and auto-reload a node.js server as a background task: - - $ (ls *.js | entr -r node app.js &) - Clear the screen and run a query after the SQL script is updated: $ echo my.sql | entr -p psql -f /_ @@ -59,12 +39,16 @@ $ while true; do ls src/*.rb | entr -d make; done +Self-terminate after a file is updated + + $ ls * | entr -p 'kill $PPID' + News ---- A release history as well as features in the upcoming release are covered in the [NEWS] file. -[kqueue(2)]: http://man.openbsd.org/OpenBSD-current/man2/kqueue.2 +[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.3/entr.1 new/entr-4.4/entr.1 --- old/entr-4.3/entr.1 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/entr.1 2020-01-02 21:20:12.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 March 28, 2019 +.Dd November 27, 2019 .Dt ENTR 1 .Os .Sh NAME @@ -25,7 +25,7 @@ .Ar utility .Op Ar argument /_ ... .Sh DESCRIPTION -A list of files provided on the standard input and the +A list of files provided on standard input, and the .Ar utility is executed using the supplied arguments if any of them change. .Nm @@ -40,7 +40,7 @@ Respond to all events which occur while the .Ar utility is running. -Without this option +Without this option, .Nm consolidates events in order to avoid looping. This option has no effect in conjunction with the @@ -83,13 +83,13 @@ waits for the .Ar utility to exit to ensure that resources such as sockets have been closed. -Control of the TTY is not transferred the child process. +Control of the TTY is not transferred to the child process. .It Fl s Evaluate the first argument using the interpreter specified by the .Ev SHELL environment variable. -If stdout is a TTY, the name of the shell and exit code is printed after each -invocation. +If standard output is a TTY, the name of the shell and exit code is printed +after each invocation. .El .Pp The first argument named @@ -98,20 +98,21 @@ The first file under watch is used as the default. If the .Fl s -option is used, the name of the first file to triggler an event can be read from +option is used, the name of the first file to trigger an event can be read from .Va $0 . .Sh COMMANDS .Nm listens for keyboard input and responds to the following commands: -.Bl -tag -width Ic -.It SPACE +.Bl -tag -width <space> +.It Aq Cm space Execute the utility immediately. If the -.Ql -r +.Fl Cm r option is set this will terminate and restart the child process as if a file change event had occurred. -.It q -Quit; equivalent pressing Ctrl\-C. +.It Cm q +Quit; equivalent pressing +.Aq Cm control-C . .El .Sh ENVIRONMENT If @@ -120,8 +121,8 @@ .Nm will assign .Pa /bin/cat -to prevent interactive utilities from waiting for -keyboard input if output does not fit on the screen. +to prevent interactive utilities from waiting for keyboard input if output does +not fit on the screen. .Pp If .Ev SHELL @@ -135,33 +136,33 @@ utility exits with one of the following values: .Pp .Bl -tag -width Ds -offset indent -compact -.It Li 0 +.It 0 .Dv SIGINT or .Dv SIGTERM was received -.It Li 1 +.It 1 No regular files were provided as input or an error occurred -.It Li 2 +.It 2 A file was added to a directory and the directory watch option was specified .El .Sh EXAMPLES Rebuild a project if source files change, limiting output to the first 20 lines: .Pp -.Dl $ find src/ | entr -s 'make | head -n 20' +.Dl $ find src/ | entr -s 'make | sed 20q' .Pp Launch and auto-reload a node.js server: .Pp .Dl $ ls *.js | entr -r node app.js .Pp -Launch and auto-reload a node.js server as a background task: -.Pp -.Dl $ (ls *.js | entr -r node app.js &) -.Pp Clear the screen and run a query after the SQL script is updated: .Pp -.Dl $ echo my.sql | entr -p psql -f /_ +.Dl $ echo my.sql | entr -cp psql -f /_ .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 +.Pp +Self-terminate after a file is updated +.Pp +.Dl $ ls * | entr -p 'kill $PPID' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/entr.c new/entr-4.4/entr.c --- old/entr-4.3/entr.c 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/entr.c 2020-01-02 21:20:12.000000000 +0100 @@ -144,11 +144,15 @@ if (sigemptyset(&act.sa_mask) & (sigaction(SIGTERM, &act, NULL) != 0)) err(1, "Failed to set SIGTERM handler"); - /* raise soft limit */ getrlimit(RLIMIT_NOFILE, &rl); +#if defined(_LINUX_PORT) + rl.rlim_cur = (rlim_t)fs_sysctl(INOTIFY_MAX_USER_WATCHES); +#else + /* 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 /* prevent interactive utilities from paging output */ setenv("PAGER", "/bin/cat", 0); @@ -368,7 +372,7 @@ argc = 4; arg_buf = malloc(ARG_MAX); new_argv = calloc(argc+1, sizeof(char *)); - (void) xrealpath(leading_edge->fn, arg_buf); + xrealpath(leading_edge->fn, arg_buf); new_argv[0] = getenv("SHELL"); new_argv[1] = "-c"; new_argv[2] = argv[0]; @@ -399,11 +403,11 @@ if (pid == 0) { if (clear_opt == 1) - (void) system("/usr/bin/clear"); + system("/usr/bin/clear"); /* Set process group so subprocess can be signaled */ if (restart_opt == 1) { setpgid(0, getpid()); - (void) close(STDIN_FILENO); + close(STDIN_FILENO); } /* wait up to 1 seconds for each file to become available */ for (i=0; i < 10; i++) { @@ -576,8 +580,11 @@ NOTE_ALL, 0, file); if (xkevent(kq, &evSet, 1, NULL, 0, NULL) == -1) err(1, "failed to remove VNODE event"); +#if !defined(_LINUX_PORT) + /* free file descriptor no longer monitored by kqueue */ if ((file->fd != -1) && (close(file->fd) == -1)) err(1, "unable to close file"); +#endif watch_file(kq, file); collate_only = 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/entr_spec.c new/entr-4.4/entr_spec.c --- old/entr-4.3/entr_spec.c 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/entr_spec.c 2020-01-02 21:20:12.000000000 +0100 @@ -879,7 +879,7 @@ FILE *fake; fake = fmemopen(input, strlen(input), "r"); - (void) process_input(fake, files, 3); + process_input(fake, files, 3); leading_edge = files[1]; run_utility(argv); @@ -901,7 +901,7 @@ FILE *fake; fake = fmemopen(input, strlen(input), "r"); - (void) process_input(fake, files, 3); + process_input(fake, files, 3); leading_edge = files[0]; run_utility(argv); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/missing/compat.h new/entr-4.4/missing/compat.h --- old/entr-4.3/missing/compat.h 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/missing/compat.h 2020-01-02 21:20:12.000000000 +0100 @@ -9,6 +9,11 @@ size_t strlcpy(char *to, const char *from, int l); #endif +#if defined(_LINUX_PORT) +#define INOTIFY_MAX_USER_WATCHES 2 +int fs_sysctl(const int name); +#endif + #if defined(_MACOS_PORT) #include <stdio.h> FILE *fmemopen(void *buf, size_t size, const char *mode); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entr-4.3/missing/kqueue_inotify.c new/entr-4.4/missing/kqueue_inotify.c --- old/entr-4.3/missing/kqueue_inotify.c 2019-09-26 01:23:28.000000000 +0200 +++ new/entr-4.4/missing/kqueue_inotify.c 2020-01-02 21:20:12.000000000 +0100 @@ -53,6 +53,25 @@ return NULL; /* lookup failed */ } +int +fs_sysctl(const int name) { + FILE *file; + char line[8]; + int value = 0; + + 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); + break; + } + return value; +} + /* interface */ #define EVENT_SIZE (sizeof (struct inotify_event)) @@ -60,11 +79,17 @@ #define IN_ALL IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB|IN_CREATE /* - * Conveniently inotify and kqueue ids both have the type `int` + * inotify and kqueue ids both have the type `int` */ int kqueue(void) { - return inotify_init(); + static int inotify_queue; + + if (inotify_queue == 0) + inotify_queue = inotify_init(); + if (getenv("ENTR_INOTIFY_WORKAROUND")) + warnx("broken inotify workaround enabled"); + return inotify_queue; } /* @@ -115,8 +140,10 @@ file->fd = -1; /* invalidate */ } else if (kev->flags & EV_ADD) { - wd = inotify_add_watch(kq /* ifd */, file->fn, - IN_ALL); + if (getenv("ENTR_INOTIFY_WORKAROUND")) + wd = inotify_add_watch(kq, file->fn, IN_ALL|IN_MODIFY); + else + wd = inotify_add_watch(kq, file->fn, IN_ALL); if (wd < 0) return -1; close(file->fd); @@ -162,6 +189,8 @@ if (iev->mask & IN_CREATE) fflags |= NOTE_WRITE; if (iev->mask & IN_MOVE_SELF) fflags |= NOTE_RENAME; if (iev->mask & IN_ATTRIB) fflags |= NOTE_ATTRIB; + if (getenv("ENTR_INOTIFY_WORKAROUND")) + if (iev->mask & IN_MODIFY) fflags |= NOTE_WRITE; if (fflags == 0) continue; /* merge events if we're not acting on a new file descriptor */ @@ -196,6 +225,6 @@ } while ((poll(pfd, nfds, 50) > 0)); - (void) free(pfd); + free(pfd); return n; }
