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

Re: [PATCH] abspath.c: use PATH_MAX in real_path_internal()

From
Karsten Blees <karsten.blees@gmail.com>
Date
Jul 20, 2014, 00:29 UTC
Message-ID
<53CB0D81.1070404@gmail.com>
In-Reply-To
<CACsJy8D5X5svApB9edHK+1EaGi+q2ZRSOvyDYaDieVV2psgZPg@mail.gmail.com>
Am 18.07.2014 12:49, schrieb Duy Nguyen:
Show 5 quoted lines
> can be used, else we fall back to chdir. I think there are only four
> places that follow this pattern, here, setup.c (.git discovery), git.c
> (restore_env) and unix-socket.c. Enough call sites to make it worth
> the effort?
> 

real_path(): here we actually don't want to cd / cd back, we just do this because getcwd reolves symlinks.

setup.c: AFAICT this sets up the work dir and stays there (no cd back).

git.c: Only does a 'preliminary' repo setup so that the alias mechanism reads the correct config files. Then it reverts the setup if the resulting git command doesn't need it. Perhaps it would be better (and faster) to teach the alias code to read the right config file in the first place?

unix-socket.c: This looks pretty broken. The cd / cd back logic is only ever used if the socket path is too long. In this case, after cd'ing to the parent directory of the socket, unix_stream_listen tries to unlink the *original* socket path, instead of the remaining socket basename in sockaddr_un.sun_path. I.e. the subsequent bind() will fail on second invocation of the credential daemon.

Previous: Duy NguyenNext: René Scharfe
Message 8 of 17 in “abspath.c: use PATH_MAX in real_path_internal()”
  1. abspath.c: use PATH_MAX in real_path_internal()Nguyễn Thái Ngọc Duy, Jul 17, 2014
  2. René ScharfeJul 17, 2014
  3. Junio C HamanoJul 17, 2014
  4. Karsten BleesJul 17, 2014
  5. Duy NguyenJul 18, 2014
  6. René ScharfeJul 18, 2014
  7. Duy NguyenJul 19, 2014
  8. Karsten BleesJul 20, 2014
  9. René ScharfeJul 20, 2014
  10. Jeff KingJul 21, 2014
  11. René ScharfeJul 18, 2014
  12. Karsten BleesJul 19, 2014
  13. René ScharfeJul 20, 2014
  14. Junio C HamanoJul 17, 2014
  15. Karsten BleesJul 17, 2014
  16. Karsten BleesJul 17, 2014
  17. Junio C HamanoJul 18, 2014

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.