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

RE: [PATCH v3 1/2] use HOST_NAME_MAX to size buffers for gethostname(2)

From
DTDavid Turner <david.turner@twosigma.com>
Date
Apr 19, 2017, 19:08 UTC
Message-ID
<b7a3844946934ecda1ba1ac5b972ff9d@exmbdft7.ad.twosigma.com>
In-Reply-To
<c0333c81-d3b2-ca2d-a553-75642d8fb949@web.de>
Show 11 quoted lines
> I had another look at this last night and cooked up the following patch.  Might
> have gone overboard with it..
> 
> -- >8 --
> Subject: [PATCH] gc: support arbitrary hostnames and pids in lock_repo_for_gc()
> 
> git gc writes its pid and hostname into a pidfile to prevent concurrent garbage
> collection.  Repositories may be shared between systems with different limits
> for host name length and different pid ranges.  Use a strbuf to store the file
> contents to allow for arbitrarily long hostnames and pids to be shown to the
> user on early abort.

This is pretty paranoid, but maybe the remote host has a longer pid_t than we do, so we should be using intmax_t when reading the pid, and only check its size before passing it to kill?

(Personally, I think this whole patch is kind of overkill, but some folks probably think the same about my original patches, so I'm happy to live and let live).

Previous: René ScharfeNext: Torsten Bögershausen
Message 13 of 18 in “gethostbyname fixes”
  1. 0/2 gethostbyname fixesDavid Turner, Apr 18, 2017
  2. 2/2 xgethostname: handle long hostnamesDavid Turner, Apr 18, 2017
  3. Jonathan NiederApr 19, 2017
  4. Junio C HamanoApr 19, 2017
  5. David TurnerApr 19, 2017
  6. René ScharfeApr 19, 2017
  7. Junio C HamanoApr 19, 2017
  8. 1/2 use HOST_NAME_MAX to size buffers for gethostname(2)David Turner, Apr 18, 2017
  9. Jonathan NiederApr 19, 2017
  10. Junio C HamanoApr 19, 2017
  11. René ScharfeApr 19, 2017
  12. René ScharfeApr 19, 2017
  13. David TurnerApr 19, 2017
  14. Torsten BögershausenApr 19, 2017
  15. René ScharfeApr 19, 2017
  16. Torsten BögershausenApr 20, 2017
  17. René ScharfeApr 20, 2017
  18. Torsten BögershausenApr 21, 2017

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.