Re: [X2Go-Dev] Help with x2goclient's sshd_config
On 23.05.2016 02:14 PM, Mike DePaulo wrote: > [...] > I've tried 2 different approaches, you can see them below. Ignore the > x2goDebug line. > > diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp > index 925085b..a1d92a8 100644 > --- a/src/onmainwindow.cpp > +++ b/src/onmainwindow.cpp > @@ -10292,6 +10292,8 @@ void ONMainWindow::generateEtcFiles() > /* This may need some sanitization, i.e., appDir could > potentially include whitespace. */ > <#endif > +x2goDebug<<"LogLevel DEBUG1"; Force a flush of the current line by appending a newline, like so: out << "LogLevel DEBUG1\n"; Otherwise, the stream might wait for more input to come for the current line (but as it never comes, the line isn't written at all.) > +out<<"LogLevel DEBUG1"; > file.close(); > x2goDebug< } > > > diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp > index 925085b..928da70 100644 > --- a/src/onmainwindow.cpp > +++ b/src/onmainwindow.cpp > @@ -10293,6 +10293,13 @@ void ONMainWindow::generateEtcFiles() > < #endif > file.close(); This attempt is definitely wrong. The file is being closed here. Afterwards, you cannot write to it anymore. (Or well, you do, but it lands who knows where exactly. Most likely not in the selected file/the file previously associated with the FD.) > +if (debugging) > +{ > +QTextStream out2 ( ); > +x2goDebug<<"LogLevel DEBUG1"; > +out2<<"LogLevel DEBUG1"; > +file.close(); > +} > x2goDebug< } Mihai signature.asc Description: OpenPGP digital signature ___ x2go-dev mailing list x2go-dev@lists.x2go.org http://lists.x2go.org/listinfo/x2go-dev
Re: [X2Go-Dev] Help with x2goclient's sshd_config
Hi Mike, I didn't dig deeply into your problem (as it requires heavyweight Qt building environment) but here are my $0.02: 1) your second approach tries to create QTextStream from the closed QFile, which seems to be a definitely a bad idea; 2) in your first approach appended line lacks terminating '\n' and it seems to be a bad idea because in UNIX world '\n' is a line-terminating character, not a separator. Btw, it's also sometimes a buffer-flushing character, so I won't be surprised if your line stays unflushed inside QTextStream (and it's obvious that file.close() doesn't know about QTextStream objects that refer to its QFile and cannot forcibly grab data from them, so one have to output newlines or use some flush method). I've tried to google("QTextStream buffering") and the second returned page looks like the proof of my idea: http://stackoverflow.com/questions/10370630/qtextstream-is-not-outputting-anything-what-could-i-be-doing-wrong ___ x2go-dev mailing list x2go-dev@lists.x2go.org http://lists.x2go.org/listinfo/x2go-dev
Re: [X2Go-Dev] Help with x2goclient's sshd_config
Anyone? On May 23, 2016 8:14 AM, "Mike DePaulo"wrote: > Hi guys, > > Background: > I am trying to fix bug #1002 completely; there appear to be multiple > underlying bugs. One of them is that unless I start x2goclient from a > cygwin shell, cygwin sshd doesn't actually listen its port. > > Anyway, at the moment I am trying to make x2goclient start sshd with > debug logging when x2goclient is launched with --debug, but I am > unable to do so. Every time I launch x2goclient, sshd_config is > regenerated without the debug line. > > I've tried 2 different approaches, you can see them below. Ignore the > x2goDebug line. > > diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp > index 925085b..a1d92a8 100644 > --- a/src/onmainwindow.cpp > +++ b/src/onmainwindow.cpp > @@ -10292,6 +10292,8 @@ void ONMainWindow::generateEtcFiles() > /* This may need some sanitization, i.e., appDir could > potentially include whitespace. */ > < #endif > +x2goDebug<<"LogLevel DEBUG1"; > +out<<"LogLevel DEBUG1"; > file.close(); > x2goDebug< } > > > diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp > index 925085b..928da70 100644 > --- a/src/onmainwindow.cpp > +++ b/src/onmainwindow.cpp > @@ -10293,6 +10293,13 @@ void ONMainWindow::generateEtcFiles() > < #endif > file.close(); > +if (debugging) > +{ > +QTextStream out2 ( ); > +x2goDebug<<"LogLevel DEBUG1"; > +out2<<"LogLevel DEBUG1"; > +file.close(); > +} > x2goDebug< } > ___ x2go-dev mailing list x2go-dev@lists.x2go.org http://lists.x2go.org/listinfo/x2go-dev