This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv2 2/2] Initialize tunable list with the GLIBC_TUNABLES environment variable


On Mon, Jan 18, 2016 at 04:17:14PM -0600, Paul E. Murphy wrote:
> While this does work as expected with trivial inputs, it does
> have some quirks:
> 
> I.e this will set the desired tunable:
> GLIBC_TUNABLES="glibc.pthread.elision_enable=1"
> GLIBC_TUNABLES="glibc.pthread.elision_enable=1:"
> GLIBC_TUNABLES="foo=:glibc.pthread.elision_enable=1"
> 
> But the following does not:
> GLIBC_TUNABLES=":glibc.pthread.elision_enable=1"
> GLIBC_TUNABLES="foo:glibc.pthread.elision_enable=1"
> GLIBC_TUNABLES="val=foo:bar:glibc.pthread.elision_enable=1"

Thanks for testing, this patch on top of 2/2 should fix this.

Siddhesh

diff --git a/tunables/tunables.c b/tunables/tunables.c
index d5090fd..b942c10 100644
--- a/tunables/tunables.c
+++ b/tunables/tunables.c
@@ -157,7 +157,7 @@ __tunables_init (char **envp)
       size_t len = 0;
 
       /* First, find where the name ends.  */
-      while (p[len] != '=' && p[len] != '\0')
+      while (p[len] != '=' && p[len] != ':' && p[len] != '\0')
 	len++;
 
       /* If we reach the end of the string before getting a valid name-value
@@ -165,6 +165,14 @@ __tunables_init (char **envp)
       if (p[len] == '\0')
 	goto out;
 
+      /* We did not find a valid name-value pair before encountering the
+	 colon.  */
+      if (p[len]== ':')
+	{
+	  p += len + 1;
+	  continue;
+	}
+
       p[len] = '\0';
       p += len + 1;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]