-
Notifications
You must be signed in to change notification settings - Fork 80
Setting recovery message with nvram exec will fail if it contains an apostrophe #21
Comments
I'd probably just manually escape quotes in |
Elsewhere @wfarr mentioned a shell quoting function we could use. Assuming I'm remembering that correctly, that's the right solution. |
Nice. I don't think it warrants additional code IMO but if there is something we can tap into let's do it.
|
Previously, if you declared an `osx::recovery_message` resource that contained an apostrophe/single-quote ('), the exec used to set the recovery message would fail (because the exec references the message within single quotes). This commit will call the fail() function if a recovery_message contains an apostrophe and alert the user to the failure. The spec was also updated and worked for me in 1.8.7 and 1.9.3
There is the shellquote function, but I don't think it solves this problem. I filed #23 which should cover us for now. |
I think if we're gonna re-do this, I'd like to see us approach solving the problem permanently. Right now, we're relying on RubyCocoa and all sorts of stuff to set the recovery message. Stuff that's also going away in 10.9. It's time to write some C. Though, yes, shell quote is useful here. |
(#21) Throw error if recovery_message contains '
Note this line in the exec --> https://github.com/boxen/puppet-osx/blob/master/manifests/recovery_message.pp#L46
Because the value is wrapped in single-quotes, if you declare an
osx::recovery_message
resource that contains a single-quote/apostrophe in its title, the exec will fail. Removing the apostrophe fixes the exec failure.I'm not sure of the solution here - maybe wrapping in double-quotes instead of single quotes (which displaces the issue to double-quotes), or possibly a function that searches for apostrophes and escapes them?
The text was updated successfully, but these errors were encountered: