Bug 324293

Summary: KTcpSocket ::errorString () == "Unknown error"
Product: [Unmaintained] kdelibs Reporter: Christopher Yeleighton <giecrilj>
Component: kdecoreAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED UNMAINTAINED    
Severity: normal    
Priority: NOR    
Version First Reported In: 4.10.5   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Christopher Yeleighton 2013-08-30 21:16:04 UTC
KTcpSocket ::errorString () == "Unknown error" after KTcpSocket ::waitForBytesWritten sets KTcpSocket ::error.

Reproducible: Always

Steps to Reproduce:
  0. Modify KTcpSocketTest::statesIana in the following way:
oid KTcpSocketTest::statesIana()
{
    //A connection to a real internet host
    KTcpSocket s (this);
    connect(& s, SIGNAL(hostFound()), this, SLOT(states_hostFound()));
    QCOMPARE(s .state(), KTcpSocket::UnconnectedState);
    s .connectToHost("www.iana.org", 80);
    QCOMPARE(s .state(), KTcpSocket::HostLookupState);
    s .write(HTTPREQUEST);
    QCOMPARE(s .state(), KTcpSocket::HostLookupState);
    s .waitForBytesWritten(2500); if (KTcpSocket ::UnknownError == s .error ()) {
    QCOMPARE(s .state(), KTcpSocket::ConnectedState);
    s .waitForReadyRead(2500);
    //I actually assume that the page delivered by www.iana.org will exist for years
    QVERIFY(s .bytesAvailable() > 200);

    s .write(HTTPREQUEST);
    s .waitForReadyRead();
    s .close();
    if (s .state() == KTcpSocket::ClosingState)
        s .waitForDisconnected(); } else { QCOMPARE (s .state (), KTcpSocket ::UnconnectedState); qDebug () << s .errorString (); }
    //What happens is that during waitForReadyRead() the write buffer is written out
    //completely so that the socket can shut down without having to wait for writeout.
    QCOMPARE(s .state(), KTcpSocket::UnconnectedState);

}

  1. /home/abuild/rpmbuild/BUILD/kdelibs-4.10.5/build/kdecore/tests/ktcpsockettest.shell

Actual Results:  
  1. 44: QDEBUG : KTcpSocketTest::statesIana() "Unknown error"

Expected Results:  
  1. 44: QDEBUG : KTcpSocketTest::statesIana() "Host www.iana.org not found"
Comment 1 Andrew Crouthamel 2018-11-10 03:19:46 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 2 Andrew Crouthamel 2018-11-20 04:03:24 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Justin Zobel 2023-01-01 04:19:58 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 4 Christopher Yeleighton 2023-01-02 00:30:14 UTC
This test has fortunately been skipped as ‘unreliable’: <URL: https://invent.kde.org/frameworks/kio/-/blob/master/autotests/ktcpsockettest.cpp#L199 >

To tell you the truth, it is not unreliable, it is simply wrong: <URL: https://stackoverflow.com/a/42050137 >