Closed Bug 1700632 Opened 4 years ago Closed 4 years ago

Generating mach completion had a quote error

Categories

(Firefox Build System :: Mach Core, defect)

defect

Tracking

(firefox89 fixed)

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: tjr, Assigned: ahal)

Details

Attachments

(1 file)

When I generated mach completion for zsh (oh-my-zsh if it matters), it had the following line:

opts+=("--locales:List of locales to package, including \"en-US\" "--verbose:Log informative status messages.")

It should have been

opts+=("--locales:List of locales to package, including \"en-US\"" "--verbose:Log informative status messages.")

(two "'s after en-US)

This caused shell errors.

Interesting, when I generate it I get:

opts+=("--locales:List of locales to package, including \\\"en-US\\\" "--verbose:Log informative status messages.")

(edit: I see you get this too, it's just markdown removing some of the slashes)

and completion works just fine. If I add a second quote then I get errors. I don't think it would matter, but I'm not using oh-my-zsh. Also I'm on zsh 5.8. I'm definitely not a shell guru, writing these completion scripts were a new experience for me. So I don't know what could be going on here, though here's where the options get generated:
https://searchfox.org/mozilla-central/rev/bb37e6fe8bbe383a57a4ad21a201e26416613ca1/python/mach/mach/commands/commandinfo.py#332

If there's a bug, it's likely in the _zsh_describe function:
https://searchfox.org/mozilla-central/rev/bb37e6fe8bbe383a57a4ad21a201e26416613ca1/python/mach/mach/commands/commandinfo.py#206

Which I borrowed from elsewhere.

Although it looks like I can't tab complete the options for package-multi-locales, nor the commands preceding it like package. So maybe there's another missing quote and it just happens to parse under my version of zsh? Bizarre.

Ah, I found the bug. This strip call removes all quotes at the end or beginning of the description. So if the description begins or ends with an escaped quote, it'll be removed as well. I'm not sure why this didn't cause failures for me, maybe I have a more permissive mode enabled or something.

Assignee: nobody → ahal
Status: NEW → ASSIGNED

We want to make sure to only strip a single leading or trailing quote, and
not all of them.

Pushed by ahalberstadt@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bf034df9d52b [mach] Fix bug in zsh completion script generation, r=tjr
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: