[SERVER-30699] Shell commands fail for cases with quotes for buildscripts/remote_operations.py Created: 16/Aug/17  Updated: 30/Oct/23  Resolved: 23/Aug/17

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

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Jonathan Abrahams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: TIG 2017-09-11
Participants:

 Description   

There are still some cases where the "shell" remote operation fails to pass the parameters properly to a remote script. The best way to handle this is as follows:

  1. Run all shell operations through bash -c "<commands>"
  2. If <commands> has any quotes, singe ' or double ", then escape them and surround the commands with a $'<commands>'

Example:
The command /tmp/a.sh -a abc -b "hi there" -c "also here" should be invoked as /bin/bash -c "$'/tmp/a.sh -a abc -b \"hi there\" -c \"also here\"'"



 Comments   
Comment by Ramon Fernandez Marina [ 24/Aug/17 ]

Author:

{'username': u'hptabster', 'name': u'Jonathan Abrahams', 'email': u'jonathan@mongodb.com'}

Message:SERVER-30699 Shell commands fail for cases with quotes for buildscripts/remote_operations
Branch:master
https://github.com/mongodb/mongo/commit/7081a76ac2965bd765b6c372581c81f63c9e6b3c

Generated at Thu Feb 08 04:24:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.