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

 
 

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

Submitter:  None
Submitted:  Wed 29 Apr 2015 04:49:19 AM UTC
   
 
Category:  rec-mode Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 29 Apr 2015 05:08:09 AM UTC, comment #1: 

Thanks for reporting.  I just pushed a patch to the git repo fixing this problem.

Jose E. Marchesi <jemarch>
Group administrator
Wed 29 Apr 2015 04:49:19 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':
http://www.gnu.org/software/emacs/manual/html_node/elisp/Shell-Arguments.html

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."
  (interactive)
  (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)))

Anonymous

 

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

Attach Files:
   
   
Comment:
   

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 jemarch (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-04-29 jemarch StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code