Bug#885248: syslog-ng: FTBFS on hurd-i386: typos in get_path_max

2017-12-27 Thread Svante Signell
tags 885248 patch
thanks

On Mon, 2017-12-25 at 22:43 -0500, Aaron M. Ucko wrote:
> Source: syslog-ng
> Version: 3.13.2-1
> Severity: important
> Tags: upstream
> Justification: fails to build from source (but built successfully in
> the past)
> 
> Builds of syslog-ng for hurd-i386 (admittedly not a release
> architecture) have been failing lately:
> 
>  pathmax++;
>  ^~~

> It's great that directory-monitor.c already attempts to accommodate
> systems like the Hurd with no fixed PATH_MAX, but there are a couple
> of typos in the relevant code.  Please try removing the unbalanced
> (and unneeded) { on line 65 and fixing the spelling of path_max on
> line 87.

Attached is a patch fixing the PATH_MAX issue. In fact the whole
function get_path_max() is obsolete with the patch. For now it is
commented out.

Regarding the GNU/Hurd build one (1/70) test fails: 

FAIL: lib/logproto/tests/test_logproto
==

[2017-12-27T21:07:38.64] Plugin module not found in 'module-path';
module-path='(null)', module='syslogformat'

Until the cause for module-path being null is found the build will not
succeed. However, the PATH_MAX issue is solved.
(A suspicion is that that a python module creates that empty module-
path. To be verified and solved.)

Thanks!Index: syslog-ng-3.13.2/modules/affile/directory-monitor.c
===
--- syslog-ng-3.13.2.orig/modules/affile/directory-monitor.c
+++ syslog-ng-3.13.2/modules/affile/directory-monitor.c
@@ -51,6 +51,7 @@ build_filename(const gchar *basedir, con
   return result;
 }
 
+#if 0
 #define PATH_MAX_GUESS 1024
 
 static inline long
@@ -84,11 +85,12 @@ get_path_max(void)
  * the terminating null byte.  Same goes for XPG3.
  */
 if ((posix_version < 200112L) && (xsi_version < 4))
-  pathmax++;
+  path_max++;
 #endif
 }
   return path_max;
 }
+#endif
 
 /*
  Resolve . and ..
@@ -98,16 +100,14 @@ get_path_max(void)
 gchar *
 resolve_to_absolute_path(const gchar *path, const gchar *basedir)
 {
-  long path_max = get_path_max();
-  gchar *res;
+  gchar *res = NULL;
   gchar *w_name;
 
   w_name = build_filename(basedir, path);
-  res = (char *)g_malloc(path_max);
+  res = realpath(w_name, NULL);
 
-  if (!realpath(w_name, res))
+  if (res == NULL)
 {
-  g_free(res);
   if (errno == ENOENT)
 {
   res = g_strdup(path);


Bug#885248: syslog-ng: FTBFS on hurd-i386: typos in get_path_max

2017-12-25 Thread Aaron M. Ucko
Source: syslog-ng
Version: 3.13.2-1
Severity: important
Tags: upstream
Justification: fails to build from source (but built successfully in the past)

Builds of syslog-ng for hurd-i386 (admittedly not a release
architecture) have been failing lately:

  /<>/debian/build-tree/../../modules/affile/directory-monitor.c: 
In function 'get_path_max':
  
/<>/debian/build-tree/../../modules/affile/directory-monitor.c:87:11:
 error: 'pathmax' undeclared (first use in this function); did you mean 
'path_max'?
 pathmax++;
 ^~~
 path_max
  
/<>/debian/build-tree/../../modules/affile/directory-monitor.c:87:11:
 note: each undeclared identifier is reported only once for each function it 
appears in
  
/<>/debian/build-tree/../../modules/affile/directory-monitor.c:126:1:
 error: invalid storage class for function '_get_real_path'
  [...]

It's great that directory-monitor.c already attempts to accommodate
systems like the Hurd with no fixed PATH_MAX, but there are a couple
of typos in the relevant code.  Please try removing the unbalanced
(and unneeded) { on line 65 and fixing the spelling of path_max on
line 87.

Thanks!

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/?a...@monk.mit.edu