Bug #636512 -------- Forwarded Message -------- From: Svante Signell <s...@kth.se> Reply-to: <s...@kth.se> To: Debian Bug Tracking System <sub...@bugs.debian.org> Subject: acl: Fix FTBFS on hurd-i386 Date: Wed, 3 Aug 2011 19:36:27 +0200
Package: acl Version: 2.2.51-3 Severity: important Tags: patch User: debian-h...@lists.debian.org Usertags: hurd Hi, currently acl does not compile on hurd-i386. The problem is a PATH_MAX definition which is not supported on GNU/Hurd. Attached are two patches which fixes these issues. First patch is conditioned on __GNU__ and will not affect other systems, while the second patch is changing behaviour for all systems (and assuming getline is available). Thanks, Svante
--- acl-2.2.51/setfacl/parse.c.orig 2010-01-22 23:00:28.000000000 +0000 +++ acl-2.2.51/setfacl/parse.c 2011-08-03 17:03:19.000000000 +0000 @@ -419,7 +419,13 @@ bytes for "# file: ". Not a good solution but for now it is the best I can do without too much impact on the code. [tw] */ + +#ifdef __GNU__ + char *linebuf; + size_t dummy = 0; +#else char linebuf[(4*PATH_MAX)+9]; +#endif char *cp; char *p; int comments_read = 0; @@ -449,9 +455,13 @@ if (line) (*line)++; +#ifdef __GNU__ + if (getline(&linebuf, &dummy, file) == -1) + break; +#else if (fgets(linebuf, sizeof(linebuf), file) == NULL) break; - +#endif comments_read = 1; p = strrchr(linebuf, '\0'); @@ -473,7 +483,12 @@ goto fail; *path_p = (char*)malloc(strlen(cp)+1); if (!*path_p) + { +#ifdef __GNU__ + free (linebuf); +#endif return -1; + } strcpy(*path_p, cp); } } else if (strncmp(cp, "owner:", 6) == 0) { @@ -522,13 +537,24 @@ } } if (ferror(file)) + { +#ifdef __GNU__ + free (linebuf); +#endif return -1; + } +#ifdef __GNU__ + free (linebuf); +#endif return comments_read; fail: if (path_p && *path_p) { free(*path_p); *path_p = NULL; } +#ifdef __GNU__ + free (linebuf); +#endif return -EINVAL; }
--- acl-2.2.51/setfacl/parse.c.orig 2010-01-22 23:00:28.000000000 +0000 +++ acl-2.2.51/setfacl/parse.c 2011-08-03 17:10:24.000000000 +0000 @@ -419,7 +419,9 @@ bytes for "# file: ". Not a good solution but for now it is the best I can do without too much impact on the code. [tw] */ - char linebuf[(4*PATH_MAX)+9]; + + char *linebuf; + size_t dummy = 0; char *cp; char *p; int comments_read = 0; @@ -449,9 +451,8 @@ if (line) (*line)++; - if (fgets(linebuf, sizeof(linebuf), file) == NULL) + if (getline(&linebuf, &dummy, file) == -1) break; - comments_read = 1; p = strrchr(linebuf, '\0'); @@ -472,8 +473,10 @@ if (*path_p) goto fail; *path_p = (char*)malloc(strlen(cp)+1); - if (!*path_p) - return -1; + if (!*path_p) { + free (linebuf); + return -1; + } strcpy(*path_p, cp); } } else if (strncmp(cp, "owner:", 6) == 0) { @@ -521,14 +524,18 @@ *flags = f; } } - if (ferror(file)) - return -1; + if (ferror(file)) { + free (linebuf); + return -1; + } + free (linebuf); return comments_read; fail: if (path_p && *path_p) { free(*path_p); *path_p = NULL; } + free (linebuf); return -EINVAL; }