git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[patch] fixup GECOS handling

From
MSMartin Schlemmer <azarah@nosferatu.za.org>
Date
Apr 22, 2005, 14:23 UTC
Message-ID
<1114179795.29271.18.camel@nosferatu.lan>
In-Reply-To
<1113827713.5286.13.camel@localhost.localdomain>
Hi,
This still applies - any reason for not doing this?
Thanks,
----

The GECOS is delimited by ',' or ';', so we should only use whatever is before the first ',' or ';' for the full name, rather than just stripping those.

Signed-off-by: Martin Schlemmer <azarah@gentoo.org>

commit-tree.c: ec53a4565ec0033aaf6df2a48d233ccf4823e8b0 --- 1/commit-tree.c +++ 2/commit-tree.c 2005-04-18 12:22:18.000000000 +0200

@@ -96,21 +96,6 @@
                if (!c)
                        break;
        }
-
-       /*
-        * Go back, and remove crud from the end: some people
-        * have commas etc in their gecos field
-        */
-       dst--;
-       while (--dst >= p) {
-               unsigned char c = *dst;
-               switch (c) {
-               case ',': case ';': case '.':
-                       *dst = 0;
-                       continue;
-               }
-               break;
-       }
 }

 static const char *month_names[] = {
@@ -313,6 +298,11 @@
        if (!pw)
                die("You don't exist. Go away!");
        realgecos = pw->pw_gecos;
+       /* The name is seperated from the room no., tel no, etc via [,;] */
+       if (strchr(realgecos, ','))
+               *strchr(realgecos, ',') = 0;
+       else if (strchr(realgecos, ';'))
+               *strchr(realgecos, ';') = 0;
        len = strlen(pw->pw_name);
        memcpy(realemail, pw->pw_name, len);
        realemail[len] = '@';
-- 
Martin Schlemmer



commit-tree.c: ec53a4565ec0033aaf6df2a48d233ccf4823e8b0
--- 1/commit-tree.c
+++ 2/commit-tree.c	2005-04-18 12:22:18.000000000 +0200
@@ -96,21 +96,6 @@
 		if (!c)
 			break;
 	}
-
-	/*
-	 * Go back, and remove crud from the end: some people
-	 * have commas etc in their gecos field
-	 */
-	dst--;
-	while (--dst >= p) {
-		unsigned char c = *dst;
-		switch (c) {
-		case ',': case ';': case '.':
-			*dst = 0;
-			continue;
-		}
-		break;
-	}
 }
 
 static const char *month_names[] = {
@@ -313,6 +298,11 @@
 	if (!pw)
 		die("You don't exist. Go away!");
 	realgecos = pw->pw_gecos;
+	/* The name is seperated from the room no., tel no, etc via ',' or ';' */
+	if (strchr(realgecos, ','))
+		*strchr(realgecos, ',') = 0;
+	else if (strchr(realgecos, ';'))
+		*strchr(realgecos, ';') = 0;
 	len = strlen(pw->pw_name);
 	memcpy(realemail, pw->pw_name, len);
 	realemail[len] = '@';
Previous: Martin SchlemmerNext: Kyle Hayes
Message 4 of 16 in “fixup GECOS handling”
  1. fixup GECOS handlingMartin Schlemmer, Apr 18, 2005
  2. David WoodhouseApr 18, 2005
  3. Martin SchlemmerApr 18, 2005
  4. fixup GECOS handlingMartin Schlemmer, Apr 22, 2005
  5. Kyle HayesApr 22, 2005
  6. Martin SchlemmerApr 22, 2005
  7. Petr BaudisApr 22, 2005
  8. Martin SchlemmerApr 22, 2005
  9. Kyle HayesApr 22, 2005
  10. Martin SchlemmerApr 22, 2005
  11. Kyle HayesApr 22, 2005
  12. Petr BaudisApr 23, 2005
  13. Martin SchlemmerApr 23, 2005
  14. Kyle HayesApr 22, 2005
  15. Andy IsaacsonApr 22, 2005
  16. Kyle HayesApr 25, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.