bugGNU Octave - Bugs: bug #55725, help function fails when TMPDIR...

 
 

bug #55725: help function fails when TMPDIR contains a space

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Sat 16 Feb 2019 08:45:22 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

( Jump to the original submission)

Sun 17 Feb 2019 11:46:02 AM UTC, comment #9: 

I don't think that Octave's "system" does some kind conversion between single and double quotes (and I really think it shouldn't).
The following command from the Octave prompt also creates two folder:

system("mkdir 'a b'")

Storing 8.3 names in the file system (NTFS) is optional. So we shouldn't rely on that mechanic. But I agree that your code would work as a workaround in the majority of cases.
Similarly, a user could replace _makeinfo_.m with the one from the repository.

Markus Mützel <mmuetzel>
Project Member
Sun 17 Feb 2019 02:26:26 AM UTC, comment #8: 

In windows command shell I'm pretty user double quotes are expected to be used in most things related to path definitions. I don't think I've ever seen single quotes work.  Might I be correct in guessing that system() corrects things behind the scenes for windows?

In any case, for those on windows awaiting a patched version, the following in a batch file (also attached) in the same folder as octave.vbs will change the TMP and TEMP environment variables to the 8.3 versions and then start Octave

@ECHO OFF
for %%A in ("%TMP%") do set TMP=%%~sA
for %%A in ("%TEMP%") do set TEMP=%%~sA
start octave.vbs

(file #46292)

Nicholas Jankowski <nrjank>
Sat 16 Feb 2019 09:59:19 PM UTC, comment #7: 

Thanks, good info to know about.

Closing as fixed, this works for me now.

Mike Miller <mtmiller>
Project Administrator
Sat 16 Feb 2019 09:50:08 PM UTC, comment #6: 

In general, single quotes sometimes work and sometimes don't on Windows. It seems to depend on the program that is called.
E.g. the following creates too directories called "'Test" and "space'":

mkdir 'Test space'

Double quotes seem to be the safer choice.

Markus Mützel <mmuetzel>
Project Member
Sat 16 Feb 2019 09:42:22 PM UTC, comment #5: 

This fix works for me on the stable branch, I have no problem leaving this as is for the Octave 5 release.

On the default branch I may look at a mass change to make all sprintf calls that make command strings consistent. I was just asking to be sure that this would be safe on Windows.

Mike Miller <mtmiller>
Project Administrator
Sat 16 Feb 2019 09:36:45 PM UTC, comment #4: 

Only for consistency. Octave style preference is to use double quotes for all string variables. If the command shell is happy with either quote, I think Octave would prefer this style:

system (sprintf ("'%s' --foo --bar '%s'", program, argument));

Mike Miller <mtmiller>
Project Administrator
Sat 16 Feb 2019 09:33:00 PM UTC, comment #3: 

It also works for me if the quotes are reversed.
Is there a reason why that is preferred?

Markus Mützel <mmuetzel>
Project Member
Sat 16 Feb 2019 09:29:11 PM UTC, comment #2: 

Thanks Markus. Are double quotes required for this to work correctly in the Windows command shell? Would your fix work equally well on Windows if the quotes were reversed?

Mike Miller <mtmiller>
Project Administrator
Sat 16 Feb 2019 09:23:05 PM UTC, comment #1: 

I pushed a change to stable here that fixes the issue for me on Windows and Linux:
http://hg.savannah.gnu.org/hgweb/octave/rev/fb920b730931

Marking as ready for test.

Markus Mützel <mmuetzel>
Project Member
Sat 16 Feb 2019 08:45:22 PM UTC, original submission:  

When TMPDIR is set to a directory that contains a space, the help function fails:

>> help abs
'abs' is a built-in function from the file libinterp/corefcn/mappers.cc

-- abs (Z)
     Compute the magnitude of Z.

     The magnitude is defined as |Z| = 'sqrt (x^2 + y^2)'.

     For example:

          abs (3 + 4i)
               => 5

     See also: arg.

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at https://www.octave.org and via the help@octave.org
mailing list.
>> mkdir ("/tmp/Temporary Files");
>> setenv ("TMPDIR", "/tmp/Temporary Files");
>> help abs
could not open /tmp/Temporary: No such file or directory
could not open Files/octave-help-4m3MOb: No such file or directory
'abs' is a built-in function from the file libinterp/corefcn/mappers.cc



Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at https://www.octave.org and via the help@octave.org
mailing list.

This bug is reproducible on any operating system, but is probably more likely to affect Windows users than GNU/Linux or Unix users.

Mike Miller <mtmiller>
Project Administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #46292:  pathfix.bat added by nrjank (107B - application/octet-stream - batch file to change TEMP variables to 8.3 form and then start octave. should be placed in same location as octave.vbs)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  •  

    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 project members can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-17 nrjank Attached File- => Added pathfix.bat, #46292
    2019-02-16 mtmiller StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2019-02-16 mmuetzel StatusConfirmed => Ready For Test
        Operating SystemGNU/Linux => Any
    2019-02-16 mtmiller Carbon-CopyRemoved 80942 => -

    Back to the top


    Powered by Savane 3.5