(
Jump to the original submission)
Fri 15 Mar 2013 01:50:52 PM UTC, comment #8:
I just downloaded edit.m from:
http://hg.savannah.gnu.org/hgweb/octave/file/003100ee9e0d/scripts/miscellaneous/edit.m
(indicated as stable)
The "undo_string_escapes" seem to have fixed this problem and I am successfully able to specify the path as:
EDITOR('C:\Program Files (x86)\Vim\vim73\gvim.exe');
Thanks for following up.
|
Wed 13 Mar 2013 06:45:33 PM UTC, comment #7:
Does the problem with edit.m and '\' still exist?
I notice that edit.m has been coded to use undo_string_escapes before calling sprintf. This should mean that extra backslashes are inserted and then removed by sprintf so that the result is unchanged but the '%s' token can still be used by sprintf. I used a recent changeset on the development branch for testing (16297:00da706fba48).
|
Thu 04 Oct 2012 07:54:28 PM UTC, comment #6:
It's too bad Matlab compatibility has to make printf inconsistent with it's string quoting. I don't think there's a good way to make the function smarter with this constraint.
Double quote, double backslash doesn't workaround. I think the EDITOR function immediately performs escape processing and then always returns a single-quote result.
My workaround is to specify the directory using forward slash as the separator. I'm using the mingw distribution 3.6.1 and this seems to work on my Windows7 x64 machine:
|
Thu 04 Oct 2012 02:01:33 PM UTC, comment #5:
A character string using single quotes does not do any backslash escape processing.
But, when given a single quote character string, the printf functions do perform escape processing on the format argument. That is required for Matlab compatibility.
One problem is what escape sequences should be recognized, and what should we do for those that are not recognized. Maybe we shouldn't be warning about them, or dropping the \ character.
The problem with the edit function is that we want to handle %s in the EDITOR variable. The easy way to do that is to use the EDITOR variable as a format in sprintf. But as you see, that causes some trouble. Can you avoid the problem by using double quotes and double backslashes: "c:\\foo\\bar\\system\\editor"?
|
Thu 04 Oct 2012 01:45:29 PM UTC, comment #4:
I think this is a related issue that breaks the edit.m command on Windows since my EDITOR specifies the full path using backslashes. edit.m uses sprintf command but you can see the problem here:
|
Thu 05 Apr 2012 07:09:04 PM UTC, comment #3:
Is the particular example an actual problem? It appears that it might not even run on Matlab. For example, what does Matlab do for
I would think it would produce an error because the string delimiter in Matlab is a single quote. So it looks like the code to run would be
and the eval version would be
which very properly doesn't do escape sequences.
|
Tue 28 Jun 2011 11:32:49 PM UTC, comment #2:
Oops, no there is not. The first is correct. What was I thinking? Is there no way to delete a comment from the bug tracker?
|
Tue 28 Jun 2011 11:30:36 PM UTC, comment #1:
There is a typo in the description of the bug. It should be
|
Tue 21 Jun 2011 03:10:03 PM UTC, original submission:
Octave processes string escapes in the following context:
This does not happen in Matlab (Matlab only processes string escapes in the format of a call to *printf). This problem has consequences for command evaluation on Windows systems where backslash is used as a directory separator.
|
(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
Digest:
bug dependencies.
Follow 4 latest changes.