Bug 62220 - polkit-0.110 (+ git) fails to compile because of missing #include <sys/wait.h> for WIFEXITED, WEXITSTATUS, ...
Summary: polkit-0.110 (+ git) fails to compile because of missing #include <sys/wait.h...
Status: RESOLVED FIXED
Alias: None
Product: PolicyKit
Classification: Unclassified
Component: daemon (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact: David Zeuthen (not reading bugmail)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-12 11:30 UTC by Samuli Suominen
Modified: 2013-04-21 14:59 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
#include <sys/wait.h> (759 bytes, patch)
2013-03-12 11:31 UTC, Samuli Suominen
Details | Splinter Review
include sys/wait.h patch in git format (900 bytes, patch)
2013-03-13 19:45 UTC, Samuli Suominen
Details | Splinter Review

Description Samuli Suominen 2013-03-12 11:30:19 UTC
polkit-0.110 fails to compile because it doesn't include correct header for:

polkitbackendjsauthority.c: In function 'set_property_strv':
polkitbackendjsauthority.c:784:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
polkitbackendjsauthority.c: In function 'js_polkit_spawn':
polkitbackendjsauthority.c:1509:3: warning: implicit declaration of function 'WIFEXITED' [-Wimplicit-function-declaration]
polkitbackendjsauthority.c:1509:3: warning: nested extern declaration of 'WIFEXITED' [-Wnested-externs]
polkitbackendjsauthority.c:1509:3: warning: implicit declaration of function 'WEXITSTATUS' [-Wimplicit-function-declaration]
polkitbackendjsauthority.c:1509:3: warning: nested extern declaration of 'WEXITSTATUS' [-Wnested-externs]
polkitbackendjsauthority.c:1519:7: warning: implicit declaration of function 'WIFSIGNALED' [-Wimplicit-function-declaration]
polkitbackendjsauthority.c:1519:7: warning: nested extern declaration of 'WIFSIGNALED' [-Wnested-externs]
polkitbackendjsauthority.c:1523:35: warning: implicit declaration of function 'WTERMSIG' [-Wimplicit-function-declaration]
polkitbackendjsauthority.c:1523:35: warning: nested extern declaration of 'WTERMSIG' [-Wnested-externs]

Followed by:

polkitbackendjsauthority.c:(.text+0x3008): undefined reference to `WIFEXITED'
polkitbackendjsauthority.c:(.text+0x3010): undefined reference to `WIFEXITED'
polkitbackendjsauthority.c:(.text+0x3014): undefined reference to `WEXITSTATUS'
polkitbackendjsauthority.c:(.text+0x302c): undefined reference to `WEXITSTATUS'
polkitbackendjsauthority.c:(.text+0x3038): undefined reference to `WIFSIGNALED'
polkitbackendjsauthority.c:(.text+0x303c): undefined reference to `WTERMSIG'
polkitbackendjsauthority.c:(.text+0x3044): undefined reference to `WTERMSIG'
collect2: ld returned 1 exit status

These are also used in src/polkitagent/polkitagentsession.c where <sys/wait.h> is already correct in
But src/polkitbackend/polkitbackendjsauthority.c is missing it

Adding the #include <sys/wait.h> right after #include "config.h" fixes the issue

This is Linux with GNU gcc/glibc on SH4 arch and I verified adding the #include does NOT break other arch's (well, tested x86 32bit and 64bit)
Comment 1 Samuli Suominen 2013-03-12 11:31:10 UTC
Created attachment 76391 [details] [review]
#include <sys/wait.h>
Comment 2 Colin Walters 2013-03-13 19:03:39 UTC
Comment on attachment 76391 [details] [review]
#include <sys/wait.h>

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

Patch looks obviously correct, however can you try making it a "git format-patch" style patch?

See https://live.gnome.org/GnomeLove/SubmittingPatches

In particular, with a decent commit message.  Drop the compiler
output since it's just noise.  Something like this:

backend: Add missing include <sys/wait.h>

Otherwise we fail to build on at least some C libraries.

https://bugs.freedesktop.org/show_bug.cgi?id=62220
Comment 3 Samuli Suominen 2013-03-13 19:45:25 UTC
Created attachment 76496 [details] [review]
include sys/wait.h patch in git format
Comment 4 Colin Walters 2013-04-11 17:43:34 UTC
(In reply to comment #3)
> Created attachment 76496 [details] [review] [review]
> include sys/wait.h patch in git format

Er, you put the entire comment on one line, which looks terrible.  I fixed this up to look sane and pushed.  Thanks for the patch.


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.