Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package inotify-tools for openSUSE:Factory 
checked in at 2022-05-08 21:52:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/inotify-tools (Old)
 and      /work/SRC/openSUSE:Factory/.inotify-tools.new.1538 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "inotify-tools"

Sun May  8 21:52:08 2022 rev:10 rq:975529 version:3.22.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/inotify-tools/inotify-tools.changes      
2021-11-10 21:46:51.891822347 +0100
+++ /work/SRC/openSUSE:Factory/.inotify-tools.new.1538/inotify-tools.changes    
2022-05-08 21:52:16.875457749 +0200
@@ -1,0 +2,8 @@
+Sat May  7 12:48:23 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 3.22.1.0:
+  * print to stderr if you fail to fopen file
+  * Properly terminate escaped CSV strings. (#158)
+  * Fix printing of filename when watching a file
+
+-------------------------------------------------------------------

Old:
----
  3.21.9.6.tar.gz

New:
----
  3.22.1.0.tar.gz

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

Other differences:
------------------
++++++ inotify-tools.spec ++++++
--- /var/tmp/diff_new_pack.HUHXUz/_old  2022-05-08 21:52:17.319458308 +0200
+++ /var/tmp/diff_new_pack.HUHXUz/_new  2022-05-08 21:52:17.323458313 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package inotify-tools
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           inotify-tools
-Version:        3.21.9.6
+Version:        3.22.1.0
 Release:        0
 Summary:        Tools for inotify
 License:        GPL-2.0-only

++++++ 3.21.9.6.tar.gz -> 3.22.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/.github/workflows/build.yml 
new/inotify-tools-3.22.1.0/.github/workflows/build.yml
--- old/inotify-tools-3.21.9.6/.github/workflows/build.yml      2021-09-28 
10:39:16.000000000 +0200
+++ new/inotify-tools-3.22.1.0/.github/workflows/build.yml      2022-01-18 
18:29:46.000000000 +0100
@@ -6,7 +6,8 @@
   build-1804:
 
     runs-on: ubuntu-18.04
-
+    env:
+      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     steps:
     - uses: actions/checkout@v1
     - name: build_and_test
@@ -15,7 +16,8 @@
   build-2004:
 
     runs-on: ubuntu-20.04
-
+    env:
+      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     steps:
     - uses: actions/checkout@v1
     - name: build_and_test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/build_and_test.sh 
new/inotify-tools-3.22.1.0/build_and_test.sh
--- old/inotify-tools-3.21.9.6/build_and_test.sh        2021-09-28 
10:39:16.000000000 +0200
+++ new/inotify-tools-3.22.1.0/build_and_test.sh        2022-01-18 
18:29:46.000000000 +0100
@@ -226,5 +226,28 @@
     --form version="$version" \
     --form description="$description" \
     https://scan.coverity.com/builds?project=$project
+
+  # sonarcloud
+  export SONAR_TOKEN="0bc5d48614caa711d6b908f80c039464aff99611"
+  mkdir -p $HOME/.sonar
+  SONAR_SCANNER_VERSION="4.4.0.2170"
+  
SONAR_SCANNER_DOWNLOAD_URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip";
+  curl -sSLo $HOME/.sonar/sonar-scanner.zip $SONAR_SCANNER_DOWNLOAD_URL
+  unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+  PATH="$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin:$PATH"
+  SONAR_SERVER_URL="https://sonarcloud.io";
+  
BUILD_WRAPPER_DOWNLOAD_URL="$SONAR_SERVER_URL/static/cpp/build-wrapper-linux-x86.zip"
+  curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip 
$BUILD_WRAPPER_DOWNLOAD_URL
+  unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
+  PATH="$HOME/.sonar/build-wrapper-linux-x86:$PATH"
+  BUILD_WRAPPER_OUT_DIR="build_wrapper_output_directory"
+  clean
+  export CC="gcc"
+  unset CFLAGS
+  unset LDFLAGS
+  ./autogen.sh
+  ./configure
+  build-wrapper-linux-x86-64 --out-dir $BUILD_WRAPPER_OUT_DIR make -j$j
+  sonar-scanner --define sonar.host.url="$SONAR_SERVER_URL" --define 
sonar.cfamily.build-wrapper-output="$BUILD_WRAPPER_OUT_DIR"
 fi
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/configure.ac 
new/inotify-tools-3.22.1.0/configure.ac
--- old/inotify-tools-3.21.9.6/configure.ac     2021-09-28 10:39:16.000000000 
+0200
+++ new/inotify-tools-3.22.1.0/configure.ac     2022-01-18 18:29:46.000000000 
+0100
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([inotify-tools], [3.21.9.6])
+AC_INIT([inotify-tools], [3.22.1.0])
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_SRCDIR([src/inotifywait.c])
 AC_CONFIG_HEADERS([config.h])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/inotify-tools-3.21.9.6/libinotifytools/src/inotifytools/inotifytools.h 
new/inotify-tools-3.22.1.0/libinotifytools/src/inotifytools/inotifytools.h
--- old/inotify-tools-3.21.9.6/libinotifytools/src/inotifytools/inotifytools.h  
2021-09-28 10:39:16.000000000 +0200
+++ new/inotify-tools-3.22.1.0/libinotifytools/src/inotifytools/inotifytools.h  
2022-01-18 18:29:46.000000000 +0100
@@ -39,6 +39,9 @@
 struct inotify_event;
 const char* inotifytools_dirname_from_event(struct inotify_event* event,
                                            size_t* dirnamelen);
+const char* inotifytools_filename_from_event(struct inotify_event* event,
+                                            char const** eventname,
+                                            size_t* dirnamelen);
 char* inotifytools_dirpath_from_event(struct inotify_event* event);
 struct watch;
 const char* inotifytools_filename_from_watch(struct watch* w);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/inotify-tools-3.21.9.6/libinotifytools/src/inotifytools.c 
new/inotify-tools-3.22.1.0/libinotifytools/src/inotifytools.c
--- old/inotify-tools-3.21.9.6/libinotifytools/src/inotifytools.c       
2021-09-28 10:39:16.000000000 +0200
+++ new/inotify-tools-3.22.1.0/libinotifytools/src/inotifytools.c       
2022-01-18 18:29:46.000000000 +0100
@@ -17,21 +17,22 @@
 #include "inotifytools_p.h"
 #include "stats.h"
 
-#include <string.h>
-#include <strings.h>
-#include <stdlib.h>
+#include <dirent.h>
+#include <errno.h>
+#include <limits.h>
+#include <regex.h>
+#include <setjmp.h>
 #include <stdint.h>
 #include <stdio.h>
-#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/ioctl.h>
 #include <sys/select.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <dirent.h>
+#include <sys/types.h>
 #include <time.h>
-#include <regex.h>
-#include <setjmp.h>
+#include <unistd.h>
 
 #include "inotifytools/inotify.h"
 
@@ -160,6 +161,7 @@
 int verbosity = 0;
 int fanotify_mode = 0;
 int fanotify_mark_type = 0;
+static pid_t self_pid = 0;
 static char* timefmt = 0;
 static regex_t* regex = 0;
 /* 0: --exclude[i], 1: --include[i] */
@@ -304,6 +306,7 @@
        // Try to initialise inotify/fanotify
        if (fanotify) {
 #ifdef LINUX_FANOTIFY
+               self_pid = getpid();
                fanotify_mode = 1;
                fanotify_mark_type =
                    watch_filesystem ? FAN_MARK_FILESYSTEM : FAN_MARK_INODE;
@@ -893,15 +896,18 @@
 const char* inotifytools_dirname_from_event(struct inotify_event* event,
                                            size_t* dirnamelen) {
        const char* filename = inotifytools_filename_from_wd(event->wd);
-       char* dirsep;
+       const char* dirsep = NULL;
 
        if (!filename) {
                return NULL;
        }
 
-       dirsep = strrchr(filename, '/');
+       /* Split dirname from filename for fanotify event */
+       if (fanotify_mode)
+               dirsep = strrchr(filename, '/');
        if (!dirsep) {
-               return NULL;
+               *dirnamelen = strlen(filename);
+               return filename;
        }
 
        *dirnamelen = dirsep - filename + 1;
@@ -909,6 +915,32 @@
 }
 
 /**
+ * Get the watched path and filename from an event.
+ *
+ * Returns the filename either recorded for event->wd or
+ * from event->name and the watched filename for event->wd.
+ *
+ * The caller should NOT free() the returned strings.
+ */
+const char* inotifytools_filename_from_event(struct inotify_event* event,
+                                            char const** eventname,
+                                            size_t* dirnamelen) {
+       if (event->len > 0)
+               *eventname = event->name;
+       else
+               *eventname = "";
+
+       const char* filename =
+           inotifytools_dirname_from_event(event, dirnamelen);
+
+       /* On fanotify watch, filename includes event->name */
+       if (filename && filename[*dirnamelen])
+               *eventname = filename + *dirnamelen;
+
+       return filename;
+}
+
+/**
  * Get the directory path from an event.
  *
  * Returns the filename recorded for event->wd or NULL.
@@ -1408,6 +1440,7 @@
 
        setjmp(jmp);
 
+       pid_t event_pid = 0;
        error = 0;
 
        // first_byte is index into event buffer
@@ -1583,6 +1616,7 @@
                ret->len = name_len;
                if (name_len > 0)
                        memcpy(ret->name, name, name_len);
+               event_pid = meta->pid;
        } else {
                first_byte += sizeof(struct inotify_event) + ret->len;
        }
@@ -1595,6 +1629,11 @@
                first_byte = 0;
        }
 
+       /* Skip events from self due to open_by_handle_at() */
+       if (self_pid && self_pid == event_pid) {
+               longjmp(jmp, 0);
+       }
+
        if (regex) {
                inotifytools_snprintf(&match_name, MAX_STRLEN, ret, "%w%f");
                memcpy(&match_name_string, &match_name.buf, match_name.len);
@@ -2029,22 +2068,16 @@
  */
 int inotifytools_snprintf( struct nstring * out, int size,
                            struct inotify_event* event, char* fmt ) {
-       static const char* filename;
-       static char *eventname, *eventstr;
+       const char* eventstr;
        static unsigned int i, ind;
        static char ch1;
        static char timestr[MAX_STRLEN];
         static time_t now;
 
-        if ( event->len > 0 ) {
-               eventname = event->name;
-       }
-       else {
-               eventname = NULL;
-       }
-
        size_t dirnamelen = 0;
-       filename = inotifytools_dirname_from_event(event, &dirnamelen);
+       const char* eventname;
+       const char* filename =
+           inotifytools_filename_from_event(event, &eventname, &dirnamelen);
 
        if ( !fmt || 0 == strlen(fmt) ) {
                error = EINVAL;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/man/inotifywait.1.in 
new/inotify-tools-3.22.1.0/man/inotifywait.1.in
--- old/inotify-tools-3.21.9.6/man/inotifywait.1.in     2021-09-28 
10:39:16.000000000 +0200
+++ new/inotify-tools-3.22.1.0/man/inotifywait.1.in     2022-01-18 
18:29:46.000000000 +0100
@@ -196,12 +196,14 @@
 .TP
 %w
 This will be replaced with the name of the Watched file on which an event 
occurred.
+When an event occurs within a Watched directory or when watching with fanotify,
+this will be replaced with the name of the Directory in which the event 
occurred.
 
 .TP
 %f
-When an event occurs within a directory, this will be replaced with the name 
of the
-File which caused the event to occur.  Otherwise, this will be replaced with an
-empty string.
+When an event occurs within a Watched directory or when watching with fanotify,
+this will be replaced with the name of the File which caused the event to 
occur.
+Otherwise, this will be replaced with an empty string.
 
 .TP
 %e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/sonar-project.properties 
new/inotify-tools-3.22.1.0/sonar-project.properties
--- old/inotify-tools-3.21.9.6/sonar-project.properties 1970-01-01 
01:00:00.000000000 +0100
+++ new/inotify-tools-3.22.1.0/sonar-project.properties 2022-01-18 
18:29:46.000000000 +0100
@@ -0,0 +1,13 @@
+sonar.projectKey=inotify-tools_inotify-tools
+sonar.organization=inotify-tools
+
+# This is the name and version displayed in the SonarCloud UI.
+#sonar.projectName=inotify-tools
+#sonar.projectVersion=1.0
+
+# Path is relative to the sonar-project.properties file. Replace "\" by "/" on 
Windows.
+#sonar.sources=.
+
+# Encoding of the source code. Default is default system encoding
+#sonar.sourceEncoding=UTF-8
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/src/common.c 
new/inotify-tools-3.22.1.0/src/common.c
--- old/inotify-tools-3.21.9.6/src/common.c     2021-09-28 10:39:16.000000000 
+0200
+++ new/inotify-tools-3.22.1.0/src/common.c     2022-01-18 18:29:46.000000000 
+0100
@@ -104,6 +104,10 @@
                        file = stdin;
                } else {
                        file = fopen(filename, "r");
+                       if (!file) {
+                               fprintf(stderr, "Couldn't open %s: %s\n",
+                                       filename, strerror(errno));
+                       }
                }
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/src/inotifywait.c 
new/inotify-tools-3.22.1.0/src/inotifywait.c
--- old/inotify-tools-3.21.9.6/src/inotifywait.c        2021-09-28 
10:39:16.000000000 +0200
+++ new/inotify-tools-3.22.1.0/src/inotifywait.c        2022-01-18 
18:29:46.000000000 +0100
@@ -56,16 +56,16 @@
 
 void print_help();
 
-static char* csv_escape_len(const char* string, size_t len) {
+static const char* csv_escape_len(const char* string, size_t len) {
        static char csv[MAX_STRLEN + 1];
        static unsigned int i, ind;
 
        if (string == NULL) {
-               return NULL;
+               return "";
        }
 
        if (len == 0 || len > MAX_STRLEN) {
-               return NULL;
+               return "";
        }
 
        // May not need escaping
@@ -73,6 +73,7 @@
            !strchr(string, '\n') && string[0] != ' ' &&
            string[len - 1] != ' ') {
                strncpy(csv, string, len);
+               csv[len] = '\0';
                return csv;
        }
 
@@ -91,9 +92,9 @@
        return csv;
 }
 
-static char* csv_escape(const char* string) {
+static const char* csv_escape(const char* string) {
        if (string == NULL) {
-               return NULL;
+               return "";
        }
 
        return csv_escape_len(string, strlen(string));
@@ -131,15 +132,20 @@
 
 void output_event_csv(struct inotify_event *event) {
        size_t dirnamelen = 0;
-       const char* dirname =
-           inotifytools_dirname_from_event(event, &dirnamelen);
-       char* filename = csv_escape_len(dirname, dirnamelen);
-       if (filename != NULL)
+       const char* eventname;
+       const char* filename =
+           inotifytools_filename_from_event(event, &eventname, &dirnamelen);
+       filename = csv_escape_len(filename, dirnamelen);
+       if (filename && *filename)
                printf("%s,", filename);
+       // eventname may be pointing into snprintf buffer
+       char* name = strdup(eventname);
 
        printf("%s,", csv_escape(inotifytools_event_to_str(event->mask)));
-       if (event->len > 0)
-               printf("%s", csv_escape(event->name));
+       if (name) {
+               printf("%s", csv_escape(name));
+               free(name);
+       }
        printf("\n");
 }
 
@@ -560,7 +566,6 @@
                                print_help();
                                // Shouldn't process any further...
                                return false;
-                               break;
 
                        // --monitor or -m
                        case 'm':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inotify-tools-3.21.9.6/src/inotifywatch.c 
new/inotify-tools-3.22.1.0/src/inotifywatch.c
--- old/inotify-tools-3.21.9.6/src/inotifywatch.c       2021-09-28 
10:39:16.000000000 +0200
+++ new/inotify-tools-3.22.1.0/src/inotifywatch.c       2022-01-18 
18:29:46.000000000 +0100
@@ -491,7 +491,6 @@
                                print_help();
                                // Shouldn't process any further...
                                return false;
-                               break;
 
                        // --verbose or -v
                        case 'v':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/inotify-tools-3.21.9.6/t/inotifywait-csv-watched-dir.t 
new/inotify-tools-3.22.1.0/t/inotifywait-csv-watched-dir.t
--- old/inotify-tools-3.21.9.6/t/inotifywait-csv-watched-dir.t  1970-01-01 
01:00:00.000000000 +0100
+++ new/inotify-tools-3.22.1.0/t/inotifywait-csv-watched-dir.t  2022-01-18 
18:29:46.000000000 +0100
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+test_description='Issue #157
+
+Check --csv format of event on a file when watching the parent directory
+'
+
+. ./fanotify-common.sh
+. ./sharness.sh
+
+logfile="log"
+watchpath="$(realpath .)"
+
+run_() {
+    # Setup code, defer an ATTRIB event for after
+    # inotifywait has been set up.
+    timeout=2 &&
+    touch $logfile test-file &&
+    {(sleep 1 && chmod 777 test-file)&} &&
+
+    export LD_LIBRARY_PATH="../../libinotifytools/src/"
+    ../../src/$* \
+        --csv \
+        --quiet \
+        --daemon \
+        --outfile $logfile \
+        --event ATTRIB \
+        --timeout $timeout \
+        "$watchpath" &&
+    # No way to use 'wait' for a process that is not a child of this one,
+    # sleep instead until inotifywait's timeout is reached.
+    sleep $timeout
+}
+
+run_and_check_log()
+{
+    rm -f $logfile
+    run_ $* && cp log /tmp/ && grep "^$watchpath/,ATTRIB,test-file\$" $logfile
+}
+
+test_expect_success 'event logged' '
+    run_and_check_log inotifywait
+'
+
+if fanotify_supported; then
+    test_expect_success 'event logged' '
+       run_and_check_log fsnotifywait --fanotify
+    '
+fi
+
+test_done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/inotify-tools-3.21.9.6/t/inotifywait-csv-watched-file.t 
new/inotify-tools-3.22.1.0/t/inotifywait-csv-watched-file.t
--- old/inotify-tools-3.21.9.6/t/inotifywait-csv-watched-file.t 1970-01-01 
01:00:00.000000000 +0100
+++ new/inotify-tools-3.22.1.0/t/inotifywait-csv-watched-file.t 2022-01-18 
18:29:46.000000000 +0100
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+test_description='Issue #157
+
+Check --csv format of event on a file when watching the file itself
+'
+
+. ./sharness.sh
+
+logfile="log"
+watchpath="$(realpath test-file)"
+
+run_() {
+    # Setup code, defer an ATTRIB event for after
+    # inotifywait has been set up.
+    timeout=2 &&
+    touch $logfile test-file &&
+    {(sleep 1 && chmod 777 test-file)&} &&
+
+    export LD_LIBRARY_PATH="../../libinotifytools/src/"
+    ../../src/$* \
+        --csv \
+        --quiet \
+        --daemon \
+        --outfile $logfile \
+        --event ATTRIB \
+        --timeout $timeout \
+        "$watchpath" &&
+    # No way to use 'wait' for a process that is not a child of this one,
+    # sleep instead until inotifywait's timeout is reached.
+    sleep $timeout
+}
+
+run_and_check_log()
+{
+    rm -f $logfile
+    run_ $* && grep "^$watchpath,ATTRIB,\$" $logfile
+}
+
+test_expect_success 'event logged' '
+    run_and_check_log inotifywait
+'
+
+test_done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/inotify-tools-3.21.9.6/t/inotifywait-format-watched-dir.t 
new/inotify-tools-3.22.1.0/t/inotifywait-format-watched-dir.t
--- old/inotify-tools-3.21.9.6/t/inotifywait-format-watched-dir.t       
1970-01-01 01:00:00.000000000 +0100
+++ new/inotify-tools-3.22.1.0/t/inotifywait-format-watched-dir.t       
2022-01-18 18:29:46.000000000 +0100
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+test_description='Issue #157
+
+Check printed format of event on a file when watching the parent directory
+'
+
+. ./fanotify-common.sh
+. ./sharness.sh
+
+logfile="log"
+watchpath="$(realpath .)"
+
+run_() {
+    # Setup code, defer an ATTRIB event for after
+    # inotifywait has been set up.
+    timeout=2 &&
+    touch $logfile test-file &&
+    {(sleep 1 && chmod 777 test-file)&} &&
+
+    export LD_LIBRARY_PATH="../../libinotifytools/src/"
+    ../../src/$* \
+        --quiet \
+        --daemon \
+        --outfile $logfile \
+        --event ATTRIB \
+        --timeout $timeout \
+        "$watchpath" &&
+    # No way to use 'wait' for a process that is not a child of this one,
+    # sleep instead until inotifywait's timeout is reached.
+    sleep $timeout
+}
+
+run_and_check_log()
+{
+    rm -f $logfile
+    run_ $* && cp log /tmp/ && grep "^$watchpath/ ATTRIB test-file\$" $logfile
+}
+
+test_expect_success 'event logged' '
+    run_and_check_log inotifywait
+'
+
+if fanotify_supported; then
+    test_expect_success 'event logged' '
+       run_and_check_log fsnotifywait --fanotify
+    '
+fi
+
+test_done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/inotify-tools-3.21.9.6/t/inotifywait-format-watched-file.t 
new/inotify-tools-3.22.1.0/t/inotifywait-format-watched-file.t
--- old/inotify-tools-3.21.9.6/t/inotifywait-format-watched-file.t      
1970-01-01 01:00:00.000000000 +0100
+++ new/inotify-tools-3.22.1.0/t/inotifywait-format-watched-file.t      
2022-01-18 18:29:46.000000000 +0100
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+test_description='Issue #157
+
+Check printed format of event on a file when watching the file itself
+'
+
+. ./sharness.sh
+
+logfile="log"
+watchpath="$(realpath test-file)"
+
+run_() {
+    # Setup code, defer an ATTRIB event for after
+    # inotifywait has been set up.
+    timeout=2 &&
+    touch $logfile test-file &&
+    {(sleep 1 && chmod 777 test-file)&} &&
+
+    export LD_LIBRARY_PATH="../../libinotifytools/src/"
+    ../../src/$* \
+        --quiet \
+        --daemon \
+        --outfile $logfile \
+        --event ATTRIB \
+        --timeout $timeout \
+        "$watchpath" &&
+    # No way to use 'wait' for a process that is not a child of this one,
+    # sleep instead until inotifywait's timeout is reached.
+    sleep $timeout
+}
+
+run_and_check_log()
+{
+    rm -f $logfile
+    run_ $* && grep "^$watchpath ATTRIB \$" $logfile
+}
+
+test_expect_success 'event logged' '
+    run_and_check_log inotifywait
+'
+
+test_done

Reply via email to