Bug 1983011 - Invalid syntax in tdb.h
Summary: Invalid syntax in tdb.h
Keywords:
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: libtdb
Version: 35
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Guenther Deschner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-16 09:05 UTC by Lukas Slebodnik
Modified: 2021-10-06 09:56 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Samba Project 14762 0 None None None 2021-07-20 10:53:34 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.