Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug 65667 #478

Closed
wants to merge 2 commits into from
Closed

fix bug 65667 #478

wants to merge 2 commits into from

Conversation

pilif
Copy link
Contributor

@pilif pilif commented Oct 2, 2013

This PR is a fix for bug 65667

the idea behind ftp_nb_get is for it to be followed by multiple calls
to ftp_nb_continue in order to download a file piece-by-piece.

As such, it's unwise to close the stream used to write the downloaded
data to when the file hasn't been completely downloaded within the first
call to ftp_nb_get.

This regression was added in a93a462
and this patch restores the behavior that was seen pre-patch.

@pilif
Copy link
Contributor Author

pilif commented Oct 2, 2013

(ext/session/tests/session_set_save_handler_class_005.phpt which failed the build also fails without my patch)

@m6w6
Copy link
Contributor

m6w6 commented Oct 4, 2013

Yeah, the test suite is not 100% stable on travis yet.

@m6w6
Copy link
Contributor

m6w6 commented Oct 4, 2013

@m6w6
Copy link
Contributor

m6w6 commented Oct 4, 2013

So, the test suite doesn't fail now and I suspect it won't fail after merging your PR :) i.e. proof is missing.
Mind adding a test? :)

pilif added 2 commits October 4, 2013 13:20
fails to download the whole file because ftp_nb_get's implementation
closes the stream too early
the idea behind ftp_nb_get is for it to be followed by multiple calls
to ftp_nb_continue in order to download a file piece-by-piece.

As such, it's unwise to close the stream used to write the downloaded
data to when the file hasn't been completely downloaded within the first
call to ftp_nb_get.

This regression was added in a93a462
and this patch restores the behavior that was seen pre-patch.
@pilif
Copy link
Contributor Author

pilif commented Oct 4, 2013

ok. I've added a testcase now.

I've rebased the commits such that the failing test case comes before the commit which fixes the bug.

Aside of that, let me switch into rant-mode for a second:

Here's what I've done for this bug:

  • After getting bitten by the issue (caused by a undocumented feature-addition to a point release) I searched the bug database in order to not report a duplicate
  • After confirming seeing the bug on my part, I went ahead and investigated the cause
  • I fixed the issue (respecting whitespace conventions - contrary to the commit that introduced the bug, btw).
  • I went through the history of the file in order to find the commit where the bug was introduced and pointed to that in the PHP bug
  • I commented on the offending commit, noting the bug as it was introduced.

After doing all that instead of a thank you and maybe even a merge of the PR, the thing I get is a complaint about a missing test. Yeah. I understand you'd like to see a testcase, but just consider what all went wrong to cause this bug:

  • The test-case attached to the commit that added the bug cheats around triggering the bug
  • The commit that caused the bug had inconsitent whitespace
  • The bug was introduced by changing lines that were never supposed to have been commited: the offending lines are completely unrelated to the commit and the commit message given.
  • The commit resulted in a feature-change in a point release which
  • was not documented in the changelog

As such, I would say that this commit should not have passed review, but yet it did.

On the other hand, my little fix which unbreaks the, now completely broken ftp_nb_get() gets complained about because of a missing test, despite the fact that there never was a test for ftp_nb_continue() and that it only re-adds code that was there before and likely removed by accident.

Come on.

Anyways. Rant over. As somebody using ftp_nb_get(), I'd naturally like to see this fixed :-)

@m6w6
Copy link
Contributor

m6w6 commented Oct 4, 2013

Congrats, you've done a great job. Though, you could have reviewed at least 3 other bugs while writing this rant. The "Thank you" usually comes from a template when the bug is closed, but maybe we can get github to post a "Thank you" when requesting a pull?

@php-pulls
Copy link

Comment on behalf of nikic at php.net:

Merged in 96cc419.

@php-pulls php-pulls closed this Oct 4, 2013
@nikic
Copy link
Member

nikic commented Oct 4, 2013

@pilif I'm sorry that the incorrect change in a93a462 got through code review. We prefer having a test for every change for exactly that reason: The test will prevent the regression from ever being introduced again. Even if the reviewer misses the change, the test will not ;)

@pilif
Copy link
Contributor Author

pilif commented Oct 4, 2013

@nikic no worries. Thank you so much for applying this and sorry for my rant - I guess I had a bad day today :(

@kaplanlior
Copy link
Contributor

@pilif As long as you keep providing patches, you're welcome to rant (:

@pilif
Copy link
Contributor Author

pilif commented Oct 4, 2013

If only my C was better - then you'd get plenty of them. Until then I'll have to constrain myself to the low-hanging fruits :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants