Merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05 into lp:ubuntu-filemanager-app

Proposed by Carlos Jose Mazieri on 2015-10-21
Status: Merged
Approved by: Nicholas Skaggs on 2015-10-28
Approved revision: 478
Merged at revision: 489
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05
Merge into: lp:ubuntu-filemanager-app
Diff against target: 98 lines (+24/-12)
3 files modified
src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp (+7/-4)
src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp (+15/-6)
src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.h (+2/-2)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Needs Fixing on 2015-10-27
Arto Jalkanen 2015-10-21 Approve on 2015-10-27
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-10-21
Review via email: mp+275164@code.launchpad.net

Commit message

changed SmbUtil::getStat() and SmbUtil::getFstat() to return int as they do not handle items from SmbUtil::StatReturn, they are just a wrapper to libsmbclient stat functions, is SmbUtil::getStatInfo() which does handle SmbUtil::StatReturn

Description of the change

changed SmbUtil::getStat() and SmbUtil::getFstat() to return int as they do not handle items from SmbUtil::StatReturn, they are just a wrapper to libsmbclient stat functions, is SmbUtil::getStatInfo() which does handle SmbUtil::StatReturn

To post a comment you must log in.
review: Approve (continuous-integration)
review: Needs Fixing (continuous-integration)
Arto Jalkanen (ajalkane) wrote :

getStat()'s return value is always casted to StatReturn, so it would seem to me that it'd be better to have getStat() rturn always StatReturn so that the casting would be in one place and not dispersed around code.

review: Approve

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/filemanager-app-autolanding/1/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/4/console

review: Needs Fixing (continuous-integration)

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/filemanager-app-autolanding/2/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/5/console

review: Needs Fixing (continuous-integration)
Nicholas Skaggs (nskaggs) wrote :

Blast that libsmbclient . . . I'll keep working on it guys! In the interim, I've disabled builds so you can land using the old bot. hopefully tomorrow will find success.

Nicholas Skaggs (nskaggs) wrote :

I'll note, I only disabled the autolanding job, so it will still try and build. you can ignore any failures. Top approving will allow it to land.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp'
2--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp 2015-08-15 18:38:28 +0000
3+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp 2015-10-21 11:04:00 +0000
4@@ -232,13 +232,16 @@
5 SmbUtil::StatReturn ret = SmbUtil::StatInvalid;
6 if (isOpen())
7 {
8- ret = smbObj()->getFstat(m_context,m_fd, &st);
9+ ret = static_cast<SmbUtil::StatReturn> (smbObj()->getFstat(m_context,m_fd,&st));
10 }
11 else
12 {
13- SmbLocationItemFile *mySelf = const_cast<SmbLocationItemFile*> (this);
14- mySelf->createContext();
15- ret = smbObj()->getStat(m_context,cleanUrl(), &st);
16+ if (m_context != 0) {
17+ ret = static_cast<SmbUtil::StatReturn> (smbObj()->getStat(m_context,cleanUrl(),&st));
18+ }
19+ else {
20+ ret = smbObj()->getStatInfo(cleanUrl(),&st);
21+ }
22 }
23 if(ret == SmbUtil::StatDone)
24 {
25
26=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp'
27--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp 2015-10-04 16:02:27 +0000
28+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp 2015-10-21 11:04:00 +0000
29@@ -38,11 +38,17 @@
30
31 #if defined(SHOW_MESSAGES)
32 # define DBG(more_items) qDebug() << Q_FUNC_INFO more_items
33+# define DBG_STAT(ret) qDebug() << Q_FUNC_INFO \
34+ << "return:" << ret \
35+ << "mode:" << st->st_mode \
36+ << "mtime:" << st->st_mtime \
37+ << "size:" << st->st_size
38 #else
39 #define DBG(none)
40+#define DBG_STAT(ret)
41 #endif
42
43-#define SHOW_ERRNO(path) if (errno != 0 && errno != ENOENT) \
44+#define SHOW_ERRNO(path) if (errno != 0) \
45 { \
46 qWarning() << Q_FUNC_INFO << "path:" << path << "errno:" << errno << strerror(errno); \
47 }
48@@ -358,7 +364,7 @@
49 else if (errno != EACCES && errno != ECONNREFUSED) // perhaps is a file
50 {
51 errno = 0;
52- ret = getStat(context, smb_path,st);
53+ ret = static_cast<SmbUtil::StatReturn> (getStat(context, smb_path,st));
54 }
55
56 if (errno != 0)
57@@ -740,19 +746,22 @@
58 }
59
60
61-SmbUtil::StatReturn
62+int
63 SmbUtil::getFstat(Smb::Context context, Smb::FileHandler fd, struct stat* st)
64 {
65 ::memset(st,0,sizeof(struct stat));
66 int ret = ::smbc_getFunctionFstat(context)(context,fd, st);
67- return static_cast<SmbUtil::StatReturn> (ret);
68+ DBG_STAT(ret);
69+ return ret;
70 }
71
72
73-SmbUtil::StatReturn
74+int
75 SmbUtil::getStat(Smb::Context context, const QString& smb_path, struct stat* st)
76 {
77 ::memset(st,0,sizeof(struct stat));
78+ DBG(<< smb_path);
79 int ret = ::smbc_getFunctionStat(context)(context,smb_path.toLocal8Bit().constData(), st);
80- return static_cast<SmbUtil::StatReturn> (ret);
81+ DBG_STAT(ret);
82+ return ret;
83 }
84
85=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.h'
86--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.h 2015-07-15 13:00:56 +0000
87+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.h 2015-10-21 11:04:00 +0000
88@@ -94,8 +94,8 @@
89 bool recursive = false,
90 QDir::Filters filters = QDir::AllEntries | QDir::NoDotAndDotDot,
91 const QStringList& filterNames = QStringList());
92- StatReturn getFstat(Smb::Context context, Smb::FileHandler fd, struct stat* st);
93- StatReturn getStat(Smb::Context context, const QString& smb_path, struct stat* st);
94+ int getFstat(Smb::Context context, Smb::FileHandler fd, struct stat* st);
95+ int getStat(Smb::Context context, const QString& smb_path, struct stat* st);
96
97 private:
98 StatReturn guessDirType(Smb::Context context, Smb::FileHandler fd);

Subscribers

People subscribed via source and target branches