all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ian Martins <ianxm@jhu.edu>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands
Date: Fri, 29 Jan 2021 09:29:10 -0500	[thread overview]
Message-ID: <jwvy2gbstwk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20210129142002.527F320E7B@vcs0.savannah.gnu.org> (Stefan Monnier's message of "Fri, 29 Jan 2021 09:20:01 -0500 (EST)")

>  May be either a command in the path, like \"neko\" or the full
> -path to the executable, like \"/usr/local/bin/neko\".  Double
> -quotes must be escaped.  This is run in a shell."
> +path to the executable, like \"/usr/local/bin/neko\".  This is
> +run in a shell."

I think it's not clear what "This is run in a shell" means here.

Typically it either means that the usual "shell preprocessing" will take
place, so you can use $ spaces and quotes to construct a "chunk" of
a command, or it is just an implementation detail (in which case
there's no particular reason to mention it in such docstrings).

> @@ -126,11 +126,13 @@ replaced in this string.")
>            (or (cdr (assq :haxe params))
>                org-babel-haxe-compiler))
>           (org-babel-neko-command
> -          (or (cdr (assq :neko params))
> -              org-babel-neko-command))
> +          (replace-regexp-in-string "\\([ \"]\\)" "\\\\\\1" ; escape double quotes or spaces
> +                                    (or (cdr (assq :neko params))
> +                                        org-babel-neko-command)))

You might want to use `shell-quote-argument` instead, so it also escapes
backslashes, pipes, semi colons and whatnot and generally tries to
ensure that the strings is passed through "as is", so the user doesn't
need to know that the string is used as part of a shell command.


        Stefan




       reply	other threads:[~2021-01-29 14:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210129142001.29154.12046@vcs0.savannah.gnu.org>
     [not found] ` <20210129142002.527F320E7B@vcs0.savannah.gnu.org>
2021-01-29 14:29   ` Stefan Monnier [this message]
2021-01-30 11:17     ` [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands ian martins
2021-01-30 14:43       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvy2gbstwk.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=ianxm@jhu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.