public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-apps/util-linux/files: util-linux-2.21.1-no-printf-alloc.patch util-linux-2.20.1-no-printf-alloc.patch
@ 2012-04-21  6:24 Mike Frysinger (vapier)
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger (vapier) @ 2012-04-21  6:24 UTC (permalink / raw
  To: gentoo-commits

vapier      12/04/21 06:24:18

  Added:                util-linux-2.21.1-no-printf-alloc.patch
                        util-linux-2.20.1-no-printf-alloc.patch
  Log:
  Add support for older C libraries that do not support latest POSIX standard (%as flags) #406303 by Ed Wildgoose.
  
  (Portage version: 2.2.0_alpha100/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?rev=1.1&content-type=text/plain

Index: util-linux-2.21.1-no-printf-alloc.patch
===================================================================
for systems that don't support latest POSIX standard: %as

https://bugs.gentoo.org/406303

--- a/configure.ac
+++ b/configure.ac
@@ -688,7 +688,6 @@ AC_ARG_ENABLE([libmount],
 UL_BUILD_INIT([libmount])
 UL_REQUIRES_LINUX([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)
 
 AC_SUBST([LIBMOUNT_VERSION])
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -22,6 +22,10 @@
 #include "pathnames.h"
 #include "strutils.h"
 
+#ifndef HAVE_SCANF_MS_MODIFIER
+# define UL_SCNsA "%s"
+#endif
+
 static inline char *skip_spaces(char *s)
 {
 	assert(s);
@@ -61,16 +65,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;
 
@@ -136,6 +155,15 @@ 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);
+	fstype = malloc(len);
+	src = malloc(len);
+#endif
+
 	rc = sscanf(s,	"%u "		/* (1) id */
 			"%u "		/* (2) parent */
 			"%u:%u "	/* (3) maj:min */
@@ -147,9 +175,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)
@@ -167,9 +201,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) {
 		fs->flags |= MNT_FS_KERNEL;



1.1                  sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch?rev=1.1&content-type=text/plain

Index: util-linux-2.20.1-no-printf-alloc.patch
===================================================================
for systems that don't support latest POSIX standard: %as

https://bugs.gentoo.org/406303

--- a/configure.ac
+++ b/configure.ac
@@ -489,10 +489,6 @@ as)
   AC_DEFINE([HAVE_SCANF_AS_MODIFIER], [1], [scanf %as modifier]) ;;
 *)
   AC_MSG_RESULT([no])
-  if "x$build_libmount" = xyes; then
-    AC_MSG_WARN([%as or %ms for sscanf() not found; do not build libmount])
-    build_libmount=no
-  fi
 esac
 
 
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -22,6 +22,10 @@
 #include "pathnames.h"
 #include "strutils.h"
 
+#ifndef HAVE_SCANF_MS_MODIFIER
+# define UL_SCNsA "%s"
+#endif
+
 static inline char *skip_spaces(char *s)
 {
 	assert(s);
@@ -61,16 +65,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;
 
@@ -136,6 +155,15 @@ 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);
+	fstype = malloc(len);
+	src = malloc(len);
+#endif
+
 	rc = sscanf(s,	"%u "		/* (1) id */
 			"%u "		/* (2) parent */
 			"%u:%u "	/* (3) maj:min */
@@ -147,9 +175,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)
@@ -167,9 +201,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) {
 		fs->flags |= MNT_FS_KERNEL;






^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-commits] gentoo-x86 commit in sys-apps/util-linux/files: util-linux-2.21.1-no-printf-alloc.patch util-linux-2.20.1-no-printf-alloc.patch
@ 2012-04-21 17:35 Mike Frysinger (vapier)
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger (vapier) @ 2012-04-21 17:35 UTC (permalink / raw
  To: gentoo-commits

vapier      12/04/21 17:35:24

  Modified:             util-linux-2.21.1-no-printf-alloc.patch
                        util-linux-2.20.1-no-printf-alloc.patch
  Log:
  Also malloc fs_optstr #406303#17 by Anthony Basile.
  
  (Portage version: 2.2.0_alpha100/cvs/Linux x86_64)

Revision  Changes    Path
1.2                  sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?r1=1.1&r2=1.2

Index: util-linux-2.21.1-no-printf-alloc.patch
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- util-linux-2.21.1-no-printf-alloc.patch	21 Apr 2012 06:24:18 -0000	1.1
+++ util-linux-2.21.1-no-printf-alloc.patch	21 Apr 2012 17:35:24 -0000	1.2
@@ -57,7 +57,7 @@
  			&n);
  	xrc = rc;
  
-@@ -136,6 +155,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+@@ -136,6 +155,16 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
  	unsigned int maj, min;
  	char *fstype = NULL, *src = NULL, *p;
  
@@ -66,6 +66,7 @@
 +	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



1.2                  sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch?r1=1.1&r2=1.2

Index: util-linux-2.20.1-no-printf-alloc.patch
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-apps/util-linux/files/util-linux-2.20.1-no-printf-alloc.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- util-linux-2.20.1-no-printf-alloc.patch	21 Apr 2012 06:24:18 -0000	1.1
+++ util-linux-2.20.1-no-printf-alloc.patch	21 Apr 2012 17:35:24 -0000	1.2
@@ -60,7 +60,7 @@
  			&n);
  	xrc = rc;
  
-@@ -136,6 +155,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+@@ -136,6 +155,16 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
  	unsigned int maj, min;
  	char *fstype = NULL, *src = NULL, *p;
  
@@ -69,6 +69,7 @@
 +	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






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-21 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-21 17:35 [gentoo-commits] gentoo-x86 commit in sys-apps/util-linux/files: util-linux-2.21.1-no-printf-alloc.patch util-linux-2.20.1-no-printf-alloc.patch Mike Frysinger (vapier)
  -- strict thread matches above, loose matches on Subject: below --
2012-04-21  6:24 Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox