octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #46216] glob() oddities with a wildcard follow


From: Rik
Subject: [Octave-bug-tracker] [bug #46216] glob() oddities with a wildcard following two or more characters
Date: Sat, 17 Oct 2015 04:03:07 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)

Update of bug #46216 (project octave):

                  Status:                    None => Confirmed              
             Assigned to:                    None => jwe                    

    _______________________________________________________

Follow-up Comment #1:

Confirmed.  In version 4.0.0 the patterns work as expected, but not with a
recent development tip.

The problem seems to be that the all_strings() function has changed.  If you
look at the glob function in dirfns.cc one of the first actions is


string_vector pat = args(0).all_strings ("glob: PATTERN must be a string");


Using the glob pattern


{"do*", "lib*"}


I find that the resulting entries in the string_vector (using gdb) are


"do* "
"lib*"


As you can see, it is as if the code called char (glob_ptn) and formed a char
matrix.  The first pattern is shorter than the second so it is extended with a
space character.  Of course, that is not right.

I think this is connected with jwe's change to exception processing.  Using
gdb I find the following backtrace


#0  octave_cell::all_strings (this=0xaeab30, pad=true)
    at libinterp/octave-value/ov-cell.cc:629
#1  0x00007ffff712d530 in octave_value::all_strings (this=0x7fbb78, pad=true)
    at ./libinterp/octave-value/ov.h:897
#2  0x00007ffff73bf2a6 in Fglob (args=...) at libinterp/corefcn/dirfns.cc:565


The thing to note is that pad is true.  This is because the call in Fglob, as
stated earlier, now contains an error message to be printed if the conversion
fails.


string_vector pat = args(0).all_strings ("glob: PATTERN must be a string");


There is no prototype in ov.h of an all_strings() function which takes a
string argument in and outputs a string_vector.  The closest matching function
is one that takes in a boolean value pad.  So the compiler seems to take the
error message which is set as boolean true.

If I restore line 565 to


string_vector pat = args(0).all_strings ();


then the glob patterns work.

I'm adding jwe to the CC list for this report.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?46216>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]