emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jacob Matthews <matthewsj@google.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-mobile.org: Properly escape checksum binary path
Date: Tue, 07 Apr 2015 18:33:18 +0000	[thread overview]
Message-ID: <CAHM7e-Gr=H69yqz=dmcxqp1FYu_md0Xgsub1ZppRZ5XPBMD5bg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 318 bytes --]

Hi ---

After lots of debugging last night on why MobileOrg wasn't seeing org-mode
files I pushed from my Windows computer, I found a bug in org-mobile.el
that appears to affect all platforms -- if the full path to the checksum
binary contains a space then checksumming will silently fail.

Attached is a fix.

-jacob

[-- Attachment #1.2: Type: text/html, Size: 420 bytes --]

[-- Attachment #2: 0001-org-mobile.org-Properly-escape-checksum-binary-path.patch --]
[-- Type: text/x-patch, Size: 1276 bytes --]

From 3a92b2a5411aabb096ad592efe7d2dc085653ee6 Mon Sep 17 00:00:00 2001
From: Jacob Matthews <matthewsj@google.com>
Date: Tue, 7 Apr 2015 12:52:25 -0500
Subject: [PATCH] org-mobile.org: Properly escape checksum binary path

* lisp/org-mobile.org (org-mobile-copy-agenda-files): Escape org-mobile-checksum-binary.

Fix a bug where if the checksum binary is in a non shell-safe path, then
the shell invocation silently fails. This can happen on any platform but
is probably worst on Windows where it's common to put programs in
"C:/Program Files".
---
 lisp/org-mobile.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index c2828a9..2c13802 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -499,7 +499,8 @@ agenda view showing the flagged items."
 	    (org-mobile-encrypt-and-move file target-path)
 	  (copy-file file target-path 'ok-if-exists))
 	(setq check (shell-command-to-string
-		     (concat org-mobile-checksum-binary " "
+		     (concat (shell-quote-argument org-mobile-checksum-binary)
+			     " "
 			     (shell-quote-argument (expand-file-name file)))))
 	(when (string-match "[a-fA-F0-9]\\{30,40\\}" check)
 	  (push (cons link-name (match-string 0 check))
-- 
2.2.0.rc0.207.ga3a616c


             reply	other threads:[~2015-04-07 18:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 18:33 Jacob Matthews [this message]
2015-04-10  8:28 ` [PATCH] org-mobile.org: Properly escape checksum binary path Nicolas Goaziou

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CAHM7e-Gr=H69yqz=dmcxqp1FYu_md0Xgsub1ZppRZ5XPBMD5bg@mail.gmail.com' \
    --to=matthewsj@google.com \
    --cc=emacs-orgmode@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).