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

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

[Octave-bug-tracker] [bug #48105] function "glob" oddities with trailing


From: anonymous
Subject: [Octave-bug-tracker] [bug #48105] function "glob" oddities with trailing "/"
Date: Fri, 3 Jun 2016 04:02:31 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.8.0

URL:
  <http://savannah.gnu.org/bugs/?48105>

                 Summary: function "glob" oddities with trailing "/"
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 03 Jun 2016 04:02:28 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

After trying many examples, absolute path or relative path, with or without
wildcard, it is found that
if the pattern ends with "/" and has three or more characters,
the result will matches not only directories but also ordinary files.

I'm not sure whether this is a bug, although this is different from Unix
shells where a pattern ends with "/" matches only directories.

Here is some examples:


octave:1>  ls -F
d/  dir/  f  file


OK with only two or less characters:

octave:2>  glob('/')
ans = 
{
  [1,1] = /
}
octave:3>  glob('//')
ans = 
{
  [1,1] = /
}
octave:4>  glob('./')
ans = 
{
  [1,1] = ./
}
octave:5>  glob('d/')
ans = 
{
  [1,1] = d/
}
octave:6>  glob('f/')
ans = {}(0x0)
octave:7>  glob('?/')
ans = 
{
  [1,1] = d/
}
octave:8>  glob('*/')
ans = 
{
  [1,1] = d/
  [2,1] = dir/
}


Incorrect with three or more characters:

octave:9>  glob('f*/')
ans = 
{
  [1,1] = f
  [2,1] = file
}
octave:10>  glob('*?/')
ans = 
{
  [1,1] = d/
  [2,1] = dir/
  [3,1] = f
  [4,1] = file
}
octave:11>  glob('./f/')
ans = 
{
  [1,1] = ./f
}
octave:12>  glob('file/')
ans = 
{
  [1,1] = file
}




octave:13>  ver
----------------------------------------------------------------------
GNU Octave Version: 4.0.2
GNU Octave License: GNU General Public License
Operating System: Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2
(2016-04-08) x86_64





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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