<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>342732</bug_id>
          
          <creation_ts>2015-01-11 14:51:04 +0000</creation_ts>
          <short_desc>FileCopyJob seems not to check whether target directory exists</short_desc>
          <delta_ts>2018-11-05 21:37:26 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>Frameworks and Libraries</classification>
          <product>frameworks-kio</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Gentoo Packages</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Elias Probst">mail</reporter>
          <assigned_to name="David Faure">faure</assigned_to>
          <cc>kdelibs-bugs-null</cc>
    
    <cc>nate</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1490345</commentid>
    <comment_count>0</comment_count>
    <who name="Elias Probst">mail</who>
    <bug_when>2015-01-11 14:51:04 +0000</bug_when>
    <thetext>When the directory ~/.cache/kioexec doesn&apos;t exist yet and &quot;man:cp&quot; is run from e.g. krunner, this error message will be shown.

Access denied.
Could not write to /home/elias/.cache/kioexec/krun/16719_0_cp.part.

This path is built in src/kioexec/main.cpp:110:
QString tmp = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + &quot;/krun/&quot;  +
              QString(&quot;%1_%2_%3&quot;).arg(QCoreApplication::applicationPid()).arg(jobCounter++).arg(fileName);

The actual job is created in 120:
KIO::Job *job = KIO::file_copy( url, dest );

Although the directory could be tested + created between 110 and 120, I feel like this should be done in a more generic way by KIO::file_copy() or even further up the job handling hierarchy.
Are there any explicit reasons not to ensure to heave created the target directory in the KIO::file_copy() job handling itself or is this just something which was simply missing until now?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1496342</commentid>
    <comment_count>1</comment_count>
    <who name="David Faure">faure</who>
    <bug_when>2015-02-01 18:28:22 +0000</bug_when>
    <thetext>It&apos;s not file_copy&apos;s job to create directories.

This is a porting bug, QStandardPaths doesn&apos;t create dirs while KStandardDirs did.

Thanks for spotting it. I&apos;ll commit the missing mkpath, can you re-test the bug and close it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1496343</commentid>
    <comment_count>2</comment_count>
    <who name="David Faure">faure</who>
    <bug_when>2015-02-01 18:30:02 +0000</bug_when>
    <thetext>Git commit ff412e0bd3ba543bc1ad4b96a661c10844cd993d by David Faure.
Committed on 01/02/2015 at 18:28.
Pushed by dfaure into branch &apos;master&apos;.

Fix porting error, mkpath needed after QStandardPaths::writableLocation().

Change-Id: Ib139c0f2af6538412a98b39cfb80fbb04c847705
CHANGELOG: fixed &quot;Could not write to &lt;path&gt;&quot; error when kioexec is triggered.

M  +2    -0    src/kioexec/main.cpp

http://commits.kde.org/kio/ff412e0bd3ba543bc1ad4b96a661c10844cd993d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1515333</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Egorov">egorov</who>
    <bug_when>2015-05-02 11:03:01 +0000</bug_when>
    <thetext>Git commit b290473167b9d0388715fffe494ee95a5c2c2851 by Boris Egorov.
Committed on 02/05/2015 at 10:47.
Pushed by egorov into branch &apos;master&apos;.

Fix path for writable location for kurl (kioexec)

There was a porting issue with this code:
QStandardPaths::writableLocation do not creates a directory [1], so we
need QDir::mkpath. Commit ff412e0bd3ba54 tried to fix it, but it gone
too far: we need to create directory only up to &quot;/krun/&quot;, strings after
that is filename. So we were creating directory instead of file,
confusing some apps. For example, kate [2].

New behavior was tested by removing CacheLocation, and it successfully
creates needed path.

    1: http://doc.qt.io/qt-5/qstandardpaths.html#writableLocation
    2: https://bugs.kde.org/show_bug.cgi?id=343329
Related: bug 343329
REVIEW: 123589
CHANGELOG: kioexec: Fixed path for writeable location for kurl

M  +3    -3    src/kioexec/main.cpp

http://commits.kde.org/kio/b290473167b9d0388715fffe494ee95a5c2c2851</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1773578</commentid>
    <comment_count>4</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2018-08-22 19:42:20 +0000</bug_when>
    <thetext>Is there anything left to do here after those commits?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808553</commentid>
    <comment_count>5</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2018-11-05 21:37:26 +0000</bug_when>
    <thetext>I&apos;m guessing not. Closing until someone responds otherwise.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>