Codebase list entr / 4a55f8a
New upstream snapshot. Debian Janitor 2 years ago
8 changed file(s) with 43 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
00 PREFIX ?= /usr/local
11 MANPREFIX ?= ${PREFIX}/man
2 RELEASE = 5.0
2 RELEASE = 5.1
33 CPPFLAGS += -DRELEASE=\"${RELEASE}\"
44
55 all: versioncheck entr
0 = Next Release: 5.1
1
2 - Detect files moved to or from directories on Linux
3 - Allow detection of directory entries beginning with '.' by specifying '-d' twice
4
05 = Release History
16
27 == 5.0: July 2, 2021
0 entr (5.0+git20210813.1.a27e47c-1) UNRELEASED; urgency=low
1
2 * New upstream snapshot.
3
4 -- Debian Janitor <janitor@jelmer.uk> Wed, 10 Nov 2021 07:03:47 -0000
5
06 entr (5.0-1) unstable; urgency=medium
17
28 [ Yuri D'Elia ]
1212 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1313 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414 .\"
15 .Dd July 2, 2021
15 .Dd August 13, 2021
1616 .Dt ENTR 1
1717 .Os
1818 .Sh NAME
5454 Track the directories of regular files provided as input and exit if a new file
5555 is added.
5656 This option also enables directories to be specified explicitly.
57 Files with names beginning with
57 If specified twice, all new entries to a directory are recognized,
58 otherwise files with names beginning with
5859 .Ql \&.
5960 are ignored.
6061 .It Fl n
3030 #include <stdio.h>
3131 #include <stdlib.h>
3232 #include <string.h>
33 #include <termios.h>
3334 #include <time.h>
3435 #include <unistd.h>
35 #include <termios.h>
3636
3737 #include "missing/compat.h"
3838
7878 int clear_opt;
7979 int dirwatch_opt;
8080 int noninteractive_opt;
81 int oneshot_opt;
8182 int postpone_opt;
8283 int restart_opt;
8384 int shell_opt;
84 int oneshot_opt;
8585 struct termios canonical_tty;
8686
8787 /* forwards */
317317 n_files++;
318318 }
319319 /* also watch the directory if it's not already in the list */
320 if (dirwatch_opt == 1) {
320 if (dirwatch_opt > 0) {
321321 if (S_ISDIR(sb.st_mode) != 0)
322322 path = &buf[0];
323323 else
350350 if (dfd == NULL)
351351 errx(1, "unable to open directory: '%s'", dir);
352352 while((dp = readdir(dfd)) != NULL)
353 if (dp->d_name[0] != '.')
353 if ((dirwatch_opt == 2) || (dp->d_name[0] != '.'))
354354 count++;
355355 closedir(dfd);
356356 return count;
376376 clear_opt = clear_opt ? 2 : 1;
377377 break;
378378 case 'd':
379 dirwatch_opt = 1;
379 dirwatch_opt = dirwatch_opt ? 2 : 1;
380380 break;
381381 case 'n':
382382 noninteractive_opt = 1;
8383 clear_opt = 0;
8484 dirwatch_opt = 0;
8585 noninteractive_opt = 0;
86 oneshot_opt = 0;
8687 postpone_opt = 0;
8788 restart_opt = 0;
8889 shell_opt = 0;
89 oneshot_opt = 0;
9090
9191 leading_edge = 0;
9292 files = calloc(max_files, sizeof(WatchFile *));
933933 signal(SIGSEGV, sighandler);
934934
935935 /* set up pointers to test doubles */
936 xstat = fake_stat;
936 xerrx = fake_errx;
937 xexecvp = fake_execvp;
938 xfork = fake_fork;
939 xfree = fake_free;
937940 xkevent = fake_kevent;
938941 xkillpg = fake_killpg;
939 xwaitpid = fake_waitpid;
940 xexecvp = fake_execvp;
941 xfork = fake_fork;
942 xlist_dir = fake_list_dir;
942943 xopen = fake_open;
943944 xrealpath = fake_realpath;
944 xfree = fake_free;
945 xerrx = fake_errx;
945 xstat = fake_stat;
946 xtcsetattr = fake_tcsetattr;
947 xwaitpid = fake_waitpid;
946948 xwarnx = fake_warnx;
947 xlist_dir = fake_list_dir;
948 xtcsetattr = fake_tcsetattr;
949949
950950 /* all tests */
951951 run(process_input_01);
8080
8181 #define EVENT_SIZE (sizeof (struct inotify_event))
8282 #define EVENT_BUF_LEN (32 * (EVENT_SIZE + 16))
83 #define IN_ALL IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB|IN_CREATE
83 #define IN_ALL IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF|IN_MOVED_TO|IN_MOVED_FROM|IN_ATTRIB|IN_CREATE
8484
8585 /*
8686 * inotify and kqueue ids both have the type `int`
191191 if (iev->mask & IN_CLOSE_WRITE) fflags |= NOTE_WRITE;
192192 if (iev->mask & IN_CREATE) fflags |= NOTE_WRITE;
193193 if (iev->mask & IN_MOVE_SELF) fflags |= NOTE_RENAME;
194 if (iev->mask & IN_MOVED_TO) fflags |= NOTE_RENAME;
195 if (iev->mask & IN_MOVED_FROM) fflags |= NOTE_RENAME;
194196 if (iev->mask & IN_ATTRIB) fflags |= NOTE_ATTRIB;
195197 if (getenv("ENTR_INOTIFY_WORKAROUND"))
196198 if (iev->mask & IN_MODIFY) fflags |= NOTE_WRITE;
172172 assert "$(cat $tmp/exec.out)" "ping"
173173 assert "$(cat $tmp/exec.err)" "entr: directory altered"
174174 rmdir $tmp/newdir
175
176 try "exec single shell utility and exit when a hidden subdirectory is added"
177 setup
178 ls -d $tmp | ./entr -ddp sh -c 'echo ping' >$tmp/exec.out 2>$tmp/exec.err \
179 || true &
180 bgpid=$! ; zz
181 mkdir $tmp/.newdir
182 wait $bgpid || assert "$?" "130"
183 assert "$(cat $tmp/exec.out)" "ping"
184 assert "$(cat $tmp/exec.err)" "entr: directory altered"
185 rmdir $tmp/.newdir
175186
176187 try "exec single shell utility and exit when a file is added to a specific path"
177188 setup