Merge lp:~alextu/ubuntu-system-settings/incorrect-storage-size-2 into lp:ubuntu-system-settings

Proposed by Alex Tu
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 1354
Merged at revision: 1377
Proposed branch: lp:~alextu/ubuntu-system-settings/incorrect-storage-size-2
Merge into: lp:ubuntu-system-settings
Diff against target: 31 lines (+8/-5)
1 file modified
plugins/about/storageabout.cpp (+8/-5)
To merge this branch: bzr merge lp:~alextu/ubuntu-system-settings/incorrect-storage-size-2
Reviewer Review Type Date Requested Status
Sebastien Bacher (community) Approve
Ken VanDine Pending
Ubuntu Touch System Settings Pending
Review via email: mp+253312@code.launchpad.net

Commit message

for Arale device:
fixed:LP#1417459 Storage size not correct

Description of the change

for Arale device:
fixed:LP#1417459 Storage size not correct

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work

It would be useful if you explained a bit more what you are doing in the description (please add a commit message as well), e.g "deal with symlink mounts and with partition number being more than 1 digit"

I've added some review comments inline as well

review: Needs Fixing
1351. By Alex Tu

1. correct the indent.
2. replace canonicalize_file_name() by QDir's canonicalPath()

1352. By Alex Tu

remove debug message

Revision history for this message
Alex Tu (alextu) wrote :

Fixed the incorrect point.
And also leave message for explain the logic.
Please help to review it again.

Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks, the identic is still wrong though, you have 4 extra spaces indent after l432 without reason

that's because before the function was conditional to "if (fsName.startsWith(QString(QStringLiteral("mmc")))) {", e.g if the string wouldn't start with mmc it would fallback, which you remove

that points to another potential issue in your change, if index_mmc is -1, why do you continue the work rather than going to the fallback case as in the old code?

review: Needs Fixing
1353. By Alex Tu

revised the logic to go fallback code when path doesn't have expected mmc string.

Revision history for this message
Alex Tu (alextu) wrote :

sorry, missed the fallback case, already revised it.

Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks, that looks good to me now ;-)

review: Approve
Revision history for this message
Sebastien Bacher (seb128) wrote :

oh, you could move the "QString mmcString;" in the if() section, no need to allocate it if the index is -1

1354. By Alex Tu

move the "QString mmcString;" in the if() section, no need to allocate it if the index is -1

Revision history for this message
Alex Tu (alextu) wrote :

Hi Sebastien Bacher,

Thanks! I also revised the location of "QString mmcString".
Because of I do have permission to merge this change back to lp:ubuntu-system-settings

Can someone help me to do that or what I should do for next step?

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks Alex!

The touch components are landed through the CI machinery and not manually, please let it to us, it's on our list

review: Approve
Revision history for this message
Alex Tu (alextu) wrote :

Thanks a lot!

Revision history for this message
Alex Tu (alextu) wrote :

Hi Sebastien,
I find there already have several releases of ubuntu-system-settings after this change been approved. But they all looks not included my change.

Because of there have an issue on Arale waiting for this change.
https://bugs.launchpad.net/tangxi/+bug/1417459

So, can I have schedule about when is this change will be merged?

Thanks a lot.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/about/storageabout.cpp'
2--- plugins/about/storageabout.cpp 2015-02-18 12:06:06 +0000
3+++ plugins/about/storageabout.cpp 2015-03-26 06:25:59 +0000
4@@ -414,7 +414,7 @@
5 }
6
7 // Now need to guess if it's InternalDrive or RemovableDrive
8- QString fsName(QString::fromLatin1(entry.mnt_fsname));
9+ QString fsName = QDir(entry.mnt_fsname).canonicalPath();
10 if (fsName.contains(QString(QStringLiteral("mapper")))) {
11 struct stat status;
12 stat(entry.mnt_fsname, &status);
13@@ -424,11 +424,14 @@
14 if (!fsName.isEmpty()) {
15 if (fsName.length() > 3) {
16 // only take the parent of the device
17- if (fsName.at(fsName.size() -1).isDigit() && fsName.at(fsName.size() - 2) == QChar(QLatin1Char('p')))
18- fsName.chop(2);
19- if (fsName.startsWith(QString(QStringLiteral("mmc")))) {
20+ int index_mmc = fsName.indexOf("mmc",0,Qt::CaseInsensitive);
21+ if (index_mmc != -1) {
22+ QString mmcString;
23+ int index_p = fsName.indexOf('p',index_mmc,Qt::CaseInsensitive);
24+ mmcString = fsName.mid(index_mmc, index_p - index_mmc);
25+
26 // "removable" attribute is set only for removable media, and we may have internal mmc cards
27- fsName = QString(QStringLiteral("/sys/block/")) + fsName + QString(QStringLiteral("/device/uevent"));
28+ fsName = QString(QStringLiteral("/sys/block/")) + mmcString + QString(QStringLiteral("/device/uevent"));
29 QFile file(fsName);
30 if (file.open(QIODevice::ReadOnly)) {
31 QByteArray buf = file.readLine();

Subscribers

People subscribed via source and target branches