Bug 67229 - [PATCH] fix build on GNU/Hurd
Summary: [PATCH] fix build on GNU/Hurd
Status: RESOLVED FIXED
Alias: None
Product: libxkbcommon
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: All other
: medium normal
Assignee: Daniel Stone
QA Contact: Ran Benita
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-23 20:33 UTC by Pino Toscano
Modified: 2013-07-24 09:19 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Get rid of the usage of PATH_MAX (4.94 KB, patch)
2013-07-23 20:33 UTC, Pino Toscano
Details | Splinter Review
Get rid of the usage of PATH_MAX (5.61 KB, patch)
2013-07-24 08:21 UTC, Pino Toscano
Details | Splinter Review

Description Pino Toscano 2013-07-23 20:33:27 UTC
Created attachment 82874 [details] [review]
Get rid of the usage of PATH_MAX

Currently, libxkbcommon does not compile on GNU/Hurd; this happens because on the Hurd PATH_MAX (optional in POSIX) is not provided, while such constant is unconditionally used in two places (a source of the main library, and in the test suite).

Attached there is a patch that gets rid of the PATH_MAX usages, allocating and freeing buffers as needed. To avoid too many malloc/free in the for loop in FindFileInXkbPath, a buffer is grown according to the size needed at each iteration.
Comment 1 Ran Benita 2013-07-24 07:39:50 UTC
Comment on attachment 82874 [details] [review]
Get rid of the usage of PATH_MAX

Review of attachment 82874 [details] [review]:
-----------------------------------------------------------------

The patch looks good (we have src/darray.h which can do some of the boilerplate but that's fine here).
Can you create the patch though with 'git format-patch' rather than 'git diff' (with commit message and author etc.) so we can apply it?
Comment 2 Pino Toscano 2013-07-24 08:20:15 UTC
(In reply to comment #1)
> The patch looks good (we have src/darray.h which can do some of the
> boilerplate but that's fine here).

It seems darray doesn't handle malloc/realloc failures though.

> Can you create the patch though with 'git format-patch' rather than 'git
> diff' (with commit message and author etc.) so we can apply it?

Sure, here it is.
Comment 3 Pino Toscano 2013-07-24 08:21:00 UTC
Created attachment 82904 [details] [review]
Get rid of the usage of PATH_MAX
Comment 4 Ran Benita 2013-07-24 09:19:17 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > The patch looks good (we have src/darray.h which can do some of the
> > boilerplate but that's fine here).
> 
> It seems darray doesn't handle malloc/realloc failures though.

Yes, OOM handling is a "TODO" so to speak (the main problem being around the parser / keymap compiler).

> > Can you create the patch though with 'git format-patch' rather than 'git
> > diff' (with commit message and author etc.) so we can apply it?
> 
> Sure, here it is.

Thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.