help-octave
[Top][All Lists]
Advanced

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

Weird problem with function ls or system("ls...")


From: Christian Weickhmann
Subject: Weird problem with function ls or system("ls...")
Date: Tue, 28 Jul 2009 18:05:23 +0200
User-agent: KMail/1.11.2 (Linux/2.6.28-13-generic; KDE/4.2.2; x86_64; ; )

Hello,

I stumbled over a weird problem using octave to read data from files.

When I do an ls() or system("ls ...") in octave where no file matches my search 
pattern, instead of returning an empty set, octave gives me a "No such file or 
directory".

Example:

octave> mkdir test # create empty dir
octave> ls
# Works, no output
ovtave> ls("*")
# Works too, no output
octave> ls("*a*")
ls: Zugriff auf *a* nicht möglich: No such file or directory
error: ls: command exited abnormally with status 2
error: called from:
error:   /usr/share/octave/3.2.0/m/miscellaneous/ls.m at line 66, column 2

To be sure I looked into ls.m and found, that it's no magic at all: ls -> 
system("ls ..."). So i tried

octave:> system("ls *a*")
ls: Zugriff auf *a* nicht möglich: No such file or directory
ans =  2

I know, I can catch that with a try/catch block. So I would not directly call 
it a bug. But it's annoying. Frankly, it took me 1 hour to find what is causing 
the problem. See, if you have a lot of data, and some record just doesn't 
exist, you might want him to continue just fine... ;)

But it would be so much more intuitive, if worked just like in the ls * case, 
as bash's ls also gives you an empty set. I assume that this is not intended, 
because he obviously tries to access a file named "*a*".

Octave: GNU Octave, version 3.2.0, arch: "x86_64-unknown-linux-gnu"
System: Linux 2.6.28-13-generic #45-Ubuntu SMP x86_64 GNU/Linux
Bash: GNU bash, version 3.2.48(1)-release-(x86_64-pc-linux-gnu)
libc: libc6 2.9-4ubuntu6 (x86_64)

Best regards,
Christian

-- 
---

Christian Weickhmann
c/o Residence de la Houille Blanche
2 ave. des Jeux Olympiques _D373_
38029 Grenoble Cedex 2

Tel +49 (0) 6003 249383




reply via email to

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