public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: binutils@sources.redhat.com
Subject: Re: PATCH: Do not use glob on MinGW hosts
Date: Thu, 17 Feb 2005 00:21:00 -0000	[thread overview]
Message-ID: <421388E7.3050102@codesourcery.com> (raw)
In-Reply-To: <20050216095137.GS4777@sunsite.mff.cuni.cz>

Jakub Jelinek wrote:

>>This patch avoids the use of glob -- by assuming the the included file
>>is just a literal pathname rather than a glob pattern.  As #include's
>>in ld.so.conf are rare, and glob-pattern includes are rarer, this
>>seems like a satisfactory solution.  
> 
> 
> Well, they aren't that rare.
> E.g. every recent Fedora Core and Red Hat Enterprise Linux installation has
> include ld.so.conf.d/*.conf

Thanks for educating me!

(I'd actually checked one of our RHEL servers, and it's not set up that 
way.)

> So IMHO you should also check for M$ globbing like functions and use them.
> Does MinGW have fnmatch?  If yes, you could e.g. loop with
> FindFirstFile/FindNextFile and fnmatch on each filename, etc.

No, there's no fnmatch in MinGW.  (MinGW is just an interface to 
Microsoft's C library, and that library doesn't have fnmatch.)  However, 
there is "fnmatch" in libiberty, so we could use that.

And FindFirstFile/FindNextFile do accept patterns containing "*" and 
"?".  But, these functions only work within a single directory.  In 
contrast, "glob" can handle things like "/etc/*/*".  So, we would have 
to operate recursively.  Furthermore, it's not clear to me that 
Microsoft's pattern matching exactly matches GLIBC's in particular.

If we really want to make this portable, the way to make it work is to 
write our own implementation of glob which walks recursively through 
directories.  Then, we should use this implementation everywhere -- 
including on GNU/Linux itself -- so that we can be sure to get the same 
semantics.  The same implementation should also be used in the dynamic 
linker so that it is consistent too.  The easiest thing might be to try 
to adopt the GNU libc glob for libiberty, but that's certainly not going 
to be trivial, and we'll have to keep it in sync forever more.

I guess I'm inclined to let someone who needs to solve this problem 
solve it; for our current purposes, the solution I posted is satisfactory.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

      reply	other threads:[~2005-02-16 17:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-16 12:03 Mark Mitchell
2005-02-16 12:18 ` Alan Modra
2005-02-16 12:28 ` Jakub Jelinek
2005-02-17  0:21   ` Mark Mitchell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=421388E7.3050102@codesourcery.com \
    --to=mark@codesourcery.com \
    --cc=binutils@sources.redhat.com \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).