Bug 1416941

Summary: compile of 1.34.3 fails with gperf 3.1
Product: [Community] Virtualization Tools Reporter: Marius Cirsta <mforce2>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ptoscano, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-26 22:11:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marius Cirsta 2017-01-26 20:47:04 UTC
Description of problem:

While trying to compile libguestfs 1.34.3 and using gperf 3.1 I am getting this error:

'./'`guestfs_protocol.c
errnostring-gperf.gperf:505:1: error: conflicting types for 'guestfs_int_string_to_errno_lookup'
ENFILE, ENFILE
^~
In file included from errnostring-gperf.gperf:37:0:
errnostring.h:47:40: note: previous declaration of 'guestfs_int_string_to_errno_lookup' was here
extern const struct errnostring_entry *guestfs_int_string_to_errno_lookup (register const char *str, register unsigned int len);
^~
make[3]: *** [Makefile:2339: liberrnostring_la-errnostring-gperf.lo] Error 1
make[3]: *** Waiting for unfinished jobs....

Version-Release number of selected component (if applicable):

1.34.3

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Also the generated function signature looks like this:

const struct errnostring_entry *
guestfs_int_string_to_errno_lookup (register const char *str, register size_t len)
{
static const struct errnostring_entry wordlist[] =

Comment 1 Richard W.M. Jones 2017-01-26 21:04:01 UTC
I had to update Fedora's gperf version:
https://koji.fedoraproject.org/koji/taskinfo?taskID=17427423

and yes I can reproduce this:
  CC       liberrnostring_la-errnostring.lo
errnostring-gperf.gperf:505:1: error: conflicting types for 'guestfs_int_string_to_errno_lookup'
 ENFILE, ENFILE
 ^~~~~~~~~~~~~~                    
In file included from errnostring-gperf.gperf:37:0:
errnostring.h:47:40: note: previous declaration of 'guestfs_int_string_to_errno_lookup' was here
 extern const struct errnostring_entry *guestfs_int_string_to_errno_lookup (register const char *str, register unsigned int len);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Makefile:1684: recipe for target 'liberrnostring_la-errnostring-gperf.lo' failed

Comment 2 Richard W.M. Jones 2017-01-26 21:08:15 UTC
The change is caused by:

* The 'len' parameter of the hash function and of the lookup function is now
  of type 'size_t' instead of 'unsigned int'. This makes it safe to call these
  functions with strings of length > 4 GB, on 64-bit machines.

Comment 3 Richard W.M. Jones 2017-01-26 22:11:06 UTC
Fixed in:

https://github.com/libguestfs/libguestfs/commit/3a2b89a09ea12db7c55b07cb9e95cdf09b5b845b

Will be available in libguestfs 1.34.4 & 1.35.20.

Comment 4 Richard W.M. Jones 2017-01-27 10:14:25 UTC
I made the fix somewhat simpler:

https://github.com/libguestfs/libguestfs/commit/004de6cf45cfe66ca166cbdcb1c3125a2a81eb31