Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1160845 - udf_example.c couldn't compile
Summary: udf_example.c couldn't compile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Staněk
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-05 19:07 UTC by Mikhail
Modified: 2014-12-06 09:59 UTC (History)
4 users (show)

Fixed In Version: mariadb-10.0.14-8.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-06 09:59:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Upstream patch (899 bytes, patch)
2014-11-20 11:43 UTC, Jan Staněk
no flags Details | Diff

Description Mikhail 2014-11-05 19:07:57 UTC
Description of problem:
[mikhail@localhost udf]$ ls -la
total 36
drwxrwxr-x. 1 mikhail mikhail    26 ноя  5 23:02 .
drwxrwxr-x. 1 mikhail mikhail  5816 ноя  5 22:42 ..
-rw-r--r--. 1 mikhail mikhail 33593 сен 25 04:29 udf_example.c

[mikhail@localhost udf]$ mysql_config --cflags
-I/usr/include/mysql -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -fno-delete-null-pointer-checks  -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing

[mikhail@localhost udf]$ gcc $(mysql_config --cflags) -shared -fPIC -o udf_example.so udf_example.c
cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]
In file included from /usr/include/pthread.h:21:0,
                 from /usr/include/mysql/my_global.h:294,
                 from udf_example.c:128:
/usr/include/features.h:328:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^
cc1: some warnings being treated as errors

Comment 1 Mikhail 2014-11-05 19:08:20 UTC
If I am manually remove -Werror=format-security parameter compile would be successful
$ gcc -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -fno-delete-null-pointer-checks -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -shared -fPIC -o udf_example.so udf_example.c

Comment 2 Jan Staněk 2014-11-06 10:07:38 UTC
The problem seems to originate in the way the mysql_config scripts is created during mariadb configuration and how it actually produces the --cflags output.

When the cmake scripts are run in the specfile, the mysql_config picks up actual CFLAGS environment variable and uses it as a base for reporting. However, when actually asked for the CFLAGS (by executing it with --cflags option or similar), it does some preprocessing on the saved values - including removing warning-related flags. The regexp ('-W[-A-Za-z]*') catches (and thus removes) the -Wall options (which "include" -Wformat), but not the -Werror=format-security (which *needs* -Wformat specified in one way or another).

The regexp should definitely be fixed, the question is how -- should it also remove the -Werror=format-security, or should it leave the -Wall option in order to get the aforementioned option to work?

Guessing from the way the script is written, I think that the -Werror... should be removed as well as the others and leave the decision about compiler warnings and errors to the end user. I will contact upstream and hope for feedback.

Comment 3 Jan Staněk 2014-11-20 11:43:42 UTC
Created attachment 959298 [details]
Upstream patch

Comment 4 Jan Staněk 2014-11-20 11:49:49 UTC
Upstream fixed this issue and it should be shipped with the next release of mariadb 5.5. The fix is accesible at [1] and the Mariadb bug with commentary on this issue is at [2].

For the time being, I am going to apply the patch to current MariaDB, which should fix the issue until next upstream release.

[1] http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/4360
[2] https://mariadb.atlassian.net/browse/MDEV-7028

Comment 5 Fedora Update System 2014-11-25 08:19:47 UTC
mariadb-10.0.14-8.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mariadb-10.0.14-8.fc21

Comment 6 Fedora Update System 2014-11-25 21:24:46 UTC
Package mariadb-10.0.14-8.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mariadb-10.0.14-8.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-15761/mariadb-10.0.14-8.fc21
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-12-06 09:59:27 UTC
mariadb-10.0.14-8.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.


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