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

Re: [PATCH] sha1_file.c (write_sha1_from_fd): Detect close failure.

From
Nicolas Pitre <nico@cam.org>
Date
Mar 26, 2007, 20:42 UTC
Message-ID
<alpine.LFD.0.83.0703261636410.3041@xanadu.home>
In-Reply-To
<7v8xdjwxr4.fsf@assigned-by-dhcp.cox.net>
On Mon, 26 Mar 2007, Junio C Hamano wrote:
Show 7 quoted lines
> Hmph.  Not catching error from close() is wrong, so this is an
> improvement, but it still leaves tmpfile on the filesystem,
> doesn't it?
> 
> Looking at write_sha1_file(), which is in a sense more important
> than this function, it is worse.  We should also detect error
> from close(), nuke the temporary file and return an error there.

Actually, the temp file is always left there whenever there is an error or die() is called or CTRL_C is issued.

I don't think it is worth bothering with the removal of temp files given all the cases that would have to be considered, and most probably not exercised that often (increasing their likelihood of bing buggy).

Instead, teaching git-purge about those tmp files might be a better idea.

Nicolas
Previous: Jim MeyeringNext: Nicolas Pitre
Message 4 of 5 in “sha1_file.c (write_sha1_from_fd): Detect close failure.”
  1. sha1_file.c (write_sha1_from_fd): Detect close failure.Jim Meyering, Mar 26, 2007
  2. Junio C HamanoMar 26, 2007
  3. Jim MeyeringMar 26, 2007
  4. Nicolas PitreMar 26, 2007
  5. Nicolas PitreMar 26, 2007

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.