Review Request 112982: copyToFile support for kio_smb

Dawit Alemayehu adawit at kde.org
Fri Oct 25 14:18:00 BST 2013



> On Oct. 22, 2013, 8:08 a.m., David Faure wrote:
> > kioslave/smb/kio_smb_dir.cpp, line 285
> > <http://git.reviewboard.kde.org/r/112982/diff/2/?file=193087#file193087line285>
> >
> >     I'm pretty sure this cast is wrong. QFile::Permissions doesn't map to mode_t, at least not with a simple cast.
> >     
> >     Either do like kio_ftp does (KDE::open() instead of QFile), or add a call to chmod() at the end of the operation, or use a function to convert from mode_t to QFile::Permissions (maybe we want to have that in KFileItem, in fact).
> >     
> >     I prefer solution 2 or 3 above solution 1, so that QFile can be used as much as possible.
> 
> Dawit Alemayehu wrote:
>     Well you are probably right that it is a bad idea to do the cast here since everything does not perfectly map from mode_t to QFile::Permissions. However, at least the rwx permissions match exactly:
>     
>     S_IRUSR	00400	owner has read permission
>     S_IWUSR	00200	owner has write permission
>     S_IXUSR	00100	owner has execute permission
>     
>     S_IRGRP	00040	group has read permission
>     S_IWGRP	00020	group has write permission
>     S_IXGRP	00010	group has execute permission
>     
>     S_IROTH	00004	others have read permission
>     S_IWOTH	00002	others have write permission
>     S_IXOTH	00001	others have execute permission
>     
>     
>     QFile::ReadUser	   0x0400	The file is readable by the user.
>     QFile::WriteUser	  0x0200	The file is writable by the user.
>     QFile::ExeUser	    0x0100	The file is executable by the user.
>     
>     QFile::ReadGroup	  0x0040	The file is readable by the group.
>     QFile::WriteGroup	 0x0020	The file is writable by the group.
>     QFile::ExeGroup	   0x0010	The file is executable by the group.
>     
>     QFile::ReadOther	  0x0004	The file is readable by anyone.
>     QFile::WriteOther	 0x0002	The file is writable by anyone.
>     QFile::ExeOther	   0x0001	The file is executable by anyone.
>     
>     
>     Anyhow, I will see what I can do about finding a solution for this. However, I am confused why you would want it in KFileItem since that class is not even used in this particular code base. Should not something like that be added in a more convenience place? Perhaps kio/global.*?
> 
> David Faure wrote:
>     You're comparing numbers in octal (S_IRUSR) and numbers in hexa (QFile::ReadUser). They are not equal.
>     
>     You're right about KFileItem, it was a historical thing, a global function in kio/global.* would do indeed.

Created a patch that adds said function to kio/global.*. See https://git.reviewboard.kde.org/r/113429/


- Dawit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112982/#review42150
-----------------------------------------------------------


On Oct. 25, 2013, 1:10 p.m., Dawit Alemayehu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/112982/
> -----------------------------------------------------------
> 
> (Updated Oct. 25, 2013, 1:10 p.m.)
> 
> 
> Review request for KDE Runtime.
> 
> 
> Bugs: 176271 and 291835
>     http://bugs.kde.org/show_bug.cgi?id=176271
>     http://bugs.kde.org/show_bug.cgi?id=291835
> 
> 
> Repository: kde-runtime
> 
> 
> Description
> -------
> 
> The attach patch adds support for the following to kio_smb:
> 
> - copyToFile optimization so downloading files from window shares is faster.
> - partial download resumption as part of the copyToFile implementation.
> - preservation of modified file timstamp. Again as part of the copyToFile implementation.
> 
> Note that in this patch the latter two features only apply to "smb" -> "file" downloads. The second part of this patch that will add support for the other half, the "copyFromFile" optimization.
> 
> 
> Diffs
> -----
> 
>   kioslave/smb/kio_smb.h 55efb44 
>   kioslave/smb/kio_smb_dir.cpp 5573266 
>   kioslave/smb/smb.protocol 654bcfb 
> 
> Diff: http://git.reviewboard.kde.org/r/112982/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Dawit Alemayehu
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20131025/62111418/attachment.htm>


More information about the kde-core-devel mailing list