glob("/tmp/a/*") returns GLOB_ABORTED on RHEL, GLOB_NOMATCH on DU

M

mark.bergman

I am porting from Digital Unix to Linux (RHEL 4), and am seeing a
difference in the return value of glob().
Given a non-existant directory "/tmp/a", and the following line of
code:
result = glob("/tmp/a", GLOB_ERR, NULL, &globInfo);
- result is set to GLOB_NOMATCH on both platforms.

However, if the first parameter is changed to "/tmp/a/*", i.e.
searching for files within the directory, the return value on Digital
Unix is still GLOB_NOMATCH, but on RHEL it is GLOB_ABORTED (2)

Which is correct?
(I have seen the man page, and some Google matches mentioning earlier
Linux bugs, but am still confused!)

TIA
Mark
 
M

mark_bluemel

I am porting from Digital Unix to Linux (RHEL 4), and am seeing a
difference in the return value of glob().
Given a non-existant directory "/tmp/a", and the following line of
code:
result = glob("/tmp/a", GLOB_ERR, NULL, &globInfo);
- result is set to GLOB_NOMATCH on both platforms.

However, if the first parameter is changed to "/tmp/a/*", i.e.
searching for files within the directory, the return value on Digital
Unix is still GLOB_NOMATCH, but on RHEL it is GLOB_ABORTED (2)

Which is correct?
(I have seen the man page, and some Google matches mentioning earlier
Linux bugs, but am still confused!)

This is probably better addressed in comp.unix.programmer, as
comp.lang.c tends not to concern itself with behaviour outside the C
standards.

However, http://www.opengroup.org/onlinepubs/009695399/functions/glob.html
(the relevant part of the relevant standard) was easy to find and
suggests to me that the RHEL behaviour is correct.
 
C

Chris F.A. Johnson

Who knows. You didn't post the code for glob().

man glob:


GLOB(3) Linux Programmer's Manual GLOB(3)


NAME
glob, globfree - find pathnames matching a pattern, free memory
from glob()
 
C

Chris F.A. Johnson

That is not the code for glob(). I see no mention of Linux in the
C standard. Nor of glob(). Nor of pathnames.

This is comp.os.linux.misc, not comp.lang.c, so that is
irrelevant.
 
K

Keith Thompson

Chris F.A. Johnson said:
On 2007-06-06, CBFalconer wrote: [...]
That is not the code for glob(). I see no mention of Linux in the
C standard. Nor of glob(). Nor of pathnames.

This is comp.os.linux.misc, not comp.lang.c, so that is
irrelevant.

It's both, as well as comp.unix.programmer. The message was
(inappropriately) cross-posted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top