From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] egencache --write-timestamp: use write_atomic (bug 577126)
Date: Sat, 12 Mar 2016 10:27:23 -0800 [thread overview]
Message-ID: <20160312102723.7c2bd639.dolsen@gentoo.org> (raw)
In-Reply-To: <1457771389-8614-1-git-send-email-zmedico@gentoo.org>
On Sat, 12 Mar 2016 00:29:49 -0800
Zac Medico <zmedico@gentoo.org> wrote:
> Use write_atomic in order to create a new inode. This leads to
> copy-on-write behavior with hardlinks, which is useful if someone
> wants to use hardlinks to create copy-on-write repository
> snapshots on a filesystem such as ext4 (no need for btrfs or zfs).
>
> X-Gentoo-bug: 577126
> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=577126
> ---
> bin/egencache | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/bin/egencache b/bin/egencache
> index 7e3387e..0123d57 100755
> --- a/bin/egencache
> +++ b/bin/egencache
> @@ -1165,9 +1165,9 @@ def egencache_main(args):
> if options.write_timestamp:
> timestamp_path = os.path.join(repo_path, 'metadata',
> 'timestamp.chk') try:
> - with open(timestamp_path, 'w') as f:
> - f.write(time.strftime('%s\n' %
> TIMESTAMP_FORMAT, time.gmtime()))
> - except IOError:
> + portage.util.write_atomic(timestamp_path,
> + time.strftime('%s\n' %
> TIMESTAMP_FORMAT, time.gmtime()))
> + except (EnvironmentError,
> portage.exception.PortageException): ret.append(os.EX_IOERR)
> else:
> ret.append(os.EX_OK)
looks fine to me.
--
Brian Dolbec <dolsen>
prev parent reply other threads:[~2016-03-12 18:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-12 8:29 [gentoo-portage-dev] [PATCH] egencache --write-timestamp: use write_atomic (bug 577126) Zac Medico
2016-03-12 18:27 ` Brian Dolbec [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160312102723.7c2bd639.dolsen@gentoo.org \
--to=dolsen@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox