[Kde-pim] Review Request 113340: fix reading of mbox file when slowly filled by external program
Kevin Krammer
krammer at kde.org
Thu Feb 6 19:30:22 GMT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/113340/#review49150
-----------------------------------------------------------
I assume the unittest still run?
Do you think you could create a unit test that fails without this and works with this change?
kmbox/mbox_p.cpp
<https://git.reviewboard.kde.org/r/113340/#comment34714>
does it hurt to leave it here?
The other line could then have a commend like
// update file size in case it has changed while we were waiting for the lock.
- Kevin Krammer
On Feb. 6, 2014, 7:23 p.m., Martin Koller wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/113340/
> -----------------------------------------------------------
>
> (Updated Feb. 6, 2014, 7:23 p.m.)
>
>
> Review request for KDEPIM-Libraries and Bertjan Broeksema.
>
>
> Bugs: 324173
> http://bugs.kde.org/show_bug.cgi?id=324173
>
>
> Repository: kdepimlibs
>
>
> Description
> -------
>
> The mbox resource can watch for file changes.
> When an external program fills the mbox file and this takes some time (e.g. 10 seconds, during which mails get added and added),
> the file watcher triggers indirectly the method MBox::load(), which does as a first step d->initLoad( fileName ); (mainly to set the filename
> so the following lock() call knows what the lockfile shall be).
> But the bug is that the d->initLoad( fileName ) call also stores the current mbox filesize - which is still changing until the lock can be finally made.
> (I'm talking about procmail lockfile). When the external program is finally done, the mbox filesize is larger than what the mbox resource
> has stored in d->mInitialMboxFileSize
>
> This patch stores the filesize AFTER the lock could be made.
>
>
> Diffs
> -----
>
> kmbox/mbox.cpp 3658bf6
> kmbox/mbox_p.cpp b4e323b
>
> Diff: https://git.reviewboard.kde.org/r/113340/diff/
>
>
> Testing
> -------
>
> The following shell script shows the problem (you also need a file "testmail" which contains a mail to be added).
> E.g. make sure the mbox file is empty, the run the script. When the loop is done, kmail will tell you there are 5 new mails, but
> only the first one shows subject, sender, etc.
>
> #!/bin/bash
>
> num=$RANDOM
> i=0
>
> LOCKFILE=~/airsync.mbox.lock
> lockfile -l20 -r5 $LOCKFILE
> if [ $? -ne 0 ]
> then
> echo "locking error"
> exit
> fi
>
> while (( $i < 5 ))
> do
> let num++
> let i++
> echo "sending mail" $num
> sed -e "s/<NUMBER>/$num/" testmail >> ~/airsync.mbox
> ls -l ~/airsync.mbox*
>
> sleep 3
> done
>
> rm -f $LOCKFILE
>
>
> Thanks,
>
> Martin Koller
>
>
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list