git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Subject: Re: [PATCH] am: ignore return value of write_file()
Date: Fri, 8 Jul 2016 20:44:28 +0200	[thread overview]
Message-ID: <577FF48C.4030008@web.de> (raw)
In-Reply-To: <alpine.DEB.2.20.1607080830430.6426@virtualbox>

Hi Dscho,

Am 08.07.2016 um 08:33 schrieb Johannes Schindelin:
> On Thu, 7 Jul 2016, René Scharfe wrote:
>> write_file() either returns 0 or dies, so there is no point in checking
>> its return value.
>
> The question is whether it makes sense for write_file() to die(). It is a
> library function and not every caller can be happy with that function to
> exit the program when some file could not be written, without a chance to
> tell the user what to do about the situation.
>
> If write_file() was defined in builtin/am.c, as a static function, I would
> grudgingly acquiesce, but it is not.
>
> IMO it would be better to fix write_file() to *not* die() but return
> error() instead.

there is write_file_gently() for that purpose, but it's used only by a 
single caller that exits on failure after all, and in fact Peff's series 
drops it.

So I think write_file() is fine, and it's rather a question of whether 
am should use write_file_gently() instead.  I don't see why, but perhaps 
that's because it's Friday..

René

  reply	other threads:[~2016-07-08 18:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 20:02 [PATCH] am: ignore return value of write_file() René Scharfe
2016-07-07 20:31 ` Jeff King
2016-07-08  6:37   ` Johannes Schindelin
2016-07-08  6:56     ` Jeff King
2016-07-08  9:04       ` [PATCH 0/8] write_file cleanups Jeff King
2016-07-08  9:06         ` [PATCH 1/8] config: fix bogus fd check when setting up default config Jeff King
2016-07-08  9:08         ` [PATCH 2/8] am: ignore return value of write_file() Jeff King
2016-07-08  9:08         ` [PATCH 3/8] branch: use non-gentle write_file for branch description Jeff King
2016-07-08  9:09         ` [PATCH 4/8] write_file: drop "gently" form Jeff King
2016-07-08  9:10         ` [PATCH 5/8] write_file: use xopen Jeff King
2016-07-08  9:12         ` [PATCH 6/8] write_file: add pointer+len variant Jeff King
2016-07-08  9:12         ` [PATCH 7/8] write_file: add format attribute Jeff King
2016-07-08  9:25           ` Jeff King
2016-07-08  9:25             ` [PATCH 1/2] walker: let walker_say take arbitrary formats Jeff King
2016-07-08  9:25             ` [PATCH 2/2] avoid using sha1_to_hex output as printf format Jeff King
2016-07-08 10:35               ` Jeff King
2016-07-08 17:02                 ` Junio C Hamano
2016-07-08 17:09                   ` Junio C Hamano
2016-07-08 21:41                     ` Jeff King
2016-07-08  9:12         ` [PATCH 8/8] use write_file_buf where applicable Jeff King
2016-07-08  9:16         ` [PATCH 9/8] branch: use write_file_buf instead of write_file Jeff King
2016-07-08 18:44         ` [PATCH 0/8] write_file cleanups René Scharfe
2016-07-09 14:24       ` [PATCH] am: ignore return value of write_file() Johannes Schindelin
2016-07-10 10:53         ` Johannes Schindelin
2016-07-08  6:33 ` Johannes Schindelin
2016-07-08 18:44   ` René Scharfe [this message]
2016-07-08 21:51     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=577FF48C.4030008@web.de \
    --to=l.s.r@web.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).