[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request: Fix for stale permissions information in properties dialog
From:       "David Faure" <faure () kde ! org>
Date:       2013-01-02 15:38:05
Message-ID: 20130102153805.13054.95662 () vidsolbach ! de
[Download RAW message or body]

> On Dec. 28, 2011, 7:37 a.m., David Faure wrote:
> > kio/kio/kdirlister.cpp, line 1078
> > <http://git.reviewboard.kde.org/r/103555/diff/1/?file=44960#file44960line1078>
> > 
> > Yes, but changing permissions is only one case for ending up here. The most common case is that \
> > KDirWatch (in Stat mode) notifies us that a directory has changed because files have been created in \
> > it, or deleted, etc. In that case we do want to make the directory as dirty, not its parent. I guess \
> > that means we need to do both, mark the parent and the directory itself, as dirty. Sucks for \
> > performance, though. The real issue is that KDirWatch's dirty() signal is pretty unspecific.
> > 
> > Ah, I know. This is called by KDirWatch so it's local only, no networ transparency.
> > So we should just clear the permissions/owner in the KFileItem for the directory, they'll be \
> > re-determined on demand by KFileItem.
> 
> Dawit Alemayehu wrote:
> > Yes, but changing permissions is only one case for ending up here. The most common case is that \
> > KDirWatch (in Stat mode) notifies us that a directory has changed > because files have been created \
> > in it, or deleted, etc. In that case we do want to make the directory as dirty, not its parent.
> 
> Yes, I got that. But when an item in a given directory is renamed, deleted or created, slotFileDirty is \
> invoked with the path set to that directory and not the specific file or directory that was modified. \
> IOW if I have a directory called "Test" that contains two items, a directory named "New Folder" and a \
> file named "New File.txt", then when either one of those two items are renamed or deleted or a third \
> item is created the parameter to slotFileDirty is the full path to "Test". However, if I simply touch \
> or change permission on either one of those items, then the parameter to slotFileDirty is set to the \
> full path for "Test/New Folder" or "Test/New File.txt". 
> Everything works fine except when you change permissions or timestamp on the child directory, i.e "New \
> Folder". In that case because the parameter passed to slotFileDirty is the full path to the directory \
> that was modified, "Test/New Folder", the call to updateDirectory, called from handleDirtyDir, does \
> nothing. Why ? The call to checkUpdate always returns false since "New Folder" is in neither itemsInUse \
> nor itemsCached containers. 
> Dawit Alemayehu wrote:
> @David: Tried this approach, i.e. calling refresh on the changed directory's KFileItem if it is not in \
> the cache, but it did not seem to work for me. I am sure I am doing it wrong. Here is what I changed my \
> patch into: 
> if (!itemsInUse.contains(url.path()) && !itemsCached.contains(url.path())) {
> KFileItem* item = findByUrl(0, url);
> if (item) {
> kDebug(7004) << "*** Refreshing" << item;
> item->refresh();
> return;
> }
> }
> 
> But that does not seem to work. The code path is definitely hit called because the debug statement is \
> printed out on the command line.

Oh, I forgot to answer this (ouch, exactly a year ago already).

Your testing is based on the inotify backend. When using "stat" (due to no inotify support -- for \
instance on non-linux systems, or over NFS), slotFileDirty isn't emitted. All that KDirWatch can find out \
is that "something changed inside directory <parent>".

As in your more recent patch, the condition inside the if() is wrong, the if() will always pass since \
these contain urls, not paths.

Refreshing the item might have the problem that whichever code looks into the item later on, is working \
on a copy. KDirLister needs to call emitRefreshedItems in order to let the world know about the modified \
item.


- David


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


On Dec. 29, 2012, 8:31 p.m., Dawit Alemayehu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103555/
> -----------------------------------------------------------
> 
> (Updated Dec. 29, 2012, 8:31 p.m.)
> 
> 
> Review request for kdelibs and David Faure.
> 
> 
> Description
> -------
> 
> If you open a directory that contains other directories in Konqueror or Dolphin, change the permission \
> of one of these directories from outside, say the command line, and right click on the same directory \
> to look at the permission tab in the properties dialog, you will see that the permission change has not \
> been updated. This patch addresses that bug. 
> 
> This addresses bug 173733.
> http://bugs.kde.org/show_bug.cgi?id=173733
> 
> 
> Diffs
> -----
> 
> kio/kio/kdirlister.cpp ec3d622 
> 
> Diff: http://git.reviewboard.kde.org/r/103555/diff/
> 
> 
> Testing
> -------
> 
> 1. In konsole, create a test directory within another test directory:
> mkdir -p test/test1
> 
> 2. Open Dolphin or Konqueror and navigate to the top newly created directory, i.e. test.
> 
> 3. In konsole, cd into the first test directory:
> cd test
> 
> 4. In konsole, change the permission of 'test1' from konsole. For example,
> chmod go-rx
> 
> 5. In the open Dolphin or Konqueror, right click on "test1", select properties and click on permission \
> tab. 
> 6. Validate whether or not the permission shown in the GUI matches what you get in the command line.
> 
> 
> Thanks,
> 
> Dawit Alemayehu
> 
> 


[Attachment #3 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/103555/">http://git.reviewboard.kde.org/r/103555/</a>
     </td>
    </tr>
   </table>
   <br />








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On December 28th, 2011, 7:37 a.m., <b>David Faure</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: \
collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: \
4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/103555/diff/1/?file=44960#file44960line1078" style="color: black; \
font-weight: bold; text-decoration: underline;">kio/kio/kdirlister.cpp</a>  <span style="font-weight: \
normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KDirListerCache::slotFileDirty( const QString&amp; path )</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font \
size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; \
margin: 0; "></pre></td>  <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px \
solid #C0C0C0;" align="right"><font size="2">1078</font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="c1">// (read: parent) \
directory dirty. Not the one whose permission changed.</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: \
-o-pre-wrap; word-wrap: break-word;">Yes, but changing permissions is only one case for ending up here. \
The most common case is that KDirWatch (in Stat mode) notifies us that a directory has changed because \
files have been created in it, or deleted, etc. In that case we do want to make the directory as dirty, \
not its parent. I guess that means we need to do both, mark the parent and the directory itself, as \
dirty. Sucks for performance, though. The real issue is that KDirWatch&#39;s dirty() signal is pretty \
unspecific.

Ah, I know. This is called by KDirWatch so it&#39;s local only, no networ transparency.
So we should just clear the permissions/owner in the KFileItem for the directory, they&#39;ll be \
re-determined on demand by KFileItem.</pre>  </blockquote>



 <p>On December 28th, 2011, 4:49 p.m., <b>Dawit Alemayehu</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: \
-o-pre-wrap; word-wrap: break-word;">&gt; Yes, but changing permissions is only one case for ending up \
here. The most common case is that KDirWatch (in Stat mode) notifies us that a directory has changed &gt; \
because files have been created in it, or deleted, etc. In that case we do want to make the directory as \
dirty, not its parent.

Yes, I got that. But when an item in a given directory is renamed, deleted or created, slotFileDirty is \
invoked with the path set to that directory and not the specific file or directory that was modified. IOW \
if I have a directory called &quot;Test&quot; that contains two items, a directory named &quot;New \
Folder&quot; and a file named &quot;New File.txt&quot;, then when either one of those two items are \
renamed or deleted or a third item is created the parameter to slotFileDirty is the full path to \
&quot;Test&quot;. However, if I simply touch or change permission on either one of those items, then the \
parameter to slotFileDirty is set to the full path for &quot;Test/New Folder&quot; or &quot;Test/New \
File.txt&quot;.

Everything works fine except when you change permissions or timestamp on the child directory, i.e \
&quot;New Folder&quot;. In that case because the parameter passed to slotFileDirty is the full path to \
the directory that was modified, &quot;Test/New Folder&quot;, the call to updateDirectory, called from \
handleDirtyDir, does nothing. Why ? The call to checkUpdate always returns false since &quot;New \
Folder&quot; is in neither itemsInUse nor itemsCached containers.</pre>  </blockquote>





 <p>On January 2nd, 2012, 8:56 p.m., <b>Dawit Alemayehu</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: \
-o-pre-wrap; word-wrap: break-word;">@David: Tried this approach, i.e. calling refresh on the changed \
directory&#39;s KFileItem if it is not in the cache, but it did not seem to work for me. I am sure I am \
doing it wrong. Here is what I changed my patch into:

if (!itemsInUse.contains(url.path()) &amp;&amp; !itemsCached.contains(url.path())) {
    KFileItem* item = findByUrl(0, url);
    if (item) {
        kDebug(7004) &lt;&lt; &quot;*** Refreshing&quot; &lt;&lt; item;
        item-&gt;refresh();
        return;
    }
}

But that does not seem to work. The code path is definitely hit called because the debug statement is \
printed out on the command line.</pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; \
white-space: -o-pre-wrap; word-wrap: break-word;">Oh, I forgot to answer this (ouch, exactly a year ago \
already).

Your testing is based on the inotify backend. When using &quot;stat&quot; (due to no inotify support -- \
for instance on non-linux systems, or over NFS), slotFileDirty isn&#39;t emitted. All that KDirWatch can \
find out is that &quot;something changed inside directory &lt;parent&gt;&quot;.

As in your more recent patch, the condition inside the if() is wrong, the if() will always pass since \
these contain urls, not paths.

Refreshing the item might have the problem that whichever code looks into the item later on, is working \
on a copy. KDirLister needs to call emitRefreshedItems in order to let the world know about the modified \
item. </pre>
<br />




<p>- David</p>


<br />
<p>On December 29th, 2012, 8:31 p.m., Dawit Alemayehu wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: \
left top; background-repeat: repeat-x; border: 1px black solid;">  <tr>
  <td>

<div>Review request for kdelibs and David Faure.</div>
<div>By Dawit Alemayehu.</div>


<p style="color: grey;"><i>Updated Dec. 29, 2012, 8:31 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid \
#b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">If you open a directory that contains other \
directories in Konqueror or Dolphin, change the permission of one of these directories from outside, say \
the command line, and right click on the same directory to look at the permission tab in the properties \
dialog, you will see that the permission change has not been updated. This patch addresses that \
bug.</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">1. In konsole, create a test directory \
within another test directory:  mkdir -p test/test1

2. Open Dolphin or Konqueror and navigate to the top newly created directory, i.e. test.
   
3. In konsole, cd into the first test directory:
     cd test

4. In konsole, change the permission of &#39;test1&#39; from konsole. For example,
     chmod go-rx

5. In the open Dolphin or Konqueror, right click on &quot;test1&quot;, select properties and click on \
permission tab.

6. Validate whether or not the permission shown in the GUI matches what you get in the command \
line.</pre>  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=173733">173733</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kio/kio/kdirlister.cpp <span style="color: grey">(ec3d622)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/103555/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic