bugGNU recutils - Bugs: bug #44957, `rec-cmd-compile' fails with file...


bug #44957: `rec-cmd-compile' fails with file paths containing spaces

Submitted by:  Thom <thomq>
Submitted on:  Wed 29 Apr 2015 05:18:35 AM UTC  
Category:  rec-mode Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 29 Apr 2015 05:46:19 AM UTC, comment #3:

Whoops! Sorry for the repeat. My original post disappeared so quickly that I thought it was because I was submitting bug reports anonymously, and that there was a limitation to one report or some such. I mean, I thought I'd overwritten #44955 with my next one numbered #44956 (unrelated bug), because I was unfamiliar with the system.

I've now located the mailing lists and have noticed this has been addressed with #44955. This bug #44957 can be closed, obviously, as its an exact duplicate of #44955.

Thom <thomq>
Wed 29 Apr 2015 05:34:20 AM UTC, comment #2:

Hmm, or maybe this works better for the markup (includes indentation this time, copied from Emacs buffer instead of original submission):

Thom <thomq>
Wed 29 Apr 2015 05:28:36 AM UTC, comment #1:

Trying to markup the code from the original submission, in case it helps for reading it:

Thom <thomq>
Wed 29 Apr 2015 05:18:35 AM UTC, original submission:

In rec-mode for Emacs, using the "c" key-binding to check my files would give a compilation error which mostly listed the --help from recfix. After staring at the first couple of lines of output in the compilation buffer (which seemed to have the command and argument) I finally realized the path to my files had a directory with a space in the name.

The function description for `rec-mode' mentioned the "c" key-binding used `rec-cmd-compile' in the "rec-mode.el" file. It uses `concat' to append the command to the file path. Searching online I found `shell-quote-argument':

I added that in two places within `rec-cmd-compile', but I think I've only tested the THEN option of the `if' but not its ELSE option (that is, not the `with-temp-file' part). What I mean is, I changed the ELSE first (I chose it first by accident) and that didn't have an effect. I then changed the THEN part and that did work. I'm assuming both areas need addressing.

Here's the defun for it with the two changes indicated by a comment with "HERE" on the line before. The change is to use `shell-quote-argument' with the file path as its argument.

(defun rec-cmd-compile ()
"Compile the current file with recfix."
(let ((cur-buf (current-buffer))
(cmd (concat rec-recfix " "))
(tmpfile (make-temp-file "rec-mode-")))
(if buffer-file-name
;; HERE (1/2)
(setq cmd (concat cmd (shell-quote-argument buffer-file-name)))
(with-temp-file tmpfile
(insert-buffer-substring cur-buf))
;; HERE (2/2)
(setq cmd (concat cmd (shell-quote-argument tmpfile))))
(compilation-start cmd)))

Thom <thomq>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by thomq (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.4