[SERVER-42607] add quoting to resmoke's invocation for local usage line Created: 02/Aug/19  Updated: 29/Oct/23  Resolved: 22/Apr/20

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 4.7.0

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Marianna Petrova (Inactive)
Resolution: Fixed Votes: 0
Labels: tig-qwin-eligible, tig-resmoke
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
causes SERVER-47860 Resmoke should not join and then spli... Closed
Related
related to SERVER-55147 resmoke should shlex.quote() commands... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: STM 2020-04-20, STM 2020-05-04
Participants:
Story Points: 2

 Description   

Currently, there are situations where resmoke's local invocation line cannot be used verbatim; one such example is:

https://evergreen.mongodb.com/task_log_raw/mongodb_mongo_master_enterprise_rhel_62_64_bit_alt_create_indexes_replica_sets_multi_stmt_txn_stepdown_jscore_passthrough_0_enterprise_rhel_62_64_bit_alt_create_indexes_cc1a75e4a6d8de8478e7253da7bd6376052d57a6_19_07_15_15_35_13/0?type=T#L392

 

Could resmoke quote the line so that it would work with standard Bash?  I'm not sure how hard it would be to figure out where quotes would need to go.  (One simple way to do this would be to simply add double quotes around every parameter.)



 Comments   
Comment by Githook User [ 22/Apr/20 ]

Author:

{'name': 'piatrovm', 'email': 'maryana.piatrova@gmail.com', 'username': 'piatrovm'}

Message: SERVER-42607 add quoting to resmoke's invocation for local usage line
Branch: master
https://github.com/mongodb/mongo/commit/25c7afccb085ce11dde1dcdc813ec14bfb9fa297

Comment by Githook User [ 22/Apr/20 ]

Author:

{'name': 'piatrovm', 'email': 'maryana.piatrova@gmail.com', 'username': 'piatrovm'}

Message: SERVER-42607 add quoting to resmoke's invocation for local usage line
Branch: master
https://github.com/mongodb/mongo/commit/c20aafdc8bdd2f5903f36cd9b712d243c12c043d

Comment by Marianna Petrova (Inactive) [ 21/Apr/20 ]

CR: https://mongodbcr.appspot.com/561490057/

Comment by Max Hirschhorn [ 10/Apr/20 ]

You'll want the second line to say --reportFile="my report.json", similar to the first line.

I'd like to say that it isn't important for the command line to match verbatim. What is important is that it can be run via bash.

$ python3
>>> import shlex
>>> print(" ".join([shlex.quote(x) for x in shlex.split('''python buildscripts/resmoke.py --suite=core --reportFile="my report.json"''')]))
python buildscripts/resmoke.py --suite=core '--reportFile=my report.json'

We could also consider making a similar change to Process.as_command() so the other command line invocations resmoke.py outputs can be copied and run via bash as well.

Comment by Robert Guo (Inactive) [ 09/Apr/20 ]

marianna.petrova Try this:

➜  mongo git:(master) ✗ python buildscripts/resmoke.py --suite=core --reportFile="my report.json"
[resmoke] 2020-04-09T11:56:09.368-0400 verbatim resmoke.py invocation: buildscripts/resmoke.py --suite=core --reportFile=my report.json

You'll want the second line to say --reportFile="my report.json", similar to the first line.

Comment by Marianna Petrova (Inactive) [ 09/Apr/20 ]

Looks like logs expired here, could anyone help with examples?

Comment by Max Hirschhorn [ 02/Aug/19 ]

Could resmoke quote the line so that it would work with standard Bash? I'm not sure how hard it would be to figure out where quotes would need to go. (One simple way to do this would be to simply add double quotes around every parameter.)

https://docs.python.org/3/library/shlex.html#shlex.quote is the way to do this in Python.

Generated at Thu Feb 08 05:00:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.