From 468d96a199bb39cf0d7dd5b36e21798e50f7b70e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 20 Dec 2010 05:48:39 -0800 Subject: [PATCH] Use write_atomic to rewrite lafiles. This should succeed even in some cases in which a normal write might fail due to file permission settings on some operating systems such as HP-UX. --- pym/portage/package/ebuild/doebuild.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 5bba19ff8..3071cf8d4 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1453,11 +1453,12 @@ def _post_src_install_uid_fix(mysettings, out): fixlafiles_announced = True writemsg("Fixing .la files\n", fd=out) writemsg(" %s\n" % fpath[len(destdir):], fd=out) - f = open(_unicode_encode(fpath, + # write_atomic succeeds even in some cases in which + # a normal write might fail due to file permission + # settings on some operating systems such as HP-UX + write_atomic(_unicode_encode(fpath, encoding=_encodings['merge'], errors='strict'), - mode='wb') - f.write(new_contents) - f.close() + new_contents, mode='wb') mystat = os.lstat(fpath) if stat.S_ISREG(mystat.st_mode) and \ -- 2.26.2