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

Discussion in 'C Programming' started by mark.bergman@thales-is.com, Jun 5, 2007.

  1. Guest

    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
     
    , Jun 5, 2007
    #1
    1. Advertising

  2. Guest

    On 5 Jun, 14:45, 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.
     
    , Jun 5, 2007
    #2
    1. Advertising

  3. On 2007-06-05, CBFalconer wrote:
    > 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, Jun 6, 2007
    #3
  4. On 2007-06-06, CBFalconer wrote:
    > "Chris F.A. Johnson" wrote:
    >> On 2007-06-05, CBFalconer wrote:
    >>> 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, Jun 6, 2007
    #4
  5. "Chris F.A. Johnson" <> 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) <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"
     
    Keith Thompson, Jun 6, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Georgy Pruss
    Replies:
    15
    Views:
    757
    Tim Roberts
    Dec 1, 2003
  2. Tim Peters
    Replies:
    1
    Views:
    383
    Duncan Booth
    Dec 1, 2003
  3. Sean Berry

    Question about glob.glob <--newbie

    Sean Berry, May 4, 2004, in forum: Python
    Replies:
    3
    Views:
    359
    David M. Cooke
    May 4, 2004
  4. Elbert Lev

    glob.glob unicode bug or feature

    Elbert Lev, Jul 31, 2004, in forum: Python
    Replies:
    5
    Views:
    419
    Neil Hodgson
    Aug 2, 2004
  5. Hitesh

    glob.glob output

    Hitesh, Mar 12, 2007, in forum: Python
    Replies:
    6
    Views:
    418
    Hitesh
    Mar 13, 2007
Loading...

Share This Page