From 8587ead78ad3d2af760270b21035ffe48fde3e7b Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 21 May 2012 19:10:17 -0400 Subject: drop length limitations on gecos-derived names and emails When we pull the user's name from the GECOS field of the passwd file (or generate an email address based on their username and hostname), we put the result into a static buffer. While it's extremely unlikely that anybody ever hit these limits (after all, in such a case their parents must have hated them), we still had to deal with the error cases in our code. Converting these static buffers to strbufs lets us simplify the code and drop some error messages from the documentation that have confused some users. The conversion is mostly mechanical: replace string copies with strbuf equivalents, and access the strbuf.buf directly. There are a few exceptions: - copy_gecos and copy_email are the big winners in code reduction (since they no longer have to manage the string length manually) - git_ident_config wants to replace old versions of the default name (e.g., if we read the config multiple times), so it must reset+add to the strbuf instead of just adding Note that there is still one length limitation: the gethostname interface requires us to provide a static buffer, so we arbitrarily choose 1024 bytes for the hostname. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-var.txt | 4 ---- 1 file changed, 4 deletions(-) (limited to 'Documentation/git-var.txt') diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt index 988a3234f4..3f703e3775 100644 --- a/Documentation/git-var.txt +++ b/Documentation/git-var.txt @@ -63,10 +63,6 @@ Diagnostics ----------- You don't exist. Go away!:: The passwd(5) gecos field couldn't be read -Your parents must have hated you!:: - The passwd(5) gecos field is longer than a giant static buffer. -Your sysadmin must hate you!:: - The passwd(5) name field is longer than a giant static buffer. SEE ALSO -------- -- cgit v1.2.1