diff mbox

[LEDE-DEV] package/util-linux: Fix libmount build under uClibc

Message ID 1464014781-25347-1-git-send-email-abrodkin@synopsys.com
State Rejected
Headers show

Commit Message

Alexey Brodkin May 23, 2016, 2:46 p.m. UTC
This fixes util-linux building with uClibc.
Patch is taken as it is from Buildroot:
https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb506a6feabf114623866568121f49712f5df

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
 .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
 1 file changed, 153 insertions(+)
 create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch

Comments

Alexey Brodkin May 26, 2016, 11:56 a.m. UTC | #1
Hello,

On Mon, 2016-05-23 at 17:46 +0300, Alexey Brodkin wrote:
> This fixes util-linux building with uClibc.
> Patch is taken as it is from Buildroot:
> https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb506a6fea
> bf114623866568121f49712f5df
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> ---
>  .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
>  1 file changed, 153 insertions(+)
>  create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch

I'm wondering if there're any comments on that one or it could be
applied?

-Alexey
Alexey Brodkin May 30, 2016, 11:13 a.m. UTC | #2
Hello,

On Thu, 2016-05-26 at 14:55 +0300, Alexey Brodkin wrote:
> Hello,
> 
> On Mon, 2016-05-23 at 17:46 +0300, Alexey Brodkin wrote:
> > 
> > This fixes util-linux building with uClibc.
> > Patch is taken as it is from Buildroot:
> > https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb506a6f
> > ea
> > bf114623866568121f49712f5df
> > 
> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > ---
> >  .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
> >  1 file changed, 153 insertions(+)
> >  create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch
> I'm wondering if there're any comments on that one or it could be
> applied?

This fix is really required to successfully Lede with uClibc.
Any chance for it to be reviewed or applied?

-Alexey
John Crispin May 30, 2016, 12:35 p.m. UTC | #3
On 30/05/2016 13:13, Alexey Brodkin wrote:
> Hello,
> 
> On Thu, 2016-05-26 at 14:55 +0300, Alexey Brodkin wrote:
>> Hello,
>>
>> On Mon, 2016-05-23 at 17:46 +0300, Alexey Brodkin wrote:
>>>
>>> This fixes util-linux building with uClibc.
>>> Patch is taken as it is from Buildroot:
>>> https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb506a6f
>>> ea
>>> bf114623866568121f49712f5df
>>>
>>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>>> ---
>>>  .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
>>>  1 file changed, 153 insertions(+)
>>>  create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch
>> I'm wondering if there're any comments on that one or it could be
>> applied?
> 
> This fix is really required to successfully Lede with uClibc.
> Any chance for it to be reviewed or applied?
> 
> -Alexey

we are waiting on waldermar to figure out the real fix inside uclibc

	John
Alexey Brodkin June 1, 2016, 7:56 a.m. UTC | #4
Hi Waldemar,

On Mon, 2016-05-30 at 14:12 +0300, Alexey Brodkin wrote:
> Hello,
> 
> On Thu, 2016-05-26 at 14:55 +0300, Alexey Brodkin wrote:
> > 
> > Hello,
> > 
> > On Mon, 2016-05-23 at 17:46 +0300, Alexey Brodkin wrote:
> > > 
> > > 
> > > This fixes util-linux building with uClibc.
> > > Patch is taken as it is from Buildroot:
> > > https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb506a
> > > 6f
> > > ea
> > > bf114623866568121f49712f5df
> > > 
> > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > ---
> > >  .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
> > >  1 file changed, 153 insertions(+)
> > >  create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch

We are discussing one issue with "util-linux" package building.
The problem is in "util-linux" wants to use alloc modifier (either "%as"
or "%ms") in scanf().

Looks like uClibc still doesn't support neither "%ms" nor "%as" (this one
is obsolete glibc-specific so let's not bother with it anyways).

Now to work-around this missing requirement we used to use
an off-the-tree patch like this one in Buildroot:
https://git.busybox.net/buildroot/tree/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch

OpenWRT:
https://git.lede-project.org/?p=source.git;a=blob;f=package/utils/util-linux/patches/001-no-printf-alloc.patch;h=ad9eef0
959bf0c8ce269e8039d4d05ef58e1d527;hb=8a7b28071fba84e297796c46d46e12b0967804e8

Gentoo:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.pat
ch?revision=1.2

The question to you is where do you think we should fix mentioned problem:
 1) In uClibc-ng with addition of "%ms" support in scanf or
 2) Try to upstream mentioned patch in "util-linux"?

Regards,
Alexey
Waldemar Brodkorb June 1, 2016, 5:28 p.m. UTC | #5
Hi Alexey,

Alexey Brodkin wrote,

> Hi Waldemar,
> 
> On Mon, 2016-05-30 at 14:12 +0300, Alexey Brodkin wrote:
> > Hello,
> > 
> > On Thu, 2016-05-26 at 14:55 +0300, Alexey Brodkin wrote:
> > > 
> > > Hello,
> > > 
> > > On Mon, 2016-05-23 at 17:46 +0300, Alexey Brodkin wrote:
> > > > 
> > > > 
> > > > This fixes util-linux building with uClibc.
> > > > Patch is taken as it is from Buildroot:
> > > > https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb506a
> > > > 6f
> > > > ea
> > > > bf114623866568121f49712f5df
> > > > 
> > > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > > ---
> > > >  .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
> > > >  1 file changed, 153 insertions(+)
> > > >  create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch
> 
> We are discussing one issue with "util-linux" package building.
> The problem is in "util-linux" wants to use alloc modifier (either "%as"
> or "%ms") in scanf().
> 
> Looks like uClibc still doesn't support neither "%ms" nor "%as" (this one
> is obsolete glibc-specific so let's not bother with it anyways).
> 
> Now to work-around this missing requirement we used to use
> an off-the-tree patch like this one in Buildroot:
> https://git.busybox.net/buildroot/tree/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch
> 
> OpenWRT:
> https://git.lede-project.org/?p=source.git;a=blob;f=package/utils/util-linux/patches/001-no-printf-alloc.patch;h=ad9eef0
> 959bf0c8ce269e8039d4d05ef58e1d527;hb=8a7b28071fba84e297796c46d46e12b0967804e8
> 
> Gentoo:
> https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.pat
> ch?revision=1.2
> 
> The question to you is where do you think we should fix mentioned problem:
>  1) In uClibc-ng with addition of "%ms" support in scanf or

I would prefer this solution. I have started reading the code, but I
can't give you any guarantee when I can work on this.
Do you have free resources to cook up a patch? :)

>  2) Try to upstream mentioned patch in "util-linux"?

best regards
 Waldemar
John Crispin June 1, 2016, 5:37 p.m. UTC | #6
On 01/06/2016 19:28, Waldemar Brodkorb wrote:
>> The question to you is where do you think we should fix mentioned problem:
>> >  1) In uClibc-ng with addition of "%ms" support in scanf or
> I would prefer this solution. I have started reading the code, but I
> can't give you any guarantee when I can work on this.
> Do you have free resources to cook up a patch? :)
> 

I agree that this needs to be fixed in uclibc

	John
Alexey Brodkin June 2, 2016, 11 a.m. UTC | #7
Hi Waldemar,

On Wed, 2016-06-01 at 19:28 +0200, Waldemar Brodkorb wrote:
> Hi Alexey,
> 
> Alexey Brodkin wrote,
> 
> > 
> > Hi Waldemar,
> > 
> > On Mon, 2016-05-30 at 14:12 +0300, Alexey Brodkin wrote:
> > > 
> > > Hello,
> > > 
> > > On Thu, 2016-05-26 at 14:55 +0300, Alexey Brodkin wrote:
> > > > 
> > > > 
> > > > Hello,
> > > > 
> > > > On Mon, 2016-05-23 at 17:46 +0300, Alexey Brodkin wrote:
> > > > > 
> > > > > 
> > > > > 
> > > > > This fixes util-linux building with uClibc.
> > > > > Patch is taken as it is from Buildroot:
> > > > > https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb
> > > > > 506a
> > > > > 6f
> > > > > ea
> > > > > bf114623866568121f49712f5df
> > > > > 
> > > > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > > > ---
> > > > >  .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
> > > > >  1 file changed, 153 insertions(+)
> > > > >  create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch
> > We are discussing one issue with "util-linux" package building.
> > The problem is in "util-linux" wants to use alloc modifier (either "%as"
> > or "%ms") in scanf().
> > 
> > Looks like uClibc still doesn't support neither "%ms" nor "%as" (this one
> > is obsolete glibc-specific so let's not bother with it anyways).
> > 
> > Now to work-around this missing requirement we used to use
> > an off-the-tree patch like this one in Buildroot:
> > https://git.busybox.net/buildroot/tree/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch
> > 
> > OpenWRT:
> > https://git.lede-project.org/?p=source.git;a=blob;f=package/utils/util-linux/patches/001-no-printf-alloc.patch;h=ad9
> > eef0
> > 959bf0c8ce269e8039d4d05ef58e1d527;hb=8a7b28071fba84e297796c46d46e12b0967804e8
> > 
> > Gentoo:
> > https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc
> > .pat
> > ch?revision=1.2
> > 
> > The question to you is where do you think we should fix mentioned problem:
> >  1) In uClibc-ng with addition of "%ms" support in scanf or
> I would prefer this solution. I have started reading the code, but I
> can't give you any guarantee when I can work on this.
> Do you have free resources to cook up a patch? :)

You mean if I'm up to implement this missing feature in uClibc?
Well I'd like to but as well not sure if and when I have time for that :)

For now we have a work-around with mentioned patches. So that's not a showstopper.

-Alexey
John Crispin June 2, 2016, 11:04 a.m. UTC | #8
On 02/06/2016 13:00, Alexey Brodkin wrote:
> Hi Waldemar,
> 
> On Wed, 2016-06-01 at 19:28 +0200, Waldemar Brodkorb wrote:
>> Hi Alexey,
>>
>> Alexey Brodkin wrote,
>>
>>>
>>> Hi Waldemar,
>>>
>>> On Mon, 2016-05-30 at 14:12 +0300, Alexey Brodkin wrote:
>>>>
>>>> Hello,
>>>>
>>>> On Thu, 2016-05-26 at 14:55 +0300, Alexey Brodkin wrote:
>>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> On Mon, 2016-05-23 at 17:46 +0300, Alexey Brodkin wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> This fixes util-linux building with uClibc.
>>>>>> Patch is taken as it is from Buildroot:
>>>>>> https://git.busybox.net/buildroot/plain/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch?id=baccb
>>>>>> 506a
>>>>>> 6f
>>>>>> ea
>>>>>> bf114623866568121f49712f5df
>>>>>>
>>>>>> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>>>>>> ---
>>>>>>  .../004-Fix-libmount-build-under-uClibc.patch      | 153 +++++++++++++++++++++
>>>>>>  1 file changed, 153 insertions(+)
>>>>>>  create mode 100644 package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch
>>> We are discussing one issue with "util-linux" package building.
>>> The problem is in "util-linux" wants to use alloc modifier (either "%as"
>>> or "%ms") in scanf().
>>>
>>> Looks like uClibc still doesn't support neither "%ms" nor "%as" (this one
>>> is obsolete glibc-specific so let's not bother with it anyways).
>>>
>>> Now to work-around this missing requirement we used to use
>>> an off-the-tree patch like this one in Buildroot:
>>> https://git.busybox.net/buildroot/tree/package/util-linux/0001-Fix-libmount-build-under-uClibc.patch
>>>
>>> OpenWRT:
>>> https://git.lede-project.org/?p=source.git;a=blob;f=package/utils/util-linux/patches/001-no-printf-alloc.patch;h=ad9
>>> eef0
>>> 959bf0c8ce269e8039d4d05ef58e1d527;hb=8a7b28071fba84e297796c46d46e12b0967804e8
>>>
>>> Gentoo:
>>> https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc
>>> .pat
>>> ch?revision=1.2
>>>
>>> The question to you is where do you think we should fix mentioned problem:
>>>  1) In uClibc-ng with addition of "%ms" support in scanf or
>> I would prefer this solution. I have started reading the code, but I
>> can't give you any guarantee when I can work on this.
>> Do you have free resources to cook up a patch? :)
> 
> You mean if I'm up to implement this missing feature in uClibc?
> Well I'd like to but as well not sure if and when I have time for that :)
> 
> For now we have a work-around with mentioned patches. So that's not a showstopper.
> 
> -Alexey
> 

well,t he requirement for keeping uclibc support in the tree is that
people fix uclibc issues. so someone has to fix it. waldemar promised to
address uclibc issues if we use his ng tree.

	John
diff mbox

Patch

diff --git a/package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch b/package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch
new file mode 100644
index 0000000..10cc3a5
--- /dev/null
+++ b/package/utils/util-linux/patches/004-Fix-libmount-build-under-uClibc.patch
@@ -0,0 +1,153 @@ 
+From 44d733203637666926964957af7af23429ddcecf Mon Sep 17 00:00:00 2001
+From: Gustavo Zacarias <gustavo@zacarias.com.ar>
+Date: Mon, 18 Apr 2016 09:58:56 -0300
+Subject: [PATCH] Fix libmount build under uClibc
+
+See https://bugs.gentoo.org/show_bug.cgi?id=406303
+http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?revision=1.2
+
+[Gustavo: converted to git format for 2.28]
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+---
+ configure.ac             |  1 -
+ libmount/src/tab_parse.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 52 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5a00403..3422f11 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -948,7 +948,6 @@ AC_ARG_ENABLE([libmount],
+ )
+ UL_BUILD_INIT([libmount])
+ UL_REQUIRES_BUILD([libmount], [libblkid])
+-UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
+ AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
+ AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes])
+ AS_IF([test "x$build_libmount" = xyes], [
+diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
+index 3f5e14a..2ff1795 100644
+--- a/libmount/src/tab_parse.c
++++ b/libmount/src/tab_parse.c
+@@ -39,6 +39,10 @@ static void parser_cleanup(struct libmnt_parser *pa)
+ 	memset(pa, 0, sizeof(*pa));
+ }
+ 
++#ifndef HAVE_SCANF_MS_MODIFIER
++# define UL_SCNsA "%s"
++#endif
++
+ static int next_number(char **s, int *num)
+ {
+ 	char *end = NULL;
+@@ -69,16 +73,31 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, char *s)
+ 	int rc, n = 0, xrc;
+ 	char *src = NULL, *fstype = NULL, *optstr = NULL;
+ 
++#ifndef HAVE_SCANF_MS_MODIFIER
++	size_t len = strlen(s) + 1;
++	src = malloc(len);
++	fstype = malloc(len);
++	fs->target = malloc(len);
++	optstr = malloc(len);
++#endif
++
+ 	rc = sscanf(s,	UL_SCNsA" "	/* (1) source */
+ 			UL_SCNsA" "	/* (2) target */
+ 			UL_SCNsA" "	/* (3) FS type */
+ 			UL_SCNsA" "	/* (4) options */
+ 			"%n",		/* byte count */
+ 
++#ifdef HAVE_SCANF_MS_MODIFIER
+ 			&src,
+ 			&fs->target,
+ 			&fstype,
+ 			&optstr,
++#else
++			src,
++			fs->target,
++			fstype,
++			optstr,
++#endif
+ 			&n);
+ 	xrc = rc;
+ 
+@@ -144,6 +163,16 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+ 	unsigned int maj, min;
+ 	char *fstype = NULL, *src = NULL, *p;
+ 
++#ifndef HAVE_SCANF_MS_MODIFIER
++	size_t len = strlen(s) + 1;
++	fs->root = malloc(len);
++	fs->target = malloc(len);
++	fs->vfs_optstr = malloc(len);
++	fs->fs_optstr = malloc(len);
++	fstype = malloc(len);
++	src = malloc(len);
++#endif
++
+ 	rc = sscanf(s,	"%d "		/* (1) id */
+ 			"%d "		/* (2) parent */
+ 			"%u:%u "	/* (3) maj:min */
+@@ -155,9 +184,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+ 			&fs->id,
+ 			&fs->parent,
+ 			&maj, &min,
++#ifdef HAVE_SCANF_MS_MODIFIER
+ 			&fs->root,
+ 			&fs->target,
+ 			&fs->vfs_optstr,
++#else
++			fs->root,
++			fs->target,
++			fs->vfs_optstr,
++#endif
+ 			&end);
+ 
+ 	if (rc >= 7 && end > 0)
+@@ -177,9 +212,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+ 			UL_SCNsA" "	/* (9) source */
+ 			UL_SCNsA,	/* (10) fs options (fs specific) */
+ 
++#ifdef HAVE_SCANF_MS_MODIFIER
+ 			&fstype,
+ 			&src,
+ 			&fs->fs_optstr);
++#else
++			fstype,
++			src,
++			fs->fs_optstr);
++#endif
+ 
+ 	if (rc >= 10) {
+ 		size_t sz;
+@@ -298,14 +339,25 @@ static int mnt_parse_swaps_line(struct libmnt_fs *fs, char *s)
+ 	int rc;
+ 	char *src = NULL;
+ 
++#ifndef HAVE_SCANF_MS_MODIFIER
++	size_t len = strlen(s) + 1;
++	src = malloc(len);
++	fs->swaptype = malloc(len);
++#endif
++
+ 	rc = sscanf(s,	UL_SCNsA" "	/* (1) source */
+ 			UL_SCNsA" "	/* (2) type */
+ 			"%ju"		/* (3) size */
+ 			"%ju"		/* (4) used */
+ 			"%d",		/* priority */
+ 
++#ifdef HAVE_SCANF_MS_MODIFIER
+ 			&src,
+ 			&fs->swaptype,
++#else
++			src,
++			fs->swaptype,
++#endif
+ 			&fsz,
+ 			&usz,
+ 			&fs->priority);
+-- 
+2.7.3
+