[Top][All Lists]

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

Re: How to handle data/script files in a VPATH build ?

From: Steffen Dettmer
Subject: Re: How to handle data/script files in a VPATH build ?
Date: Fri, 12 Feb 2010 14:15:04 +0100

Hi Ralf,

thanks again for your helpful message. It is interesting how many
mistakes (non-portable constructions) can be in such a small
snipped I wrote. Thanks for spotting.

On Wed, Feb 10, 2010 at 9:29 PM, Ralf Wildenhues wrote:
> * Steffen Dettmer wrote on Wed, Feb 10, 2010 at 11:01:34AM CET:
>> module=xyz
>> _mak=${module}.mak
>> echo "# Autogenerated by $0"  > ${_mak}
>> echo "${module}files = \\"         >> ${_mak}
>> find directoty1 directory2 directory3 -type f \
>>    -not -path '*/CVS*' \
> With find, -not is not portable, but ! is (suitably escaped when used in
> an interactive shell); -path is not portable either.

ohh, how bad...
I've read a bit about find in info find (I have no `info
findutils' page). It does not tell much about portability but
still a lot... (but I didn't find how to write -path correctly,
fortunatly we can require to have a GNU find :-)).

Just because of my curiosity, when writing portable packages
(i.e. packages compiling ON many platforms), on which platform
this is recommended to do so? GNU/Linux is great for working
because it has all the efficient tools, but bad for testing,
because it is too powerful and everything works :)
Or is there some `mini linux' or alike that uses e.g. busybox
find etc? Then someone could have a virtual machine to test.

>>    -not -path '*/*.sw?' \
>>    -exec echo "{} \\" \; \
> POSIX find only allows you to use {} as a single argument IIRC; you can
> just pass arguments to echo separately here: `-exec echo "{}" \\ \;'.

ohh interesting, thanks. Yes, if I look to the right place
and understand correctly, you do remember correctly:

    Historical implementations do not modify "{}" when it appears
    as a substring of an -exec or -ok utility_name or argument
    string.  There have been numerous user requests for this
    extension, so this volume of POSIX.1-2008 allows the desired
    behavior. At least one recent implementation does support
    this feature, but encountered several problems in managing
    memory allocation and dealing with multiple occurrences of
    "{}" in a string while it was being developed, so it is not
    yet required behavior.

>>                   | sort    >> ${_mak}
> With sort, you should always normalize the locale, i.e.,
>  LC_ALL=C sort

Is having `LC_COLLATE="POSIX"' also sufficient and correct?
(we have this in /etc/profile). But I added export LC_ALL=C to all
that scripts to go sure :)

> Well, don't look at the GNU find(1) manpage if you're looking for
> portable options only.  That's what POSIX/SUSv3 is for; the findutils
> info pages are more verbose about portability, too.

How do I get the findutils info pages? Is this `info find' or is
there another one?



reply via email to

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