launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #14882
[Merge] lp:~jtv/maas/document-tarfile-mtime into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/document-tarfile-mtime into lp:maas.
Commit message:
Document need to initialize mtime on files inside a tar archive.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/maas/document-tarfile-mtime/+merge/141582
As per Julian's request.
--
https://code.launchpad.net/~jtv/maas/document-tarfile-mtime/+merge/141582
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/document-tarfile-mtime into lp:maas.
=== modified file 'src/metadataserver/models/commissioningscript.py'
--- src/metadataserver/models/commissioningscript.py 2012-12-20 11:15:28 +0000
+++ src/metadataserver/models/commissioningscript.py 2013-01-02 07:04:22 +0000
@@ -53,7 +53,10 @@
assert isinstance(content, bytes), "Script content must be binary."
tarinfo = tarfile.TarInfo(name=os.path.join(ARCHIVE_PREFIX, name))
tarinfo.size = len(content)
- tarinfo.mode = 0755 # u=rwx,go=rx
+ # Mode 0755 means: u=rwx,go=rx
+ tarinfo.mode = 0755
+ # Modification time defaults to Epoch, which elicits annoying
+ # warnings when decompressing.
tarinfo.mtime = mtime
tarball.addfile(tarinfo, BytesIO(content))
=== modified file 'src/metadataserver/tests/test_commissioningscript.py'
--- src/metadataserver/tests/test_commissioningscript.py 2012-12-20 11:24:27 +0000
+++ src/metadataserver/tests/test_commissioningscript.py 2013-01-02 07:04:22 +0000
@@ -90,6 +90,9 @@
self.assertEqual({0755}, {info.mode for info in archive.getmembers()})
def test_get_archive_initializes_file_timestamps(self):
+ # The mtime on a file inside the tarball is reasonable.
+ # It would otherwise default to the Epoch, and GNU tar warns
+ # annoyingly about improbably old files.
start_time = floor(time.time())
script = factory.make_commissioning_script()
path = os.path.join(ARCHIVE_PREFIX, script.name)