diff options
81 files changed, 4801 insertions, 2266 deletions
diff --git a/Makefile.am b/Makefile.am index 27a23d8..d048213 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,18 +1,18 @@ -# This file is part of Direvent -*- autoconf -*- -# Copyright (C) 2012-2016 Sergey Poznyakoff +# This file is part of GNU direvent -*- autoconf -*- +# Copyright (C) 2012-2022 Sergey Poznyakoff # -# Direvent is free software; you can redistribute it and/or modify +# GNU direvent is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # -# Direvent is distributed in the hope that it will be useful, +# GNU direvent is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Direvent. If not, see <http://www.gnu.org/licenses/>. +# along with GNU direvent. If not, see <http://www.gnu.org/licenses/>. ACLOCAL_AMFLAGS = -I am -I grecs/am @@ -1,15 +1,63 @@ -direvent -- history of user-visible changes. 2016-08-25 -Copyright (C) 2012-2016 Sergey Poznyakoff +direvent -- history of user-visible changes. 2021-12-30 +Copyright (C) 2012-2022 Sergey Poznyakoff See the end of file for copying conditions. Please send direvent bug reports to <bug-direvent@gnu.org.ua> -Version 5.1.90 (Git) +Version 5.3, 2021-12-30 + +* Introduce compound events + +The "change" event is implemented on GNU/Linux and FreeBSD. This +event is delivered when a file was modified and closed. + +* New configuration statement for manipulating the environment. + +The "environ" statement is now a compound statement. It can contain +five kinds of substatements: "clear" to clear the environment, "keep" +to retain certain variables while clearing the environment, "set" to +set a variable, "unset" to unset a variable or variables, and "eval" +to evaluate a variable reference for side effects. + +Both "keep" and "unset" can take globbing pattern as their argument, +in which case they affect all variables matching that pattern. + +The value part in the "set" statement is subject to variable +expansion. + +The "environ" block can appear in global context as well. In this +case it applies to all watchers. + +The support for the old one-line "environ" syntax is retained for +backward compatibility. + +* Variable expansion in arguments to some configuration statements. + +Both macro and environment variables are expanded in arguments to all +substatements of the new "environ" block statement and in the argument +to the "command" statement. In the latter case, expansion of the +environment variables is controlled by the "shell" option. If the +option is set, the variable will be expanded by the shell. Otherwise, +they are expanded by direvent prior to invoking the command. + +* Rewrite the recursive watching support + +In particular, this fixes the bug where recursive watchers silently +assumed that the "create" generic event was configured for the +watcher. + +* Change interface for bulk closing of file descriptors + +To speed up launching of the user commands, system-dependent +interfaces for closing the file descriptors above the given one are +used, if available. + +Version 5.2, 2019-07-13 * The path statement can refer to a regular file. -Prior versions of direvent required that the argument to the "path" -statement refer to an existing directory. This requirement is now +Prior versions of direvent required the argument to the "path" +statement to refer to an existing directory. This requirement is now lifted. The pathname can refer to any type of file (not only a directory). Moreover, the file is not required to exist. If it does not exist, direvent will set up an auxiliary watcher (called a @@ -151,7 +199,7 @@ Initial release ========================================================================= Copyright information: -Copyright (C) 2012-2016 Sergey Poznyakoff +Copyright (C) 2012-2019 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the @@ -1,5 +1,5 @@ -Direvent README. -Copyright (C) 2012-2016 Sergey Poznyakoff +GNU direvent README. +Copyright (C) 2012-2022 Sergey Poznyakoff See the end of file for copying conditions. * Overview @@ -1,4 +1,4 @@ -Direvent THANKS file. +GNU direvent THANKS file. Karl Berry <karl@freefriends.org> Natalia Alifanova <na@nxc.no> diff --git a/acinclude.m4 b/acinclude.m4 index db374a3..8bb516d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,18 +1,18 @@ -# This file is part of Direvent -*- autoconf -*- -# Copyright (C) 2012-2016 Sergey Poznyakoff +# This file is part of GNU direvent -*- autoconf -*- +# Copyright (C) 2012-2022 Sergey Poznyakoff # -# Direvent is free software; you can redistribute it and/or modify +# GNU direvent is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # -# Direvent is distributed in the hope that it will be useful, +# GNU direvent is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Direvent. If not, see <http://www.gnu.org/licenses/>. +# along with GNU direvent. If not, see <http://www.gnu.org/licenses/>. AC_DEFUN([DEVT_CC_OPT],[ m4_pushdef([devt_optname],translit($1,[-],[_])) @@ -1,19 +1,19 @@ #! /bin/sh -# This file is part of Direvent -*- autoconf -*- -# Copyright (C) 2012-2016 Sergey Poznyakoff +# This file is part of GNU direvent -*- autoconf -*- +# Copyright (C) 2012-2022 Sergey Poznyakoff # -# Direvent is free software; you can redistribute it and/or modify +# GNU direvent is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # -# Direvent is distributed in the hope that it will be useful, +# GNU direvent is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Direvent. If not, see <http://www.gnu.org/licenses/>. +# along with GNU direvent. If not, see <http://www.gnu.org/licenses/>. if ! test -r configure.ac; then echo >&2 "$0: configure.ac not found" diff --git a/configure.ac b/configure.ac index 2b5677a..c5d59de 100644 --- a/configure.ac +++ b/configure.ac @@ -1,26 +1,26 @@ -# This file is part of Direvent -*- autoconf -*- -# Copyright (C) 2012-2016 Sergey Poznyakoff +# This file is part of GNU direvent -*- autoconf -*- +# Copyright (C) 2012-2022 Sergey Poznyakoff # -# Direvent is free software; you can redistribute it and/or modify +# GNU direvent is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # -# Direvent is distributed in the hope that it will be useful, +# GNU direvent is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Direvent. If not, see <http://www.gnu.org/licenses/>. +# along with GNU direvent. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ([2.69]) -AC_INIT([GNU Direvent], [5.1.90], [bug-direvent@gnu.org.ua], [direvent], +AC_INIT([GNU direvent], [5.3], [bug-direvent@gnu.org.ua], [direvent], [http://www.gnu.org.ua/software/direvent]) AC_CONFIG_SRCDIR([src/direvent.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([1.11.5 gnits tar-ustar silent-rules]) +AM_INIT_AUTOMAKE([1.15 gnits tar-ustar silent-rules std-options]) # Enable silent rules by default: AM_SILENT_RULES([yes]) @@ -63,6 +63,37 @@ AH_TOP([ #define IFACE_KQUEUE 1 /* kqueue - BSD */ ]) +# ################################# +# Select interface used to close file descriptors greater than or +# equal to the given one. +# +# Variants: +# 1. closefrom call (FreeBSD) +# 2. F_CLOSEM fcntl (NetBSD, AIX, IRIX) +# 3. proc_pidinfo call (Darwin) +# 4. /proc/self/fd filesystem (Linux) +# 5. Brute force +# +# The defines created here direct conditionalal compilation in +# src/closefds.c + +AC_CHECK_FUNCS([closefrom]) +AC_CHECK_DECL([F_CLOSEM], + AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], + [Use F_CLOSEM fcntl for mu_close_fds]), + [], + [#include <limits.h> + #include <fcntl.h> +]) + +AC_CHECK_HEADERS([libproc.h]) +AC_CHECK_FUNCS([proc_pidinfo]) + +if test -d "/proc/self/fd" ; then + AC_DEFINE([HAVE_PROC_SELF_FD], [1], [Define if you have /proc/self/fd]) +fi + + # Grecs subsystem GRECS_SETUP([grecs],[tree-api git2chg no-preproc getopt tests]) @@ -73,7 +104,7 @@ AM_ICONV AM_GNU_GETTEXT([external], [need-formatstring-macros]) AM_GNU_GETTEXT_VERSION([0.18]) -AC_SUBST(INCLUDE_PATH_ARGS,['$(pkgdatadir)/$(VERSION):$(pkgdatadir)/include']) +AC_SUBST(INCLUDE_PATH_ARGS,['$(pkgdatadir)/include:$(pkgdatadir)/$(VERSION)/include']) AC_ARG_WITH([include-path], [AC_HELP_STRING([--with-include-path=PATH], [set direvent runtime include path])], diff --git a/doc/.gitignore b/doc/.gitignore index a6ea4c9..9fac128 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -21,3 +21,4 @@ direvent.toc direvent.tp direvent.vr manual +otherdoc.texi diff --git a/doc/Makefile.am b/doc/Makefile.am index c182af1..875c6fa 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,18 +1,18 @@ -# This file is part of Direvent -*- autoconf -*- -# Copyright (C) 2012-2016 Sergey Poznyakoff +# This file is part of GNU direvent +# Copyright (C) 2012-2022 Sergey Poznyakoff # -# Direvent is free software; you can redistribute it and/or modify +# GNU direvent is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # -# Direvent is distributed in the hope that it will be useful, +# GNU direvent is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with Direvent. If not, see <http://www.gnu.org/licenses/>. +# along with GNU direvent. If not, see <http://www.gnu.org/licenses/>. info_TEXINFOS=direvent.texi direvent_TEXINFOS=\ @@ -21,22 +21,23 @@ direvent_TEXINFOS=\ dist_man_MANS=direvent.8 direvent.conf.5 EXTRA_DIST = \ - gendocs_template\ - gendocs.sh + gendocs.pl\ + otherdoc.texi.in\ + webdoc.init clean-local: @rm -rf manual -GENDOCS=$(srcdir)/gendocs.sh --no-copy-images --html '--init-file=$(abs_srcdir)/html.init' - -TEXI2DVI=texi2dvi -t '@set $(RENDITION)' +GENDOCS = perl gendocs.pl .PHONY: manual manual: + rm -rf manual TEXINPUTS=$(srcdir):$(top_srcdir)/build-aux:$(TEXINPUTS) \ MAKEINFO="$(MAKEINFO) $(MAKEINFOFLAGS) $(AM_MAKEINFOFLAGS)" \ - TEXI2DVI="$(TEXI2DVI)" \ - $(GENDOCS) $(PACKAGE) '$(PACKAGE_NAME) manual' + $(GENDOCS) -C manual -o otherdoc.texi $(PACKAGE) otherdoc.texi.in + $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -DWEBDOC \ + --html --init-file=webdoc.init $(info_TEXINFOS) -o manual manual.tar.bz2: manual tar cfj manual.tar.bz2 manual diff --git a/doc/direvent.8 b/doc/direvent.8 index 0d7f73f..2512b35 100644 --- a/doc/direvent.8 +++ b/doc/direvent.8 @@ -1,23 +1,23 @@ -.\" direvent - directory content watcher daemon -*- nroff -*- -.\" Copyright (C) 2012-2016 Sergey Poznyakoff +.\" GNU direvent - directory content watcher daemon -*- nroff -*- +.\" Copyright (C) 2012-2022 Sergey Poznyakoff .\" -.\" Direvent is free software; you can redistribute it and/or modify it +.\" GNU direvent is free software; you can redistribute it and/or modify it .\" under the terms of the GNU General Public License as published by the .\" Free Software Foundation; either version 3 of the License, or (at your .\" option) any later version. .\" -.\" Direvent is distributed in the hope that it will be useful, +.\" GNU direvent is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License along .\" with direvent. If not, see <http://www.gnu.org/licenses/>. -.TH DIREVENT 8 "August 25, 2016" "DIREVENT" "Direvent User Reference" +.TH DIREVENT 8 "December 29, 2021" "DIREVENT" "Direvent User Reference" .SH NAME direvent \- directory event monitor .SH SYNOPSIS -\fBdirevent\fR [\fB\-HVdfh\fR] [\fB\-F\fR \fINAME\fR]\ +\fBdirevent\fR [\fB\-HVdfht\fR] [\fB\-F\fR \fINAME\fR]\ [\fB\-P\fR \fIFILE\fR]\ [\fB\-l\fR \fIPRIO\fR]\ [\fB\-I\fR \fIDIR\fR]\ @@ -26,6 +26,7 @@ direvent \- directory event monitor [\fB\-\-facility\fR=\fINAME\fR]\ [\fB\-\-foreground\fB]\ [\fB\-\-include=\fIDIR\fR]\ + [\fB\-\-lint\fR]\ [\fB\-\-pidfile\fR=\fIFILE\fR]\ [\fB\-\-self\-test\fR=\fICOMMAND\fR]\ [\fB\-\-user\fR=\fINAME\fR]\ @@ -58,13 +59,17 @@ The following events can be monitored by the program: .TP .B create -A file was created; +A file was created. .TP .B delete -A file was deleted; +A file was deleted. .TP .B write -A file was written to; +A file was written to. +.TP +.B change +A file was modified and closed. This event is supported on GNU/Linux, +FreeBSD, and NetBSD. .TP .B attrib File attributes have changed. This includes changes in the file @@ -124,7 +129,7 @@ The option \fB\-F 0\fR directs logging to the standard error. .BR \-f ", " \-\-foreground Run in the foreground. .TP -\fB\-I\fR, \fB\-\-include=\fIDIR\fR +\fB\-I\fR, \fB\-\-include-directory=\fIDIR\fR Add \fIDIR\fR to the include search path. When looking for a file to be included in the \fB#include\fR (\fB#include_once\fR) statement, \fBdirevent\fR scans first the directories given with \fB\-I\fR @@ -148,7 +153,8 @@ severity): .BR alert , .BR emerg . When this option is given, only messages with the priority level equal -to or greater than \fIPRIO\fR will be duplicated on the standard error. +to or greater than \fIPRIO\fR will be duplicated on the standard +error. .TP \fB\-P\fR, \fB\-\-pidfile=\fIFILE\fR Write PID to \fIFILE\fR. @@ -169,7 +175,7 @@ in the environment of the parent \fBdirevent\fR process. The macro variable .B $self_test_pid holds the PID of the \fICOMMAND\fR (see section -.B MACRO EXPANSION +.B VARIABLE EXPANSION in .BR direvent.conf (5)). .TP @@ -211,14 +217,12 @@ characters are ignored as well, except as they serve to separate tokens. .PP A token is a string of consecutive characters from the following -classes: alphanumeric characters, underscores, dots, asteriscs, +classes: alphanumeric characters, underscores, dots, asterisks, slashes, semicolons, commercial at's, and dashes. .PP Any other sequence of characters must be enclosed in double quotation marks in order to represent a single token. .PP -Adjacent quoted strings are concatenated. -.PP Configuration statements consist of a keyword and value separated by any amount of whitespace and is terminated with a semicolon. A block statement is a collection of statements enclosed in curly braces. @@ -275,7 +279,7 @@ The program's logging is controlled by the \fBdebug\fR and .TP .BI "debug " NUMBER ; Sets the debugging level to \fINUMBER\fR -- an integer value between 0 -and 3. Zero is the default and means the debugging is disabled. The +and 4. Zero is the default and means the debugging is disabled. The bigger the \fINUMBER\fR the more detailed debugging information will be output. .PP @@ -303,9 +307,12 @@ Before executing, the following operations are performed: The current working directory is set to the directory where the event occurred. .IP \n+[step]. +If the global \fBenviron\fR statement is present, the current +environment is modified according to its rules. +.IP \n+[step]. If the \fBenviron\fR statement is present in the watcher, the -environment is modified according to its rules. See the description -of the \fBenviron\fR statement in +environment is further modified according to its rules. See the |