bugGNU Octave - Bugs: bug #49825, 64-bit Octave on Windows: system...

 
 

bug #49825: 64-bit Octave on Windows: system command always fails

Submitted by:  S. M. Hashemi <atomerz>
Submitted on:  Sun 11 Dec 2016 07:36:50 AM UTC  
 
Category: DocumentationSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Documentation
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.2.0Operating 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 Jump to the original submission)

Tue 05 Sep 2017 10:44:33 PM UTC, comment #6:

I updated the help text for system to note that the shell used for executing commands varies between operating systems. I also changed the example code to use '&' rather than ';' so it will execute reliably on UNIX or Windows platforms. See cset http://hg.savannah.gnu.org/hgweb/octave/rev/eef8c31ffe97.

Rik <rik5>
Project Administrator
Tue 13 Dec 2016 08:44:03 PM UTC, comment #5:

I have always developed in a unix environment. Unfortunately I now have to use Windows, but luckily octave is packaged with most of the unix environment, to be usable.

Because of this background, I assumed the system command starts a (unix) shell, as per unix man page: "system() executes a command specified in command by calling /bin/sh -c command"
However on windows it looks like a cmd.exe shell is started.

Personally I think a warning about this difference would be appropriate in the help of the command. At least state that the given example only works on linux.

Wrapping a the system command in a sh -c "" results in 'proper' behavior.

kire pudsje <kpc>
Mon 12 Dec 2016 08:21:03 PM UTC, comment #4:

Sorry, spoke too early. No problem with the & in between. However when running the example from "help system":

I get

kire pudsje <kpc>
Mon 12 Dec 2016 08:07:21 PM UTC, comment #3:

No problem here with 4.2.0 on win10, using the 64bit zip-file.
Maybe try running it first in the terminal command by hand in cmdshell.bat?
Also is your intention really to start a background process (single &)?. Otherwise either use && or ; in between

kire pudsje <kpc>
Sun 11 Dec 2016 10:25:08 AM UTC, comment #2:

It might be something in my system. I'm using this for an online course and when I posted the problem its forums one person replied and said they don't have this problem.
Is there a log or something? so that I can check to see exactly why I'm getting status = 1 all the time?

S. M. Hashemi <atomerz>
Sun 11 Dec 2016 09:01:14 AM UTC, comment #1:

Works fine with development version:

Provisionally setting status to "Works for me"

Philip Nienhuis <philipnienhuis>
Project Member
Sun 11 Dec 2016 07:36:50 AM UTC, original submission:

When I run 64-bit octave (zip or installer) and enter the following command:
[status, output] = system("echo hi & exit 2")

I always get status = 1 and no output. I struggled with this a couple of days until I used the 32-bit version and it works fine now.

S. M. Hashemi <atomerz>

 

(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 rik5 (Posted a comment)
  • -unavailable- added by kpc (Posted a comment)
  • -unavailable- added by atomerz (Submitted the item)
  • -unavailable- added by atomerz
  •  

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

     

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

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 05 Sep 2017 10:44:33 PM UTCrik5CategoryOctave Function=>Documentation
      Item GroupIncorrect Result=>Documentation
      StatusWorks For Me=>Fixed
      Open/ClosedOpen=>Closed
      Operating SystemMicrosoft Windows=>Any
    Sun 11 Dec 2016 09:01:14 AM UTCphilipnienhuisStatusNone=>Works For Me
    Sun 11 Dec 2016 07:36:50 AM UTCatomerzCarbon-Copy-=>Added atomerz

    Back to the top


    Powered by Savane 3.1-cleanup1