[SERVER-15517] Spaces in command line arguments to golang tools break parsing on windows Created: 02/Oct/14  Updated: 11/Jul/16  Resolved: 10/Oct/14

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: None
Fix Version/s: 2.7.8

Type: Bug Priority: Major - P3
Reporter: sam.helman@10gen.com Assignee: sam.helman@10gen.com
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

See

http://buildlogs.mongodb.org/MCI_windows-64-2k8/builds/111407/test/tool_0/dumprestore7.js
http://buildlogs.mongodb.org/MCI_windows-64-2k8/builds/111407/test/tool_0/exportimport4.js
http://buildlogs.mongodb.org/MCI_windows-64-2k8/builds/111407/test/tool_0/exportimport5.js

The spaces in the value passed to the --query argument to the tools are breaking command-line parsing.

This is probably because of an escaping issue on windows where

"{""ts"":{""$gt"":{""$timestamp"" : {""t"":1412692831,""i"":21 }}}}"

becomes

"{\"ts:{$gt:{$timestamp", ":", "{t:1412692831,i:21", "}}}}

when it is read in by golang's flag parsing library.



 Comments   
Comment by Githook User [ 10/Oct/14 ]

Author:

{u'username': u'shelman', u'name': u'Sam Helman', u'email': u'sam.helman@10gen.com'}

Message: SERVER-15517 use slashes rather than double quotes for escaping in shell launcher

Closes #823

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/b585cefc1450e773fb8e3134685a63793ccae4be

Comment by sam.helman@10gen.com [ 09/Oct/14 ]

Looks like the issue is that the shell's subprocess launcher is escaping double quotes in the command line args as "" rather than \". This breaks golang's parsing of command line arguments on windows.

Comment by Githook User [ 07/Oct/14 ]

Author:

{u'username': u'shelman', u'name': u'Sam Helman', u'email': u'sam.helman@10gen.com'}

Message: SERVER-15517 Remove spaces from query in dumprestore7.js, exportimport4.js and exportimport5.js

Closes #806

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/eca7242b055a618ae44835d59a4f75b2d3ae6cba

Generated at Thu Feb 08 03:38:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.