Bug 325472 - Import log file uses Invalid file path
Summary: Import log file uses Invalid file path
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-30 19:15 UTC by Ralf Habacker
Modified: 2019-08-29 15:39 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.1,5.0.0


Attachments
fixed path of generated log file (978 bytes, patch)
2013-09-30 19:16 UTC, Ralf Habacker
Details
screenshot with proposal (34.49 KB, image/png)
2017-05-24 09:11 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2013-09-30 19:15:32 UTC
In KMyMoneyApp::slotStatementImport() a temporary file containing imported statements is created using a path only working for Thomas Baumgart. 

 

Reproducible: Always

Steps to Reproduce:
1. run kmymoney with strace 
2. import statements 
3.
Actual Results:  
There were message complaining that /home/thb/kmm-statement-xxx.txt is an invalid path 

Expected Results:  
a log file should be created
Comment 1 Ralf Habacker 2013-09-30 19:16:06 UTC
Created attachment 82566 [details]
fixed path of generated log file
Comment 2 Marko Käning 2013-09-30 19:22:59 UTC
I can confirm this. Stumbled over it in the past as well.
Comment 3 Cristian Oneț 2013-10-01 04:29:38 UTC
From what I know this is an extra, kind of strange (if you ask me), feature that lets users debug statement import if something goes wrong.
Comment 4 Ralf Habacker 2013-10-01 06:05:30 UTC
(In reply to comment #3)
> From what I know this is an extra, kind of strange (if you ask me), feature
> that lets users debug statement import if something goes wrong.
which would require a related enable checkbox and an output path input field in the settings ?
Comment 5 Ralf Habacker 2013-10-01 09:50:51 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > From what I know this is an extra, kind of strange (if you ask me), feature
> > that lets users debug statement import if something goes wrong.
> which would require a related enable checkbox and an output path input field
> in the settings ?
or in the import dialog ?
Comment 6 Cristian Oneț 2013-10-01 10:08:38 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > From what I know this is an extra, kind of strange (if you ask me), feature
> > > that lets users debug statement import if something goes wrong.
> > which would require a related enable checkbox and an output path input field
> > in the settings ?
> or in the import dialog ?

Thomas should answer this one :) because I remember proposing something similar back in 2010 at the KDE finance sprint but he insisted that the current behavior is better (I I remeber correctly because it's kind of hidden - the log will only be created if '/home/thb/' exists).
Comment 7 Jack 2013-10-01 13:26:59 UTC
That sounds like the ofx transaction log - it only gets created if the file ofxlog.txt exists in your home directory.  (In that case, the file must exist, instead of the directory.)  However, if it does not exist, nothing should happen - no error messages.  Also, the name should be something more generic, like kmmlog, and not specific to one person.

Separately, does this "feature" need to me mentioned in the manual?
Comment 8 Ralf Habacker 2013-10-01 16:44:17 UTC
> That sounds like the ofx transaction log
no , ofxlog.txt is mentioned at the following places 

kmymoney/plugins/ofximport/ofxpartner.cpp:386:  if (homeDir.exists("ofxlog.txt")) {
kmymoney/plugins/ofximport/ofxpartner.cpp:387:    d->m_fpTrace.setFileName(QString("%1/ofxlog.txt").arg(QDir::homePath()));
kmymoney/plugins/ofximport/dialogs/kofxdirectconnectdlg.cpp:94:  if (homeDir.exists("ofxlog.txt")) {
kmymoney/plugins/ofximport/dialogs/kofxdirectconnectdlg.cpp:95:    d->m_fpTrace.setFileName(QString("%1/ofxlog.txt").arg(QDir::homePath()));

while the file mentioned in this bug is used at

kmymoney/kmymoney.cpp:2308:  MyMoneyStatement::writeXMLFile(s, QString("/home/thb/kmm-statement-%1.txt").arg(d->m_statementXMLindex++));

and logs the content of KMymoneyStatement's.
Comment 9 allan 2013-10-01 19:06:00 UTC
On Tue, 01 Oct 2013 16:44:17 +0000
Ralf Habacker <ralf.habacker@freenet.de> wrote:

> https://bugs.kde.org/show_bug.cgi?id=325472
> 
> --- Comment #8 from Ralf Habacker <ralf.habacker@freenet.de> ---
> > That sounds like the ofx transaction log
> no , ofxlog.txt is mentioned at the following places 
> 
> kmymoney/plugins/ofximport/ofxpartner.cpp:386:  if
> (homeDir.exists("ofxlog.txt")) {
> kmymoney/plugins/ofximport/ofxpartner.cpp:387:   
> d->m_fpTrace.setFileName(QString("%1/ofxlog.txt").arg(QDir::homePath()));
> kmymoney/plugins/ofximport/dialogs/kofxdirectconnectdlg.cpp:94:  if
> (homeDir.exists("ofxlog.txt")) {
> kmymoney/plugins/ofximport/dialogs/kofxdirectconnectdlg.cpp:95:   
> d->m_fpTrace.setFileName(QString("%1/ofxlog.txt").arg(QDir::homePath()));
> 
> while the file mentioned in this bug is used at
> 
> kmymoney/kmymoney.cpp:2308:  MyMoneyStatement::writeXMLFile(s,
> QString("/home/thb/kmm-statement-%1.txt").arg(d->m_statementXMLindex++));
> 
> and logs the content of KMymoneyStatement's.
> 

And then there's also "
bool MyMoneyStatementReader::import(const MyMoneyStatement& s, QStringList& messages)
{
  //
  // For testing, save the statement to an XML file
  // (uncomment this line)
  //
  //MyMoneyStatement::writeXMLFile(s, "Imported.Xml");
"

Allan
Comment 10 Jack 2013-10-01 19:33:59 UTC
To Comment #8:

I was not trying to say the two were the same, or used the same code, but had the same issue that they write to a log only if the log file (for ofx)  or directory (for the subject of this bug) exists.  The ofx log process is silent (correctly, I think) if the file does not exist.  If the import process complains that the directory is not present, instead of silently ignoring it - I think it would make sense to change that.  Wasn't that at least part of the reason for filing this bug?
Comment 11 Thomas Baumgart 2013-10-02 13:24:20 UTC
Please keep in mind, that these files contain sensitive data (e.g. passwords in clear-text etc.). In case trace data is written I suggest to present the user a window that shows that fact while providing the full filename so that he/she is aware of what is going on. These files could be written to ~/.kde/share/apps/kmymoney/logs or similar. I don't mind if /home/thb disappears ;)
Comment 12 Cristian Oneț 2014-07-31 08:36:44 UTC
Based on the previous comment by Thomas, we should remove this "feature" so I'm confirming this.
Comment 13 Jack 2014-07-31 13:28:10 UTC
remove it, or change it to use a more generic location and explicitly confirm with the user before writing to that log?
Comment 14 Ralf Habacker 2017-05-24 09:11:57 UTC
Created attachment 105694 [details]
screenshot with proposal

Opening a dialog each time an import is performed does not look very effective. 

Instead my proposal is to add an additional "developer" tab to the  main settings dialog setting a log path and check boxes to enable the different log files. This has also the advantage to assist user support in the way that there is an official way to create log files.

From this bug I see two log file types
1. statement import
2. ofx transactions

Any objections ?
Comment 15 Ralf Habacker 2017-05-24 11:50:30 UTC
see https://git.reviewboard.kde.org/r/130137/
Comment 16 Ralf Habacker 2017-05-29 10:11:23 UTC
Git commit b447041778f255eaf33b689fa8ac3d5c5e4f0f25 by Ralf Habacker.
Committed on 29/05/2017 at 09:06.
Pushed by habacker into branch '4.8'.

Add import statements and ofx transactions log option to "support" tab of general settings page.
REVIEW:130137
FIXED-IN:4.8.1

M  +28   -0    kmymoney/dialogs/settings/ksettingsgeneral.cpp
M  +4    -0    kmymoney/dialogs/settings/ksettingsgeneral.h
M  +103  -8    kmymoney/dialogs/settings/ksettingsgeneraldecl.ui
M  +4    -1    kmymoney/kmymoney.cpp
M  +9    -0    kmymoney/kmymoney.kcfg
M  +4    -3    kmymoney/plugins/ofximport/dialogs/kofxdirectconnectdlg.cpp
M  +4    -3    kmymoney/plugins/ofximport/ofxpartner.cpp

https://commits.kde.org/kmymoney/b447041778f255eaf33b689fa8ac3d5c5e4f0f25
Comment 17 Ralf Habacker 2017-06-27 18:27:40 UTC
Git commit b5873066cced4a78a468df91fb45b6736791aaac by Ralf Habacker.
Committed on 27/06/2017 at 18:26.
Pushed by habacker into branch '4.8'.

Add layout to support tab of setting general page to avoid clipped labels.

M  +89   -81   kmymoney/dialogs/settings/ksettingsgeneraldecl.ui

https://commits.kde.org/kmymoney/b5873066cced4a78a468df91fb45b6736791aaac
Comment 18 Ralf Habacker 2017-07-05 14:53:53 UTC
Git commit 071693e961e7666b4f2f94d8f6f3724b18d29ff1 by Ralf Habacker.
Committed on 05/07/2017 at 14:16.
Pushed by habacker into branch '4.8'.

Use introduced log file path also on removing log files.

M  +2    -3    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/071693e961e7666b4f2f94d8f6f3724b18d29ff1