|
|
 |
 |
 |
 |
glob("/tmp/a/*") returns GLOB_ABORTED on RHEL, GLOB_NOMATCH on DU
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
On 5 Jun, 14:45, mark.berg@thales-is.com wrote: > 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.
mark.berg @thales-is.com wrote: > 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!)
Who knows. You didn't post the code for glob(). -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
On 2007-06-05, CBFalconer wrote: > mark.berg @thales-is.com wrote: >> 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!) > 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() -- Chris F.A. Johnson, author | <http://cfaj.freeshell.org> Shell Scripting Recipes: | My code in this post, if any, A Problem-Solution Approach | is released under the 2005, Apress | GNU General Public Licence
"Chris F.A. Johnson" wrote: > On 2007-06-05, CBFalconer wrote: >> mark.berg @thales-is.com wrote: >>> 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!) >> 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()
That is not the code for glob(). I see no mention of Linux in the C standard. Nor of glob(). Nor of pathnames. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
mark.berg @thales-is.com wrote: > 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.
In my earlier reply I didn't notice the cross-post, and neglected to set follow-ups. Done here. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
On 2007-06-06, CBFalconer wrote: > "Chris F.A. Johnson" wrote: >> On 2007-06-05, CBFalconer wrote: >>> mark.berg @thales-is.com wrote: ... >>> 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() > 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. -- Chris F.A. Johnson, author | <http://cfaj.freeshell.org> Shell Scripting Recipes: | My code in this post, if any, A Problem-Solution Approach | is released under the 2005, Apress | GNU General Public Licence
"Chris F.A. Johnson" <cfajohn@gmail.com> writes: > 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. -- Keith Thompson (The_Other_Keith) k@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" |
 |
 |
 |
 |
|