[SERVER-41994] Shell does not add length to BSON binary subtype 2 Created: 27/Jun/19 Updated: 08/Jan/24 Resolved: 19/Jun/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kevin Albertson | Assignee: | [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive) |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | move-stm, sdp-backlog-purge | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Server Development Platform
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Steps To Reproduce: | In the shell insert a BinData with subtype 2:
And in the driver you try to read that, you get a parsing exception:
|
||||||||||||||||||||||||
| Sprint: | Dev Tools 2019-09-09, Dev Tools 2019-09-09, Dev Tools 2019-09-23, Dev Tools 2020-01-13, Dev Tools 2020-01-27, Dev Tools 2020-02-24 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Linked BF Score: | 50 | ||||||||||||||||||||||||
| Description |
|
Per SPEC-1338, the shell does not serialize BSON binary subtype 2 the same way drivers do, which drivers do not recognize as valid. bsonspec.org states:
But the shell does not appear to add the four byte integer length. |
| Comments |
| Comment by Alex Neben [ 19/Jun/23 ] | ||||||||||||||||||||||||||||||||||||||
|
This has been identified as work that the SDP team won't do in the near term. Please reopen with a comment if you feel this work should be reprioritized and explain why. | ||||||||||||||||||||||||||||||||||||||
| Comment by Steven Vannelli [ 10/May/22 ] | ||||||||||||||||||||||||||||||||||||||
|
Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions. | ||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 15/Oct/19 ] | ||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Gabriel Russell', 'username': 'gabrielrussell', 'email': 'gabriel.russell@mongodb.com'}Message: Revert " This reverts commit 3f6ba750fc8374968c3c06e31c67ac2839e9a736. | ||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 10/Sep/19 ] | ||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Gabriel Russell', 'username': 'gabrielrussell', 'email': 'gabriel.russell@mongodb.com'}Message: | ||||||||||||||||||||||||||||||||||||||
| Comment by Bernie Hackett [ 09/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||
|
The shell would have to encode subtype 2 according to the spec and support decoding data according to the spec, but also support decoding this broken format. Note that no driver ever written can decode what the shell currently generates. | ||||||||||||||||||||||||||||||||||||||
| Comment by Mark Benvenuto [ 09/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||
|
The function I highlighted in my first example is not called. While we can fix this, the shell has been doing the broken behavior for many years at this point. It would be a breaking change for the shell to fix this since the shell will no longer be able to decode data with bindata type 2 that it inserted in previous versions. CCing gabriel.russell and mira.carey@mongodb.com for their opinion. Old javascript engines had the same broken behavior: https://github.com/mongodb/mongo/commit/eb7ba8adc1ea407ebd88a8b829a6adbaf109e681 https://github.com/mongodb/mongo/commit/3184194f9e0eb63fc3f6d73579681c4007022e9b Example Fix:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Shane Harvey [ 02/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||
|
Indeed it looks like the shell does not add the length portion of subtype 2. In the shell:
In python:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Mark Benvenuto [ 02/Jul/19 ] | ||||||||||||||||||||||||||||||||||||||
|
SubType 2 was deprecated here - I think we are appending the extra length in the (byte*). See https://github.com/mongodb/mongo/commit/23882959f5f7a66b39524af8710277ee0dfc29bb |