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

 
 

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

Submitted by:  None
Submitted on:  Wed 29 Apr 2015 04:49:19 AM UTC  
 
Category: rec-modeSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

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: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>
Project 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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jemarch (Posted a comment)
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 29 Apr 2015 05:08:09 AM UTCjemarchStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1