[SERVER-4006] Shell command completion for function properties has 'prototype' 3 times Created: 04/Oct/11 Updated: 11/Jul/16 Resolved: 28/Nov/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 2.0.0 |
| Fix Version/s: | 2.1.0 |
| Type: | Bug | Priority: | Trivial - P5 |
| Reporter: | Tad Marshall | Assignee: | Tad Marshall |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Any |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
In the Mongo shell, if you type v=function(){}; <Enter> v. <Tab> and then hit <Tab> repeatedly, you cycle through completions of apply(, call(, constructor, hasOwnProperty(, propertyIsEnumerable(, prototype, prototype, prototype, toLocaleString(, toString( and valueOf(. I tried arrays, objects, Dates, ISODates and NumberLongs and didn't see any others with any repetitions. From reading the code, I see that this set of completions is coming from a JavaScript routine shellAutocomplete() in shell/utils.js, and this code sets a JavaScript variable _autocomplete. So, the bug seems to be in shellAutocomplete() or one of its helper routines: > _autocomplete_ |
| Comments |
| Comment by Tad Marshall [ 28/Nov/11 ] |
|
Fixed by commit 94602bb066d104cbf1fe8bb18203147774347bfe . |
| Comment by auto [ 28/Nov/11 ] |
|
Author: {u'login': u'', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: The logic comes up with three ways that "prototype" could be a |
| Comment by Tad Marshall [ 11/Oct/11 ] |
|
I did some more testing, and a version of the code that I built on my machine from 1.8.3 sources showed the same issue with 'prototype' appearing 3 times in the _autocomplete_ variable. I haven't figured out what changed from my earlier report, but it may be the version of SpiderMonkey I'm using. We could potentially see different behavior from V8. It doesn't really matter what the root cause is, because it is worth fixing and it's not hard. readline had code to remove duplicates and linenoise could (should?) have that feature. The JavaScript that generates the list is doing nothing to prevent duplicates and it could (should) remove them. The bug is user-visible and easy to fix so it's worth fixing. |
| Comment by Tad Marshall [ 09/Oct/11 ] |
|
Version 1.8.4-rc1-pre- doesn't have this bug. MongoDB shell version: 1.8.4-rc1-pre- |