Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-28 Thread Micha Lenk
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

Bas Wijnen wrote:
 On Wed, Aug 27, 2008 at 01:02:56PM -0700, Thomas Bushnell BSG wrote:
 I was trying to use gnucash over sshfs, to allow several machines to
 handle the same file.  It complained that it was unable to get a lock,
 and so couldn't prevent simultaneous writes.  This was no problem,
 because there isn't another person working on them.  For the rest,
 everything seemed to work fine.

 However, when trying to reopen the file, I found that it had not been
 written, but instead it was deleted.  So not only did I lose the work of
 the session, but it actually deleted my previous work as well.

 Are you sure this isn't a bug in sshfs?
 
 No, I'm not sure about that.  But from gnucash's behaviour, it seems
 that sshfs doesn't support locking (which I suppose is a known missing
 feature, but I didn't check), and gnucash handles that situation very
 badly.

I've just posted a fix for this bug to the upstream bug tracker. See
http://bugzilla.gnome.org/show_bug.cgi?id=549595 for further details.

Regards
  Micha
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFItu+/WN0/4pnhQbQRAtESAKCuuoTxKMlPvHVl2MOWD57UMabAOACgks78
pEeQKZd8yfZzG27gJ4auBzU=
=WMsf
-END PGP SIGNATURE-



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-28 Thread Thomas Bushnell BSG
On Thu, 2008-08-28 at 20:34 +0200, Micha Lenk wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi,
 
 Bas Wijnen wrote:
  On Wed, Aug 27, 2008 at 01:02:56PM -0700, Thomas Bushnell BSG wrote:
  I was trying to use gnucash over sshfs, to allow several machines to
  handle the same file.  It complained that it was unable to get a lock,
  and so couldn't prevent simultaneous writes.  This was no problem,
  because there isn't another person working on them.  For the rest,
  everything seemed to work fine.
 
  However, when trying to reopen the file, I found that it had not been
  written, but instead it was deleted.  So not only did I lose the work of
  the session, but it actually deleted my previous work as well.
 
  Are you sure this isn't a bug in sshfs?
  
  No, I'm not sure about that.  But from gnucash's behaviour, it seems
  that sshfs doesn't support locking (which I suppose is a known missing
  feature, but I didn't check), and gnucash handles that situation very
  badly.

Micha's got the gnucash fix, which I'll upload to Debian too.

But also, there is most certainly an sshfs bug here.  It has no business
whatsoever returning ENOSYS in response to a link call.  There are far
better error codes to return.

Thomas





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-28 Thread Micha Lenk
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Thomas,

Thomas Bushnell BSG wrote:
 The logic expressed in the #gnucash discussion is bogus.  Errors like
 ENLNK or EMLNK would also prevent link but not prevent copying.  There
 is no harm in at least trying copying if EROFS comes in, and the code
 shouldn't assume that every error on link will be an error on copying.

I totally agree, especially on not assuming errors without even giving
it a try. But in the end it's upstream who decides what the code looks
like and which patch makes it into SVN.

Without the patch the code was even more broken because (!err_ret) with
(err_ret = ENOSYS  0) equals FALSE, thus gnc_int_link_or_make_backup()
previously did (awfully broken) *not* return FALSE in this case. So at
least the patch (the part related to copy_success) will result in
gnc_int_link_or_make_backup() returning FALSE in case *both* link() and
copy_file() didn't succeed. Hence the change is definitely enough gain
to fix this bug.

Regards
  Micha
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFItwlmWN0/4pnhQbQRAgDpAKCAc+CwV2r1fjjw7Xn5sMkeOhvqqgCdEX4P
KOzOdJvhhiZ5R9+UxDzbdRI=
=pAVz
-END PGP SIGNATURE-



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-28 Thread Thomas Bushnell BSG
The logic expressed in the #gnucash discussion is bogus.  Errors like
ENLNK or EMLNK would also prevent link but not prevent copying.  There
is no harm in at least trying copying if EROFS comes in, and the code
shouldn't assume that every error on link will be an error on copying.

Thomas





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-28 Thread Micha Lenk
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Thomas,

Thomas Bushnell BSG wrote:
 But also, there is most certainly an sshfs bug here.  It has no business
 whatsoever returning ENOSYS in response to a link call.

I tried to figure out who is doing wrong here. If at all it's the fault
of fuse, who sets the default return code ENOSYS for all unset (i.e.
unimplemented) function pointers in fuse_operations -- the sshfs simply
does not implement a link() function.

A different error code for link() wouldn't be that a big deal: If I
understand the fuse code correctly it is sufficient to check for an
ENOSYS in kernel/dir.c at the end of the fuse_link() function and
replace it by the desired one. But...

 There are far better error codes to return.

... what error codes listed in the link(2) manpage do you think of?
The best one that comes to my mind is EPERM: The filesystem containing
oldpath and newpath does not support the creation of hard links.

But, sorry, I will stop here. If you think this should be reported to
the fuse package, go ahead, clone this bug and reassign the cloned bug
to fuse. For now I'm just comfortable with having a fix for Gnucash.

Regards
  Micha
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFItxsXWN0/4pnhQbQRAhY6AJ92dljsm6JCOvowVhZwK2ReeBDG8QCg4zUd
32oBx9qb5bI28AP+rVow0WU=
=7Caw
-END PGP SIGNATURE-



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-28 Thread Thomas Bushnell BSG
On Thu, 2008-08-28 at 23:39 +0200, Micha Lenk wrote:
  There are far better error codes to return.
 
 ... what error codes listed in the link(2) manpage do you think of?
 The best one that comes to my mind is EPERM: The filesystem containing
 oldpath and newpath does not support the creation of hard links.

That is surely correct.





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-27 Thread Bas Wijnen
Package: gnucash
Version: 2.2.6-1
Severity: grave
Justification: causes data loss

I was trying to use gnucash over sshfs, to allow several machines to
handle the same file.  It complained that it was unable to get a lock,
and so couldn't prevent simultaneous writes.  This was no problem,
because there isn't another person working on them.  For the rest,
everything seemed to work fine.

However, when trying to reopen the file, I found that it had not been
written, but instead it was deleted.  So not only did I lose the work of
the session, but it actually deleted my previous work as well.

I tried creating a new file, which also complains about the lock file,
but seems to work fine otherwise, but it also doesn't create the file.

This would have been a critical issue (causes serious data loss),
except that gnucash writes loads of log and backup files, so normally
most of the work will not actually be lost.

As a quick fix, it would be acceptable to turn the lock warning into an
error.

Thanks,
Bas Wijnen


signature.asc
Description: Digital signature


Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-27 Thread Micha Lenk
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

forwarded 496807 http://bugzilla.gnome.org/show_bug.cgi?id=549595
thanks

Hi Bas,

thank you for your feedback on Gnucash.
I have forwarded your report to the upstream bug tracker as
http://bugzilla.gnome.org/show_bug.cgi?id=549595

Regards
  Micha

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFItXzCWN0/4pnhQbQRAiKrAJ9UwCF+zvVF7T2e2WIVlKhG/n5BPACfTC74
GpT7oBeAcLVsN96/1ihqrD8=
=A28K
-END PGP SIGNATURE-



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-27 Thread Thomas Bushnell BSG
On Wed, 2008-08-27 at 17:46 +0200, Bas Wijnen wrote:
 Package: gnucash
 Version: 2.2.6-1
 Severity: grave
 Justification: causes data loss
 
 I was trying to use gnucash over sshfs, to allow several machines to
 handle the same file.  It complained that it was unable to get a lock,
 and so couldn't prevent simultaneous writes.  This was no problem,
 because there isn't another person working on them.  For the rest,
 everything seemed to work fine.
 
 However, when trying to reopen the file, I found that it had not been
 written, but instead it was deleted.  So not only did I lose the work of
 the session, but it actually deleted my previous work as well.

Are you sure this isn't a bug in sshfs?

Thomas





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#496807: gnucash: silently removes main files while trying to save without lock

2008-08-27 Thread Bas Wijnen
On Wed, Aug 27, 2008 at 01:02:56PM -0700, Thomas Bushnell BSG wrote:
  I was trying to use gnucash over sshfs, to allow several machines to
  handle the same file.  It complained that it was unable to get a lock,
  and so couldn't prevent simultaneous writes.  This was no problem,
  because there isn't another person working on them.  For the rest,
  everything seemed to work fine.
  
  However, when trying to reopen the file, I found that it had not been
  written, but instead it was deleted.  So not only did I lose the work of
  the session, but it actually deleted my previous work as well.
 
 Are you sure this isn't a bug in sshfs?

No, I'm not sure about that.  But from gnucash's behaviour, it seems
that sshfs doesn't support locking (which I suppose is a known missing
feature, but I didn't check), and gnucash handles that situation very
badly.

It is possible that the entire problem is with sshfs.  More testing
would be needed to find that out, either with trying to lock files on
sshfs, or with gnucash on other filesystems which don't support locking.

Thanks,
Bas

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://a82-93-13-222.adsl.xs4all.nl/e-mail.html


signature.asc
Description: Digital signature