Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 529356 - sys-boot/grub-2.02_beta2: glibc ifdef LFS checks breaks on non-glibc libraries
Summary: sys-boot/grub-2.02_beta2: glibc ifdef LFS checks breaks on non-glibc libraries
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard: hardened-devel repo, musl overlay
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-11-15 16:23 UTC by DaggyStyle
Modified: 2015-02-01 18:44 UTC (History)
3 users (show)

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


Attachments
patch (grub-2.02_beta2-musl-fix.patch,518 bytes, patch)
2014-11-15 16:24 UTC, DaggyStyle
Details | Diff
patch (0010-force_lfs_for_posix_systems.patch,1.51 KB, patch)
2014-11-21 19:46 UTC, DaggyStyle
Details | Diff
patch against hardened musl branch (0001-add-musl-based-grub.patch,91.59 KB, patch)
2015-01-10 14:15 UTC, DaggyStyle
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DaggyStyle 2014-11-15 16:23:39 UTC
this patch allow sys-boot/grub-2.02_beta2-r2 to compile and run under gentoo over musl

Reproducible: Always
Comment 1 DaggyStyle 2014-11-15 16:24:08 UTC
Created attachment 389420 [details, diff]
patch
Comment 2 Mike Gilbert gentoo-dev 2014-11-17 15:55:28 UTC
Could you please send a patch upstream? This is not a Gentoo-specific issue.

https://lists.gnu.org/mailman/listinfo/grub-devel
Comment 3 Mike Gilbert gentoo-dev 2014-11-17 15:58:33 UTC
Also, this patch is incomplete; the same condition is used at the top of the file to conditionally include linux/unistd.h.
Comment 4 DaggyStyle 2014-11-17 18:26:14 UTC
(In reply to Mike Gilbert from comment #2)
> Could you please send a patch upstream? This is not a Gentoo-specific issue.
> 
> https://lists.gnu.org/mailman/listinfo/grub-devel

I don't think they will accept this as there is no way to know one is compiling grub under musl (no __MUSL_LIBC__ like define)

(In reply to Mike Gilbert from comment #3)
> Also, this patch is incomplete; the same condition is used at the top of the
> file to conditionally include linux/unistd.h.

seems that it compiles well without the upper part, if I disable it, I might hit undefine code bits.
Comment 5 Mike Gilbert gentoo-dev 2014-11-18 17:54:56 UTC
(In reply to DaggyStyle from comment #4)
> (In reply to Mike Gilbert from comment #2)
> > Could you please send a patch upstream? This is not a Gentoo-specific issue.
> > 
> > https://lists.gnu.org/mailman/listinfo/grub-devel
> 
> I don't think they will accept this as there is no way to know one is
> compiling grub under musl (no __MUSL_LIBC__ like define)

I'm not going to carry a patch for this that will never land upstream. Especially if you never make the attempt.
Comment 6 Mike Gilbert gentoo-dev 2014-11-18 17:57:52 UTC
(In reply to DaggyStyle from comment #4)
> (In reply to Mike Gilbert from comment #3)
> > Also, this patch is incomplete; the same condition is used at the top of the
> > file to conditionally include linux/unistd.h.
> 
> seems that it compiles well without the upper part, if I disable it, I might
> hit undefine code bits.

Please test this.
Comment 7 Felix Janda 2014-11-18 18:52:44 UTC
Compiles also fine with the include removed. In fact, <linux/unistd.h> does not have _llseek as the comment claims. If grub does not support glibc <2.1 anymore, all that code could be removed. Otherwise at least the !defined(__GLIBC__) should be removed.
Comment 8 Mike Gilbert gentoo-dev 2014-11-18 19:50:17 UTC
Right. My suggestion would be to drop both #ifdefs; LFS has been around for a long time.
Comment 9 SpanKY gentoo-dev 2014-11-18 20:50:42 UTC
it's got a configure script, so it could probe for functionality instead of sticking glibc-specific defines in like that

or just make LFS a hard requirement per POSIX
Comment 10 DaggyStyle 2014-11-18 21:18:47 UTC
(In reply to Mike Gilbert from comment #8)
> Right. My suggestion would be to drop both #ifdefs; LFS has been around for
> a long time.
you mean that is we drop the #ifdefs, it should compile on glibc without any problems?
Comment 11 Mike Gilbert gentoo-dev 2014-11-18 21:25:54 UTC
(In reply to DaggyStyle from comment #10)
> you mean that is we drop the #ifdefs, it should compile on glibc without any
> problems?

Yes, on any reasonably recent glibc it should work fine.
Comment 12 DaggyStyle 2014-11-21 19:46:32 UTC
Created attachment 390024 [details, diff]
patch

there, removed the lines and tested it. I'm posting it up to upstream.
Comment 13 Mike Gilbert gentoo-dev 2014-11-21 20:08:11 UTC
(In reply to DaggyStyle from comment #12)

Thanks!
Comment 14 DaggyStyle 2015-01-10 14:15:43 UTC
Created attachment 393604 [details, diff]
patch against hardened musl branch
Comment 16 Mike Gilbert gentoo-dev 2015-01-25 18:52:08 UTC
Thanks. I'll backport it.
Comment 17 Mike Gilbert gentoo-dev 2015-02-01 18:44:15 UTC
+*grub-2.02_beta2-r7 (01 Feb 2015)
+
+  01 Feb 2015; Mike Gilbert <floppym@gentoo.org> +grub-2.02_beta2-r7.ebuild:
+  Add patches for XFS v5 superblocks, bug 525682. Fix build on musl, bug 529356.