Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 559552 - app-admin/ulogd-2.0.4-r1 - logemu output plugin large file error
Summary: app-admin/ulogd-2.0.4-r1 - logemu output plugin large file error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Coacher
URL: http://bugzilla.netfilter.org/show_bu...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-03 19:55 UTC by Tomasz Chilinski
Modified: 2015-09-09 22:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
config.h inclusion order fix (ulogd-2.0.4-config.h-inclusion-order-fix.patch,435 bytes, patch)
2015-09-03 19:55 UTC, Tomasz Chilinski
Details | Diff
sorry, previous patch didn't actually fix the problem (ulogd-2.0.4-output_LOGEMU-earlier-config.h-inclusion.patch,334 bytes, patch)
2015-09-03 19:58 UTC, Tomasz Chilinski
Details | Diff
build.log (build.log,47.39 KB, patch)
2015-09-09 14:59 UTC, Tomasz Chilinski
Details | Diff
emerge --info (emerge-info.log,4.98 KB, text/x-log)
2015-09-09 14:59 UTC, Tomasz Chilinski
Details
build.log (build.log,47.39 KB, text/x-log)
2015-09-09 15:00 UTC, Tomasz Chilinski
Details
ulogd-large-file-support.patch (ulogd-large-file-support.patch,629 bytes, patch)
2015-09-09 18:10 UTC, Coacher
Details | Diff
ulogd-2.0.5-r1.ebuild (ulogd-2.0.5-r9999.ebuild,3.32 KB, text/plain)
2015-09-09 18:27 UTC, Coacher
Details
2.0.5..2.0.5-r1.patch (2.0.5..2.0.5-r1.patch,1.59 KB, patch)
2015-09-09 18:29 UTC, Coacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Chilinski 2015-09-03 19:55:06 UTC
Created attachment 410942 [details, diff]
config.h inclusion order fix

Ulogd includes config.h from include/ulogd/ulogd.h too late to use determined _FILE_OFFSET_BITS set to 64 on 32-bit x86 platform for all file api functions. This causes inability to write log files larger than 2 GiB in size.
Attached patch resolves this problem.
Comment 1 Tomasz Chilinski 2015-09-03 19:58:21 UTC
Created attachment 410944 [details, diff]
sorry, previous patch didn't actually fix the problem
Comment 2 Coacher 2015-09-09 14:07:44 UTC
(In reply to Tomasz Chilinski from comment #0)
> Created attachment 410942 [details, diff] [details, diff]
> config.h inclusion order fix
> 
> Ulogd includes config.h from include/ulogd/ulogd.h too late to use
> determined _FILE_OFFSET_BITS set to 64 on 32-bit x86 platform for all file
> api functions. This causes inability to write log files larger than 2 GiB in
> size.
> Attached patch resolves this problem.

You say the problem is that ulogd fails to write more than 2 GiB to a single logfile on 32-bit platforms. What happens then? Does it log any errors?
Comment 3 Tomasz Chilinski 2015-09-09 14:20:20 UTC
Simply it stops to write to log file altough process stays active.
Doesn't log any problems.
Comment 4 Coacher 2015-09-09 14:29:10 UTC
Just to be sure did you check that on your system 'config.h' actually has _FILE_OFFSET_BITS set to 64?
Comment 5 Tomasz Chilinski 2015-09-09 14:30:56 UTC
Yes of course. Configure script properly detects required _FILE_OFFSET_BITS setting.
Comment 6 Coacher 2015-09-09 14:48:53 UTC
(In reply to Tomasz Chilinski from comment #5)
> Yes of course. Configure script properly detects required _FILE_OFFSET_BITS
> setting.

Good, thanks for the info.

I do not have a 32-bit system at hand, so it'll take me some time to set it up and try and reproduce your issue. In the meantime I can say that your patch in its current form cannot be added to the tree because if this is a reproducible problem with ulogd, then it should be fixed on the build system level. You've provided a way to fix it for a single output plugin only.

Also it seems that somebody had a similar problem a long time ago (see [0]), but it looks like it was a problem with user configuration.

0: https://osdir.com/ml/netfilter/2009-03/msg00014.html
Comment 7 Coacher 2015-09-09 14:50:50 UTC
(In reply to Tomasz Chilinski from comment #5)
> Yes of course. Configure script properly detects required _FILE_OFFSET_BITS
> setting.

Please attach your build.log and `emerge --info ulogd` output.
Comment 8 Tomasz Chilinski 2015-09-09 14:59:34 UTC
Created attachment 411424 [details, diff]
build.log
Comment 9 Tomasz Chilinski 2015-09-09 14:59:55 UTC
Created attachment 411426 [details]
emerge --info
Comment 10 Tomasz Chilinski 2015-09-09 15:00:38 UTC
Created attachment 411428 [details]
build.log
Comment 11 Coacher 2015-09-09 15:04:17 UTC
Thank you.
Comment 12 Tomasz Chilinski 2015-09-09 15:14:40 UTC
Here you have it as attachments.

> I can say that your patch in its current form cannot be added to the tree 
> because if this is a reproducible problem with ulogd, then it should be fixed 
> on the build system level.

@Coacher: just take a look into output/ulogd_output_XML.c file from source tree.
../config.h is included before file function declarations in this file (fortunately).
config.h is also included from include/ulogd/ulogd.h, but, unfortunately, config.h inclusion from ulogd.h for ulogd_output_LOGEMU.c is too late, because file function declarations has already been included from stdio.h while _FILE_OFFSET_BITS wasn't defined as 64.

Here is snippet from output/ulogd_output_LOGEMU.c:
#include <limits.h>
#include <stdio.h> <------ file function declarations
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <ulogd/ulogd.h> <------- implicit config.h inclusion while defines _FILE_OFFSET_BITS as 64
#include <ulogd/conffile.h>

How build system could modify inclusion order while these files are not touched at all by build system? This would be very invasive changes...
Comment 13 Coacher 2015-09-09 15:34:50 UTC
(In reply to Tomasz Chilinski from comment #12)
> @Coacher: just take a look into output/ulogd_output_XML.c file from source
> tree.
> ../config.h is included before file function declarations in this file
> (fortunately).
> config.h is also included from include/ulogd/ulogd.h, but, unfortunately,
> config.h inclusion from ulogd.h for ulogd_output_LOGEMU.c is too late,
> because file function declarations has already been included from stdio.h
> while _FILE_OFFSET_BITS wasn't defined as 64.
> 
> Here is snippet from output/ulogd_output_LOGEMU.c:
> #include <limits.h>
> #include <stdio.h> <------ file function declarations
> #include <stdlib.h>
> #include <unistd.h>
> #include <string.h>
> #include <errno.h>
> #include <time.h>
> #include <ulogd/ulogd.h> <------- implicit config.h inclusion while defines
> _FILE_OFFSET_BITS as 64
> #include <ulogd/conffile.h>
> 
> How build system could modify inclusion order while these files are not
> touched at all by build system? This would be very invasive changes...

I can see the problem you are referring to. But what about other plugins? There are still lots of places where stdio.h is included prior to ulogd.h.

Build system could add '-D_FILE_OFFSET_BITS=64' to CFLAGS at compile time if requested overriding the defaults. Not intrusive at all.

I am just trying to figure out if there is a better way to fix it rather than to modify CFLAGS.
Comment 14 Tomasz Chilinski 2015-09-09 15:40:10 UTC
I see. You're right.
Comment 15 Coacher 2015-09-09 18:05:22 UTC
My attempt to fix include order was painful and not successful.

Since we don't provide Gentoo users a way to disable large file support (anyone really wants it disabled nowadays?) it is safe to just append the needed flags.
Comment 16 Coacher 2015-09-09 18:10:39 UTC
Created attachment 411442 [details, diff]
ulogd-large-file-support.patch

Patch for the currently stable ulogd-2.0.4-r1 to fix large file support.
Comment 17 Coacher 2015-09-09 18:13:49 UTC
From now it can take some time to push this changes in tree and then stabilize the new ebuild if necessary. Hopefully ulogd-2.0.5 can be updated to fix this issue and then stabilized in one go.

If you are desperate to have this fix on your system you will have to update the ebuild manually or use my overlay where this fix is already applied: https://github.com/Coacher/bonespirit.git
Comment 18 Tomasz Chilinski 2015-09-09 18:20:55 UTC
Thanks @Coacher!
Comment 19 Coacher 2015-09-09 18:27:58 UTC
Created attachment 411446 [details]
ulogd-2.0.5-r1.ebuild

ulogd-2.0.5-r1.ebuild with large file support fix
Comment 20 Coacher 2015-09-09 18:29:45 UTC
Created attachment 411448 [details, diff]
2.0.5..2.0.5-r1.patch
Comment 21 Manuel Rüger (RETIRED) gentoo-dev 2015-09-09 22:56:52 UTC
commit 39360fe201749544207e205bb418d1a0f6308ce1
Author: Manuel Rüger <mrueg@gentoo.org>
Date:   Thu Sep 10 00:55:13 2015 +0200

    app-admin/ulogd: Proxy commit for Coacher. Fix support for large files.
    
    Gentoo-Bug: #559552
    
    Package-Manager: portage-2.2.20.1