1 |
On Sat, 12 Mar 2016 00:29:49 -0800 |
2 |
Zac Medico <zmedico@g.o> wrote: |
3 |
|
4 |
> Use write_atomic in order to create a new inode. This leads to |
5 |
> copy-on-write behavior with hardlinks, which is useful if someone |
6 |
> wants to use hardlinks to create copy-on-write repository |
7 |
> snapshots on a filesystem such as ext4 (no need for btrfs or zfs). |
8 |
> |
9 |
> X-Gentoo-bug: 577126 |
10 |
> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=577126 |
11 |
> --- |
12 |
> bin/egencache | 6 +++--- |
13 |
> 1 file changed, 3 insertions(+), 3 deletions(-) |
14 |
> |
15 |
> diff --git a/bin/egencache b/bin/egencache |
16 |
> index 7e3387e..0123d57 100755 |
17 |
> --- a/bin/egencache |
18 |
> +++ b/bin/egencache |
19 |
> @@ -1165,9 +1165,9 @@ def egencache_main(args): |
20 |
> if options.write_timestamp: |
21 |
> timestamp_path = os.path.join(repo_path, 'metadata', |
22 |
> 'timestamp.chk') try: |
23 |
> - with open(timestamp_path, 'w') as f: |
24 |
> - f.write(time.strftime('%s\n' % |
25 |
> TIMESTAMP_FORMAT, time.gmtime())) |
26 |
> - except IOError: |
27 |
> + portage.util.write_atomic(timestamp_path, |
28 |
> + time.strftime('%s\n' % |
29 |
> TIMESTAMP_FORMAT, time.gmtime())) |
30 |
> + except (EnvironmentError, |
31 |
> portage.exception.PortageException): ret.append(os.EX_IOERR) |
32 |
> else: |
33 |
> ret.append(os.EX_OK) |
34 |
|
35 |
|
36 |
looks fine to me. |
37 |
|
38 |
-- |
39 |
Brian Dolbec <dolsen> |