Skip to content
Snippets Groups Projects
Commit 8f016345 authored by Matt Mackall's avatar Matt Mackall
Browse files

merge with stable

parents 2e31a17a e240e914
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import collections import collections
import errno import errno
import os
import struct import struct
import zlib import zlib
...@@ -1495,6 +1496,20 @@ ...@@ -1495,6 +1496,20 @@
return node return node
def _writeentry(self, transaction, ifh, dfh, entry, data, link, offset): def _writeentry(self, transaction, ifh, dfh, entry, data, link, offset):
# Files opened in a+ mode have inconsistent behavior on various
# platforms. Windows requires that a file positioning call be made
# when the file handle transitions between reads and writes. See
# 3686fa2b8eee and the mixedfilemodewrapper in windows.py. On other
# platforms, Python or the platform itself can be buggy. Some versions
# of Solaris have been observed to not append at the end of the file
# if the file was seeked to before the end. See issue4943 for more.
#
# We work around this issue by inserting a seek() before writing.
# Note: This is likely not necessary on Python 3.
ifh.seek(0, os.SEEK_END)
if dfh:
dfh.seek(0, os.SEEK_END)
curr = len(self) - 1 curr = len(self) - 1
if not self._inline: if not self._inline:
transaction.add(self.datafile, offset) transaction.add(self.datafile, offset)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment