bugGNU Octave - Bugs: bug #46216, glob() oddities with a wildcard...

 
 

bug #46216: glob() oddities with a wildcard following two or more characters

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Thu 15 Oct 2015 08:27:38 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  jwe
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 25 Nov 2015 04:49:29 PM UTC, comment #9: 

Fixed in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/c5e8863858b4).  The problem was that the code had not been updated to use the new xall_strings() function that works with the new exception handling mechanism for errors in the core.  Closing report.

Rik <rik5>
Group administrator
Wed 25 Nov 2015 12:16:10 PM UTC, comment #8: 

The problem with glob breaks installing forge packages for me.


save ("__bilateral__.oct", "pi");
save ("__boundary__.oct", "pi");
save ("rotate_scale.oct", "pi");
x = {"__bilateral__.oct", "__boundary__.oct", "rotate_scale.oct"}
glob (x)


only returns "__bilateral__.oct" on my system. This causes a problem in scripts/miscellaneous/copyfile.m:83


  ## Protect the filename(s).
  f1 = glob (f1);


where not all .oct files are copied to the destination directory. I wonder why no one else sses this problem when trying to install forge packages with oct files.

Andreas Weber <andy1978>
Group Member
Wed 28 Oct 2015 05:20:45 PM UTC, comment #7: 

see bug bug #46293 also

Doug Stewart <dastew>
Wed 21 Oct 2015 10:04:30 PM UTC, comment #6: 

Both bugs are due to the switchover to exceptions for error handling.  Per comment #2, jwe is trying to get a list/summary of all breakages related to this so we can figure out how to handle each case.

Rik <rik5>
Group administrator
Wed 21 Oct 2015 09:30:11 PM UTC, comment #5: 

@Olaf:
The relation with bug #46251 is not clear to me, sorry.

Philip Nienhuis <philipnienhuis>
Group Member
Mon 19 Oct 2015 06:29:07 PM UTC, comment #4: 

As noted by Rik, see also:
<http://savannah.gnu.org/bugs/?46251>

Olaf Till <i7tiol>
Group Member
Sat 17 Oct 2015 10:04:49 PM UTC, comment #3: 

Like Jordi says, the development branch is the one place where breakage is to be expected to some extent :-)

Philip Nienhuis <philipnienhuis>
Group Member
Sat 17 Oct 2015 04:00:37 PM UTC, comment #2: 

Sorry about that breakage.

There are a few other sticky issues that have turned up with the exception handling changes and I'm not sure yet how to handle all of them.  I'll try to put together a summary soon so we can decide how to handle them (or, worst case, just revert the exception handling change, but I really really really don't want to do that).

John W. Eaton <jwe>
Group administrator
Sat 17 Oct 2015 04:03:07 AM UTC, 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.

Rik <rik5>
Group administrator
Thu 15 Oct 2015 08:27:38 PM UTC, original submission:  

Steps to reproduce:

on Linux in the Octave build tree invoking "./run-octave &" is easiest:

> glob ({"do*", "lib*"})
ans =
{
  [1,1] = libgnu
  [2,1] = libgui
  [3,1] = libinterp
  [4,1] = liboctave
  [5,1] = libtool
}
>> glob ({"d*", "lib*"})
ans =
{
  [1,1] = libgnu
  [2,1] = libgui
  [3,1] = libinterp
  [4,1] = liboctave
  [5,1] = libtool
}
>> glob ({"d*", "l*"})
ans =
{
  [1,1] = doc
  [2,1] = libgnu
  [3,1] = libgui
  [4,1] = libinterp
  [5,1] = liboctave
  [6,1] = libtool
}
>>


It shows that subdir "doc" is only found if all file patterns comprise just one leading letter followed by a wildcard.
If any of the patterns consists of two or more leading letters followed by a wildcard glob() fails to find "doc".
I haven't been able to assess further systematics here.

I'm sure this was working fine some weeks ago (I mean: pkg rebuild -auto <list_of_packages>" worked fine, implying glob() must have worked fine in turn then), hence a regression.

FYI my systems:
Windows 7 prof 64-bit
Mageia-5 Linux 64 bit (build system also for mxe-octave)

[philip@deskprn dev]$ hg -v summary
parent: 20629:ab705b42cfd8 tip
 build: Fix compilation error when building with --without-qrupdate


Background:
I hit this while trying to run "pkg rebuild -auto <list_of_package_names>" in a freshly insatlled MXE cross-build on Windows; I found that consistently only one of the packages in the list was actually set to autoload.
Debugging pkg.m it turns out that in rebuild.m, on L.38, the following call fails:

dirlist = glob (strcat (files, '-*'));


because glob() fails.

Philip Nienhuis <philipnienhuis>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by i7tiol (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by philipnienhuis (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 group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-25 mtmiller Dependencies- bugs #46230 is dependent
    2015-11-25 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-10-17 rik5 StatusNone Confirmed
        Assigned toNone jwe

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code