<?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>395609</bug_id>
          
          <creation_ts>2018-06-19 13:59:06 +0000</creation_ts>
          <short_desc>New Text File is created with 600 (-rw-------) permissions</short_desc>
          <delta_ts>2019-10-24 18:21:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>krusader</product>
          <component>general</component>
          <version>2.7.0</version>
          <rep_platform>Other</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>triaged</keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>gbophuk_alt</reporter>
          <assigned_to name="Alex Bikadorov">alex.bikadorov</assigned_to>
          <cc>alex.bikadorov</cc>
    
    <cc>bb0072</cc>
    
    <cc>krusader-bugs-null</cc>
    
    <cc>nikita+kde</cc>
    
    <cc>toni.asensi</cc>
    
    <cc>vercha</cc>
          
          <cf_commitlink>https://commits.kde.org/krusader/262a96c795c702c7568803b64d3c67df9625364e</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>1762293</commentid>
    <comment_count>0</comment_count>
    <who name="">gbophuk_alt</who>
    <bug_when>2018-06-19 13:59:06 +0000</bug_when>
    <thetext>KDE Frameworks 5.46.0
QT 5.9.4
Krusader 2.7.0


Reproducing:
Open fro menu File -&gt; New Text File

What we get:
New file with 600 permissions 

What we expect:
New File with 644 permissions like in Dolphin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1762472</commentid>
    <comment_count>1</comment_count>
    <who name="Nikita Melnichenko">nikita+kde</who>
    <bug_when>2018-06-20 07:36:15 +0000</bug_when>
    <thetext>I confirm on my end. Same for Shift+F4. Permissions should be the same as when you touch the file and depend on umask setting.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1762496</commentid>
    <comment_count>2</comment_count>
    <who name="Toni Asensi Esteve">toni.asensi</who>
    <bug_when>2018-06-20 10:52:10 +0000</bug_when>
    <thetext>Confirmed using Kubuntu 18.04; this doesn&apos;t happen when creating folders, by the way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1833851</commentid>
    <comment_count>3</comment_count>
    <who name="Vera">vercha</who>
    <bug_when>2019-01-23 12:52:58 +0000</bug_when>
    <thetext>kde5-krusader-2.7.1
Bug is still actual</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1838654</commentid>
    <comment_count>4</comment_count>
    <who name="Alex Bikadorov">alex.bikadorov</who>
    <bug_when>2019-02-17 16:30:02 +0000</bug_when>
    <thetext>Heck! I cannot find out why it&apos;s not working.
It should done by
krusader/Panel/panelfunc.cpp:522
&gt; KIO::CopyJob *job = KIO::copy(QUrl::fromLocalFile(tempFile-&gt;fileName()),
&gt; job-&gt;setDefaultPermissions(true);

The same way it is done by KIO for Dolphin
filewidgets/knewfilemenu.cpp:615
&gt; KIO::CopyJob *job = KIO::copyAs(uSrc, dest);
&gt; job-&gt;setDefaultPermissions(true);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1838818</commentid>
    <comment_count>5</comment_count>
    <who name="">gbophuk_alt</who>
    <bug_when>2019-02-18 13:42:22 +0000</bug_when>
    <thetext>Maybe you should write a test app?
Also I couldn&apos;t find what the default permission are in the kio docs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1838915</commentid>
    <comment_count>6</comment_count>
    <who name="Nikita Melnichenko">nikita+kde</who>
    <bug_when>2019-02-18 18:57:12 +0000</bug_when>
    <thetext>Alex, the problem is not with the KIO::copy code. It&apos;s QTemporaryFile which is created with the restricted permissions. I think we should refactor the code and possibly remove the QTemporaryFile calls. I&apos;m not yet sure how to deal with remote file systems. Another option is not creating a file and let editor save it. I checked that it saves with proper permissions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1840234</commentid>
    <comment_count>7</comment_count>
    <who name="Alex Bikadorov">alex.bikadorov</who>
    <bug_when>2019-02-24 15:28:09 +0000</bug_when>
    <thetext>You&apos;re right Nikita, I missed that.

But this means that KIO::CopyJob::setDefaultPermissions() is not working. The documentation says it for exactly this use case - having umask applied when copying temporary files.

And AFAIK there is no way to create a file with KIO (KIO::open() seems to be only for opening existing files). All KIO code I have seen also uses the way to copy already existing files to a final destination.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1840246</commentid>
    <comment_count>8</comment_count>
    <who name="Alex Bikadorov">alex.bikadorov</who>
    <bug_when>2019-02-24 16:04:35 +0000</bug_when>
    <thetext>A patch that sets the permissions to 644 until the bug in KIO is fixed:
https://phabricator.kde.org/D19277</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1841280</commentid>
    <comment_count>9</comment_count>
    <who name="Nikita Melnichenko">nikita+kde</who>
    <bug_when>2019-03-02 07:34:54 +0000</bug_when>
    <thetext>I checked KIO::CopyJob::setDefaultPermissions and follow up code and this piece looks suspicious:

filecopyjob.cpp:
  501     if (d-&gt;m_mustChmod) {
  502         // If d-&gt;m_permissions == -1, keep the default permissions
  503         if (d-&gt;m_permissions != -1) {
  504             d-&gt;m_chmodJob = chmod(d-&gt;m_dest, d-&gt;m_permissions);
  505             addSubjob(d-&gt;m_chmodJob);
  506         }
  507         d-&gt;m_mustChmod = false;
  508     }

Haven&apos;t debugged though since KIO likely requires special debugging environment but according to the code (d-&gt;m_permissions == -1) is exactly happens after we call setDefaultPermissions and then chmod is never called.

So far I think the best way is to handle local files differently and create them with QFile to get the default permissions. The downside is that it should be handled carefully given the async nature of that code.

Probably, we should look more into the Dolphin code. They get around it somehow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1842758</commentid>
    <comment_count>10</comment_count>
    <who name="Alex Bikadorov">alex.bikadorov</who>
    <bug_when>2019-03-08 19:42:29 +0000</bug_when>
    <thetext>Fixed with commit dce5c5057c85a2d42e161f0dbd2dc6cd26c17a32.

Bug 404777 in KIO is still open.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1866469</commentid>
    <comment_count>11</comment_count>
    <who name="Nikita Melnichenko">nikita+kde</who>
    <bug_when>2019-07-01 07:19:53 +0000</bug_when>
    <thetext>Git commit 262a96c795c702c7568803b64d3c67df9625364e by Nikita Melnichenko.
Committed on 01/07/2019 at 07:10.
Pushed by melnichenko into branch &apos;stable&apos;.

Fixed new file permissions

Combined and adapted the following commits from master:
dce5c5057c85a2d42e161f0dbd2dc6cd26c17a32
c6db82bcb2d61e34e1c8bfb87aade25c7fed9093

FIXED: [ 395609 ] New Text File is created with 600 (-rw-------) permissions

Differential Revision: https://phabricator.kde.org/D19277

M  +3    -6    krusader/Panel/listpanel.cpp
M  +1    -1    krusader/Panel/listpanel.h
M  +2    -3    krusader/Panel/listpanelactions.cpp
M  +2    -2    krusader/Panel/listpanelactions.h
M  +2    -11   krusader/Panel/panelcontextmenu.cpp
M  +0    -2    krusader/Panel/panelcontextmenu.h
M  +53   -41   krusader/Panel/panelfunc.cpp
M  +4    -4    krusader/Panel/panelfunc.h

https://commits.kde.org/krusader/262a96c795c702c7568803b64d3c67df9625364e</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1887580</commentid>
    <comment_count>12</comment_count>
    <who name="Alex Bikadorov">alex.bikadorov</who>
    <bug_when>2019-10-24 18:21:08 +0000</bug_when>
    <thetext>*** Bug 413389 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>