I'll try to look at this no later than this weekend...

Thanks!

On Sun, Sep 01, 2019 at 06:19:17PM +0200, Gero Treuner wrote:
> Hi Derek,
> 
> On Wed, Aug 28, 2019 at 02:16:10PM -0700, Kevin J. McCarthy wrote:
> > On Mon, Aug 26, 2019 at 02:12:56PM -0500, Derek Martin wrote:
> > > /home/ddm/tmp/mutt-1.12.1/buffy.c:276: undefined reference to 
> > > `mutt_monitor_remove'
> > > /home/ddm/tmp/mutt-1.12.1/buffy.c:310: undefined reference to 
> > > `mutt_monitor_remove'
> > > /home/ddm/tmp/mutt-1.12.1/buffy.c:326: undefined reference to 
> > > `mutt_monitor_add'
> > 
> > I think I know what the problem is: it's an improper usage of
> > AC_CHECK_FUNCS.  I'm guessing your system has one or more of
> > "inotify_init1() inotify_add_watch() inotify_rm_watch()" but not all of
> > them.
> 
> Probably only inotify_init1() is missing, which can easily be replaced.
> 
> If it's this - verifyable by config.status - then the attached patch
> helps not only to compile, but makes inotify running for Mutt on your
> system.  I tested it by simulating this scenario in the build, leading
> to a binary using the alternate function.
> 
> > I'll push a patch to stable, but for now just keep the
> > '--disable-filemontor'.  The fix will just end up disabling it on your
> > system.
> 
> I created a merge request in GitLab. 
> 
> If Derek can confirm that we are guessing right (I noticed that this
> might not be soon) this can be committed.
> 
> 
> Gero

> diff -ur mutt-1.12.1.orig/config.h.in mutt-1.12.1/config.h.in
> --- mutt-1.12.1.orig/config.h.in      2019-06-15 18:07:25.000000000 +0200
> +++ mutt-1.12.1/config.h.in   2019-09-01 17:38:05.794709214 +0200
> @@ -223,6 +223,9 @@
>  /* Define to 1 if you have the `inotify_add_watch' function. */
>  #undef HAVE_INOTIFY_ADD_WATCH
>  
> +/* Define to 1 if you have the `inotify_init' function. */
> +#undef HAVE_INOTIFY_INIT
> +
>  /* Define to 1 if you have the `inotify_init1' function. */
>  #undef HAVE_INOTIFY_INIT1
>  
> diff -ur mutt-1.12.1.orig/configure mutt-1.12.1/configure
> --- mutt-1.12.1.orig/configure        2019-06-15 18:04:19.000000000 +0200
> +++ mutt-1.12.1/configure     2019-09-01 17:38:05.670708221 +0200
> @@ -619,6 +619,7 @@
>  # include <unistd.h>
>  #endif"
>  
> +ac_func_list=
>  ac_header_list=
>  ac_subst_vars='am__EXEEXT_FALSE
>  am__EXEEXT_TRUE
> @@ -2610,6 +2611,7 @@
>    >$cache_file
>  fi
>  
> +as_fn_append ac_func_list " inotify_init1"
>  as_fn_append ac_header_list " stdlib.h"
>  as_fn_append ac_header_list " unistd.h"
>  as_fn_append ac_header_list " sys/param.h"
> @@ -11065,7 +11067,7 @@
>  
>  
>  if test x$have_filemonitor != xno ; then
> -        for ac_func in inotify_init1 inotify_add_watch inotify_rm_watch
> +        for ac_func in inotify_init inotify_add_watch inotify_rm_watch
>  do :
>    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
>  ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
> @@ -11074,18 +11076,33 @@
>  #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
>  _ACEOF
>  
> +else
> +  have_filemonitor=no
> +fi
> +done
> +
> +        if test x$have_filemonitor != xno ; then
>  
>  $as_echo "#define USE_INOTIFY 1" >>confdefs.h
>  
>  
> -else
>  
> -                have_filemonitor=no
> +
> +  for ac_func in $ac_func_list
> +do :
> +  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
> +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
> +if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
> +  cat >>confdefs.h <<_ACEOF
> +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
> +_ACEOF
>  
>  fi
>  done
>  
> -        if test x$have_filemonitor != xno ; then
> +
> +
> +
>                  for ac_header in sys/inotify.h
>  do :
>    ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" 
> "ac_cv_header_sys_inotify_h" "$ac_includes_default"
> diff -ur mutt-1.12.1.orig/configure.ac mutt-1.12.1/configure.ac
> --- mutt-1.12.1.orig/configure.ac     2019-06-15 17:57:01.000000000 +0200
> +++ mutt-1.12.1/configure.ac  2019-09-01 17:27:18.933520732 +0200
> @@ -854,14 +854,11 @@
>  ])
>  
>  if test x$have_filemonitor != xno ; then
> -        AC_CHECK_FUNCS(inotify_init1 inotify_add_watch inotify_rm_watch,
> -        [
> -                AC_DEFINE(USE_INOTIFY,1,[ Define if want to use inotify for 
> filesystem monitoring (available in Linux only). ])
> -        ],
> -        [
> -                have_filemonitor=no
> -        ])
> +        AC_CHECK_FUNCS(inotify_init inotify_add_watch inotify_rm_watch,
> +                       [], [have_filemonitor=no])
>          if test x$have_filemonitor != xno ; then
> +                AC_DEFINE(USE_INOTIFY,1,[ Define if want to use inotify for 
> filesystem monitoring (available in Linux only). ])
> +                AC_CHECK_FUNCS_ONCE(inotify_init1)
>                  AC_CHECK_HEADERS(sys/inotify.h)
>                  MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS monitor.o"
>          fi
> diff -ur mutt-1.12.1.orig/monitor.c mutt-1.12.1/monitor.c
> --- mutt-1.12.1.orig/monitor.c        2019-05-25 18:22:39.000000000 +0200
> +++ mutt-1.12.1/monitor.c     2019-09-01 17:26:55.173329944 +0200
> @@ -25,6 +25,9 @@
>  # include <unistd.h>
>  # include <poll.h>
>  #endif
> +#ifndef HAVE_INOTIFY_INIT1
> +# include <fcntl.h>
> +#endif
>  
>  #include "mutt.h"
>  #include "buffy.h"
> @@ -106,12 +109,23 @@
>  {
>    if (INotifyFd == -1)
>    {
> +#if HAVE_INOTIFY_INIT1
>      INotifyFd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
>      if (INotifyFd == -1)
>      {
>        dprint (2, (debugfile, "monitor: inotify_init1 failed, errno=%d %s\n", 
> errno, strerror(errno)));
>        return -1;
>      }
> +#else
> +    INotifyFd = inotify_init();
> +    if (INotifyFd == -1)
> +    {
> +      dprint (2, (debugfile, "monitor: inotify_init failed, errno=%d %s\n", 
> errno, strerror(errno)));
> +      return -1;
> +    }
> +    fcntl(INotifyFd, F_SETFL, O_NONBLOCK);
> +    fcntl(INotifyFd, F_SETFD, FD_CLOEXEC);
> +#endif
>      mutt_poll_fd_add(0, POLLIN);
>      mutt_poll_fd_add(INotifyFd, POLLIN);
>    }


-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

Reply via email to