Bug 1983011

Summary: Invalid syntax in tdb.h
Product: [Fedora] Fedora Reporter: Lukas Slebodnik <lslebodn>
Component: libtdbAssignee: Guenther Deschner <gdeschner>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: abokovoy, aboscatt, asn, gdeschner, iboukris, jhrozek, lslebodn, sgallagh, ssorce
Target Milestone: ---Keywords: Triaged
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: 2022-12-05 11:19:04 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 Lukas Slebodnik 2021-07-16 09:05:41 UTC
Description of problem:
The latest version of libtdb broke compilation of code which use just tdb and do not include talloc

Version-Release number of selected component (if applicable):
sh$ rpm -q gcc libtdb-devel
gcc-11.1.1-6.fc35.x86_64
libtdb-devel-1.4.4-1.fc35.x86_64

How reproducible:
Deterministic

Steps to Reproduce:
1. echo "#include <tdb.h>" > test.c
2. gcc -Wall -Wextra -c test.c


Actual results:

[build@ed930d6c3308 ~]$ gcc -Wall -Wextra -c test.c
In file included from test.c:1:
/usr/include/tdb.h:162:9: error: expected ‘;’ before ‘struct’
  162 | _PUBLIC_ struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
      |         ^~~~~~~
      |         ;
/usr/include/tdb.h:163:39: error: unknown type name ‘mode_t’
  163 |                       int open_flags, mode_t mode);
      |                                       ^~~~~~
/usr/include/tdb.h:209:9: error: expected ‘;’ before ‘struct’
  209 | _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
      |         ^~~~~~~
      |         ;
/usr/include/tdb.h:210:42: error: unknown type name ‘mode_t’
  210 |                          int open_flags, mode_t mode,
      |                                          ^~~~~~
/usr/include/tdb.h:221:9: error: expected ‘;’ before ‘void’
  221 | _PUBLIC_ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
      |         ^~~~~
      |         ;
/usr/include/tdb.h:236:9: error: expected ‘;’ before ‘int’
  236 | _PUBLIC_ int tdb_reopen(struct tdb_context *tdb);
      |         ^~~~
      |         ;
/usr/include/tdb.h:251:9: error: expected ‘;’ before ‘int’
  251 | _PUBLIC_ int tdb_reopen_all(int parent_longlived);
      |         ^~~~
      |         ;
/usr/include/tdb.h:260:9: error: expected ‘;’ before ‘void’
  260 | _PUBLIC_ void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
      |         ^~~~~
      |         ;

Expected results:
Code compiled without any error

Additional info:
The header file talloc.h contains following code

    32  #ifdef __cplusplus
    33  extern "C" {
    34  #endif
    35  
    36  /* for old gcc releases that don't have the feature test macro __has_attribute */
    37  #ifndef __has_attribute
    38  #define __has_attribute(x) 0
    39  #endif
    40  
    41  #ifndef _PUBLIC_
    42  #if __has_attribute(visibility)
    43  #define _PUBLIC_ __attribute__((visibility("default")))
    44  #else
    45  #define _PUBLIC_
    46  #endif
    47  #endif

It should be probably used in tdb.h as well

Comment 1 Ben Cotton 2021-08-10 13:13:30 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 2 Guenther Deschner 2021-10-06 09:19:39 UTC
Requested upstream to add that patch (which is already in master) to v4.15 release as well so that it would end in f35 automatically.

Comment 3 Ben Cotton 2022-11-29 17:00:31 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Lukas Slebodnik 2022-12-05 11:19:04 UTC
It works with libtdb-devel-1.4.4-3.fc35
and also with libtdb-devel-1.4.7-1.fc36