* Re: [gentoo-portage-dev] [PATCH] egencache --write-timestamp: use write_atomic (bug 577126)
@ 2016-03-12 18:27 99% ` Brian Dolbec
0 siblings, 0 replies; 1+ results
From: Brian Dolbec @ 2016-03-12 18:27 UTC (permalink / raw
To: gentoo-portage-dev
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>
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-03-12 8:29 [gentoo-portage-dev] [PATCH] egencache --write-timestamp: use write_atomic (bug 577126) Zac Medico
2016-03-12 18:27 99% ` Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox