Closed Bug 1328393 Opened 7 years ago Closed 7 years ago

mach mixin run_process does not necessarily log commands that will actually parse or execute correctly

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox53 affected)

RESOLVED WONTFIX
Tracking Status
firefox53 --- affected

People

(Reporter: wgianopoulos, Unassigned)

Details

Attachments

(1 file, 2 obsolete files)

I found this while developing the patch for bug 1328153.

The run_process python function pr0vided as part of the mach mixins does not properly quote and/or escape the command arguments such that the logged command is non-parsable either by humans reading the log or the OS if you try to cut-and-paste the logged command into an interactive shell.

So this call:

self.run_process(['/usr/bin/notify-send', '--app-name=Mozilla Build System', 'Mozilla Build System', 'Build completed'])

results in logging:

/usr/bin/notify-send --app-name=Mozilla Build System Mozilla Build System Build complete

which is a totally ill-formatted command.

I would suggest modifying run+process such that all of the command arguments are scanned replacing all occurrences of the character "'" with "\'" and then surrounding the resultant string with the character "'" so that this log message would end up being:

/usr/bin/notify-send '--app-name=Mozilla Build System' 'Mozilla Build System' 'Build complete'
Hmm,but I bet doing that universally would slow the build down.  Perhaps add an option to espace-args that could be set to true in cases where it might be necessary? Or just change the messages about build completion status so that the msg string is either 'Build-completed' or 'Build-failed' and change the string 'Mozilla Build System' to be 'MozillaBuildSystem' in the run-process call so that all of this is unnecessary.
Hmm let me see what happens if i just escape the spaces in my other patch.
Attached patch Workaround (obsolete) — Splinter Review
This avoids the issue where possible by not passing spaces in string constants to run_process where possible.  This patch is dependent on the patch for bug 1328153.
Attached patch Workaround (obsolete) — Splinter Review
Attachment #8823443 - Attachment is obsolete: true
Attached patch WorkaroundSplinter Review
Attachment #8823836 - Attachment is obsolete: true
I am closing this.  I will open a new bug if I can come up with a better definition of the problem and.or a valid fix.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: