From: Zac Medico Date: Mon, 20 Dec 2010 13:48:39 +0000 (-0800) Subject: Use write_atomic to rewrite lafiles. X-Git-Tag: v2.2.0_alpha10~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f991bb526d50c363dd0743955cb463f7ecb135cb;p=portage.git 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. --- 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 \