mtp

Merge lp:~cyphermox/mtp/file-sizes into lp:mtp

Proposed by Mathieu Trudel-Lapierre on 2015-06-29
Status: Needs review
Proposed branch: lp:~cyphermox/mtp/file-sizes
Merge into: lp:mtp
Diff against target: 80 lines (+18/-6)
3 files modified
debian/changelog (+10/-0)
server/UbuntuMtpDatabase.h (+7/-5)
src/MtpServer.cpp (+1/-1)
To merge this branch: bzr merge lp:~cyphermox/mtp/file-sizes
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-07-02
Ubuntu Phablet Team 2015-06-29 Pending
Review via email: mp+263248@code.launchpad.net

Commit message

Better handle large files.

To post a comment you must log in.
lp:~cyphermox/mtp/file-sizes updated on 2015-06-29
70. By Mathieu Trudel-Lapierre on 2015-06-29

Update changelog for bug 1455464

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:69
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mathieu-tl/mtp/file-sizes/+merge/263248/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mtp-ci/35/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-amd64-ci/7
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/7
        deb: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/7/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-i386-ci/7

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mtp-ci/35/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:70
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mathieu-tl/mtp/file-sizes/+merge/263248/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mtp-ci/36/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-amd64-ci/8
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/8
        deb: http://jenkins.qa.ubuntu.com/job/mtp-vivid-armhf-ci/8/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mtp-vivid-i386-ci/8

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mtp-ci/36/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

70. By Mathieu Trudel-Lapierre on 2015-06-29

Update changelog for bug 1455464

69. By Mathieu Trudel-Lapierre on 2015-05-22

boost::filesystem file_size() returns a uintmax_t; and the MTP_PROPERTY_OBJECT_SIZE property should be a UINT64 anyway.

68. By Mathieu Trudel-Lapierre on 2015-05-22

Properly return MTP_RESPONSE_OBJECT_TOO_LARGE in MtpServer before reaching the database only if the reported file size is greater than the reported max file size, and isn't larger than a UINT32.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-03-11 19:36:38 +0000
3+++ debian/changelog 2015-06-29 15:15:32 +0000
4@@ -1,3 +1,13 @@
5+mtp (0.0.4+15.04.20150219-0ubuntu3) UNRELEASED; urgency=medium
6+
7+ * Better handle the quirks of the MTP spec: base MTP supports up to 32 bit
8+ file sizes in the CompressedSize parameter, if it's bigger, that field
9+ needs to be set to 0xffffffff and the complete value (in a 64 bit field)
10+ will fit in the ObjectSize property. Also make sure we use uintmax to keep
11+ the file size everywhere. (LP: #1455464)
12+
13+ -- Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com> Mon, 29 Jun 2015 11:12:08 -0400
14+
15 mtp (0.0.4+15.04.20150219-0ubuntu2) vivid; urgency=medium
16
17 * Properly fixing the startup script, as the previous change broke
18
19=== modified file 'server/UbuntuMtpDatabase.h'
20--- server/UbuntuMtpDatabase.h 2015-01-26 19:35:23 +0000
21+++ server/UbuntuMtpDatabase.h 2015-06-29 15:15:32 +0000
22@@ -63,7 +63,7 @@
23 MtpStorageID storage_id;
24 MtpObjectFormat object_format;
25 MtpObjectHandle parent;
26- size_t object_size;
27+ uintmax_t object_size;
28 std::string display_name;
29 std::string path;
30 int watch_fd;
31@@ -608,7 +608,7 @@
32 case MTP_PROPERTY_STORAGE_ID: packet.putUInt32(db.at(handle).storage_id); break;
33 case MTP_PROPERTY_PARENT_OBJECT: packet.putUInt32(db.at(handle).parent); break;
34 case MTP_PROPERTY_OBJECT_FORMAT: packet.putUInt16(db.at(handle).object_format); break;
35- case MTP_PROPERTY_OBJECT_SIZE: packet.putUInt32(db.at(handle).object_size); break;
36+ case MTP_PROPERTY_OBJECT_SIZE: packet.putUInt64(db.at(handle).object_size); break;
37 case MTP_PROPERTY_DISPLAY_NAME: packet.putString(db.at(handle).display_name.c_str()); break;
38 case MTP_PROPERTY_OBJECT_FILE_NAME: packet.putString(db.at(handle).display_name.c_str()); break;
39 case MTP_PROPERTY_PERSISTENT_UID: packet.putUInt128(handle); break;
40@@ -841,7 +841,7 @@
41 if (property == ALL_PROPERTIES || property == MTP_PROPERTY_OBJECT_SIZE) {
42 packet.putUInt32(i);
43 packet.putUInt16(MTP_PROPERTY_OBJECT_SIZE);
44- packet.putUInt16(MTP_TYPE_UINT32);
45+ packet.putUInt16(MTP_TYPE_UINT64);
46 packet.putUInt32(entry.object_size);
47 }
48
49@@ -948,7 +948,9 @@
50 info.mStorageID = db.at(handle).storage_id;
51 info.mFormat = db.at(handle).object_format;
52 info.mProtectionStatus = 0x0;
53- info.mCompressedSize = db.at(handle).object_size;
54+ info.mCompressedSize
55+ = db.at(handle).object_size > 0xFFFFFFFF
56+ ? 0xFFFFFFFF : db.at(handle).object_size;
57 info.mImagePixWidth = 0;
58 info.mImagePixHeight = 0;
59 info.mImagePixDepth = 0;
60@@ -1116,7 +1118,7 @@
61 case MTP_PROPERTY_STORAGE_ID: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
62 case MTP_PROPERTY_PARENT_OBJECT: result = new MtpProperty(property, MTP_TYPE_UINT32, true); break;
63 case MTP_PROPERTY_OBJECT_FORMAT: result = new MtpProperty(property, MTP_TYPE_UINT16, false); break;
64- case MTP_PROPERTY_OBJECT_SIZE: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
65+ case MTP_PROPERTY_OBJECT_SIZE: result = new MtpProperty(property, MTP_TYPE_UINT64, false); break;
66 case MTP_PROPERTY_WIDTH: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
67 case MTP_PROPERTY_HEIGHT: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
68 case MTP_PROPERTY_IMAGE_BIT_DEPTH: result = new MtpProperty(property, MTP_TYPE_UINT32, false); break;
69
70=== modified file 'src/MtpServer.cpp'
71--- src/MtpServer.cpp 2014-10-31 15:56:55 +0000
72+++ src/MtpServer.cpp 2015-06-29 15:15:32 +0000
73@@ -912,7 +912,7 @@
74 if (maxFileSize != 0) {
75 // if mSendObjectFileSize is 0xFFFFFFFF, then all we know is the file size
76 // is >= 0xFFFFFFFF
77- if (mSendObjectFileSize > maxFileSize || mSendObjectFileSize == 0xFFFFFFFF)
78+ if (mSendObjectFileSize > maxFileSize && mSendObjectFileSize != 0xFFFFFFFF)
79 return MTP_RESPONSE_OBJECT_TOO_LARGE;
80 }
81

Subscribers

People subscribed via source and target branches