bugGNU Octave - Bugs: bug #32176, infinite loop if PS1 contains...

 
 

bug #32176: infinite loop if PS1 contains deleted current directory

Submitter:  Petr Mikulik <mikulik>
Submitted:  Wed 19 Jan 2011 10:03:08 AM UTC
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  mtmiller
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Sat 12 Oct 2013 10:52:16 PM UTC, comment #13: 

Oops.  I forgot to push from my repository.  It's in the main repo now.

Rik <rik5>
Project Administrator
Sat 12 Oct 2013 08:53:35 PM UTC, comment #12: 

Rik, I wasn't sure from your last comment if you meant you were going to push it so I didn't push. I don't see it on the main repo yet though.

Mike Miller <mtmiller>
Project Administrator
Sat 12 Oct 2013 05:54:43 PM UTC, comment #11: 

I applied Mike's patch and crossed the bug off the must-fix list (http://wiki.octave.org/3.8_Bug_Fix_List).

Rik <rik5>
Project Administrator
Sat 12 Oct 2013 03:43:33 PM UTC, comment #10: 

I was thinking just for this case, but I also wasn't sure where the error was coming from.

I think the patch is fine for now.  At least it avoids the infinite loop.

John W. Eaton <jwe>
Project Administrator
Sat 12 Oct 2013 03:32:16 PM UTC, comment #9: 

Oops, attached now.

Do you mean make it a warning for just this case, or change octave_getcwd to only generate a warning and return an empty string? I wonder if the latter would have unintended consequences.

(file #29361)

Mike Miller <mtmiller>
Project Administrator
Sat 12 Oct 2013 03:22:38 PM UTC, comment #8: 

BTW, I don't see a patch attached.

John W. Eaton <jwe>
Project Administrator
Sat 12 Oct 2013 03:18:59 PM UTC, comment #7: 

I know in comment #1 jwe mentions the best solution might be for Octave to keep what it thinks the current working directory is. This would probably bring other benefits as well. My patch does not address that, just the immediate problem.

Mike Miller <mtmiller>
Project Administrator
Sat 12 Oct 2013 03:15:39 PM UTC, comment #6: 

Should the error be a warning instead?

Otherwise it seems OK to me.

John W. Eaton <jwe>
Project Administrator
Sat 12 Oct 2013 03:13:02 PM UTC, comment #5: 

Attached patch fixes the infinite loop. Not pushed yet because I'm not sure what string is best to present in place of the directory. This patch does the following:

octave:1> PS1 ("\\s:\\w> ");
octave:~> mkdir ~/tempdir
ans =  1
octave:~> cd ~/tempdir
octave:~/tempdir> rmdir ~/tempdir
ans =  1
error: unable to find current directory
octave:> pwd
error: unable to find current directory
error: pwd: unable to find current directory
error: unable to find current directory
octave:> cd
error: unable to find current directory
octave:~>

If no one objects I can push this fix.

Mike Miller <mtmiller>
Project Administrator
Thu 29 Aug 2013 08:30:55 PM UTC, comment #4: 

Bug is still here, 8/29/13.

Rik <rik5>
Project Administrator
Fri 19 Apr 2013 11:45:00 PM UTC, comment #3: 

Confirmed still present in the development version, if and only if PS1 contains the \W or \w escape sequences.

Mike Miller <mtmiller>
Project Administrator
Wed 19 Jan 2011 01:08:48 PM UTC, comment #2: 

Oh I see it's not the Octave's default, but my own in $HOME/.octaverc:

 PS1('\W \t \#> ');

Unfortunately Octave cannot be interrupted by Ctrl-C in the infinite loop but it must be killed completely.

Petr Mikulik <mikulik>
Wed 19 Jan 2011 11:15:14 AM UTC, comment #1: 

I think this could be avoided by having Octave maintain an internal idea of what the current working directory is and that is only updated when chdir is called.  But unfortunately, I think this will require more changes that I'd like to make right before the release.

BTW, in the Octave sources, the default value of the Octave prompt is

"\s:\#> "

so I guess someone else is giving you the value you have.

John W. Eaton <jwe>
Project Administrator
Wed 19 Jan 2011 10:03:08 AM UTC, original submission:  

If current working directory where Octave runs is removed (by another process, for example) then:

1. If PS1 contains cwd, e.g. the default value of W|\t|\#>
   then Octave goes into an infinite loop saying:

error: unable to find current directory
error: unhandled execution exception -- trying to return to prompt
error: unable to find current directory
error: unhandled execution exception -- trying to return to prompt
error: unable to find current directory

2. If PS1 does not contain cwd, then it says:

error: unable to find current directory

Could 1. behave as 2.?

Petr Mikulik <mikulik>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #29361:  bug32176.patch added by mtmiller (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mikulik (Submitted the item)
  •  

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

     

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-12 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2013-10-12 mtmiller Attached File- Added bug32176.patch, #29361
    2013-10-12 mtmiller StatusConfirmed Patch Submitted
        Assigned toNone mtmiller
        Release3.3.54 dev
    2013-04-19 mtmiller CategoryNone Interpreter
        StatusNone Confirmed
        Summaryinfinite loop if current directory removed infinite loop if PS1 contains deleted current directory

    Back to the top


    Powered by Savane 3.9