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

touch: fixed up premature force exit on nil elem #443

Merged
merged 1 commit into from
Oct 26, 2015

Conversation

odeke-em
Copy link
Owner

This PR addresses issue #442 by fixing up a bug in which while multiplexing over
the channels and looking for channels that had been drained,
legacy select code still had a forced nil emission at a deferred
statement. However, once a channel has been drained, any attempt to
read from it will also return nil. Coupling this knowledge with
a recursive traversal of children, nil was being added prematurely.
It also refactors the code used by the plain Touch and TouchByMatch
.

Before

$ drive touch --recursive
/ENGINEERING/Fall2015/BLAW_301: 2015-10-26 02:06:21 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/ch01.ppt: 2015-10-26 02:06:22 +0000 UTC
$ drive list
/ENGINEERING/Fall2015/BLAW_301/ch01.ppt 
/ENGINEERING/Fall2015/BLAW_301/ch02.ppt 
/ENGINEERING/Fall2015/BLAW_301/ch03.ppt 
/ENGINEERING/Fall2015/BLAW_301/ch04.ppt 
/ENGINEERING/Fall2015/BLAW_301/commencing-a-claim-in-provincial-court-civil-and-getting-and-enforcing-your-judgment-in-alberta.pdf 
/ENGINEERING/Fall2015/BLAW_301/BLaw-301--Mon14Sept2015P1.pdf 
/ENGINEERING/Fall2015/BLAW_301/Chapter 2 Asha and Shaughnessy (to post).ppt 
/ENGINEERING/Fall2015/BLAW_301/manny-pacquaio-lawsuit.pdf 
$ drive touch --recursive
/ENGINEERING/Fall2015/BLAW_301: 2015-10-26 02:07:07 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/ch01.ppt: 2015-10-26 02:07:08 +0000 UTC
$ drive touch --recursive
/ENGINEERING/Fall2015/BLAW_301: 2015-10-26 02:07:10 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/ch01.ppt: 2015-10-26 02:07:12 +0000 UTC

After

$ drive touch --recursive
/ENGINEERING/Fall2015/BLAW_301: 2015-10-26 02:13:26 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/ch01.ppt: 2015-10-26 02:13:27 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/ch02.ppt: 2015-10-26 02:13:29 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/ch03.ppt: 2015-10-26 02:13:31 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/ch04.ppt: 2015-10-26 02:13:33 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/commencing-a-claim-in-provincial-court-civil-and-getting-and-enforcing-your-judgment-in-alberta.pdf: 2015-10-26 02:13:35 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/BLaw-301--Mon14Sept2015P1.pdf: 2015-10-26 02:13:37 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/Chapter 2 Asha and Shaughnessy (to post).ppt: 2015-10-26 02:13:39 +0000 UTC
/ENGINEERING/Fall2015/BLAW_301/manny-pacquaio-lawsuit.pdf: 2015-10-26 02:13:41 +0000 UTC
$ drive list
/ENGINEERING/Fall2015/BLAW_301/manny-pacquaio-lawsuit.pdf 
/ENGINEERING/Fall2015/BLAW_301/Chapter 2 Asha and Shaughnessy (to post).ppt 
/ENGINEERING/Fall2015/BLAW_301/BLaw-301--Mon14Sept2015P1.pdf 
/ENGINEERING/Fall2015/BLAW_301/commencing-a-claim-in-provincial-court-civil-and-getting-and-enforcing-your-judgment-in-alberta.pdf 
/ENGINEERING/Fall2015/BLAW_301/ch04.ppt 
/ENGINEERING/Fall2015/BLAW_301/ch03.ppt 
/ENGINEERING/Fall2015/BLAW_301/ch02.ppt 
/ENGINEERING/Fall2015/BLAW_301/ch01.ppt 

This commit fixes up a bug in which while multiplexing over
the channels and looking for channels that had been drained,
legacy select code still had a forced `nil` emission at a deferred
statement. However, once a channel has been drained, any attempt to
read from it will also return `nil`. Coupling this knowledge with
a recursive traversal of children, `nil` was being added prematurely.
@odeke-em odeke-em merged commit cbc675a into master Oct 26, 2015
@odeke-em odeke-em deleted the touch-fix-premature-exit branch October 26, 2015 02:20
@odeke-em odeke-em restored the touch-fix-premature-exit branch October 26, 2015 02:28
@odeke-em odeke-em deleted the touch-fix-premature-exit branch November 6, 2015 20:42
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.

1 participant