'find' portability problem (was Re: LyX and OS X)

2004-07-13 Thread Jean-Marc Lasgouttes
 Nirmal == Nirmal Govind [EMAIL PROTECTED] writes:

Hello lyx-devel, I continue this private discussion with Nirmal and
Bennett here, since I am sure somebody will come up with the one true
find syntax we need.

The problem is that compilation hangs in po, and the reason is the
following find invokation in po/Makefile.in.in:

  find src -regex .*\\.\\(C\\|c\\|h\\|C\\.in\\) -print

Nirmal My bad.. the correct syntax should be:

Nirmal find src \( -regex .*\\.\\C -or -regex .*\\.\\c -or -regex
Nirmal .*\\.\\h -or -regex .*\\C\\.in \) -print

Nirmal This works well and from man find on OS X, there does not seem
Nirmal to be support for the | syntax for the logical OR (I'm pasting
Nirmal some of the relevant parts of man find below)..

I took a look at the find man page which reads:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/find.1.html]

 -regex pattern

  True if the whole path of the file matches pattern using regular
  expression. To match a file named ``./foo/xyzzy'', you can use the
  regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not ``xyzzy''
  or ``/foo/''.

This is OK. However, there is also this option about the type of
regular expressions:

 -E 
  Interpret regular expressions followed by -regex and -iregex
  options as extended (modern) regular expressions rather than basic
  regular expressions (BRE's). The re_format(7) manual page fully
  describes both formats.

So, what is a basic RE according to apple? The man page re_format
says:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/re_format.7.html]

  Obsolete (``basic'') regular expressions differ in several respects.
  `|' is an ordinary character and there is no equivalent for its
  functionality. [...]


So it seems that Darwin's find cannot handle our find regular
expression, because BRE cannot do `or'. OTOH, it seems that we cannot
use EREs with GNU find.

Except for the .C.in case, it seems that we could use 
  find src -name '*.[Cch]' -print
(this is basically what we did in 1.3.x)

So what is the truly portable way to do a ``or'' in find-world? Shall
we use \( foo -or bar \)?

JMarc


Re: 'find' portability problem (was Re: LyX and OS X)

2004-07-13 Thread Stephan Witt
Jean-Marc Lasgouttes wrote:
Nirmal == Nirmal Govind [EMAIL PROTECTED] writes:

Hello lyx-devel, I continue this private discussion with Nirmal and
Bennett here, since I am sure somebody will come up with the one true
find syntax we need.
The problem is that compilation hangs in po, and the reason is the
following find invokation in po/Makefile.in.in:
  find src -regex .*\\.\\(C\\|c\\|h\\|C\\.in\\) -print
Nirmal My bad.. the correct syntax should be:
Nirmal find src \( -regex .*\\.\\C -or -regex .*\\.\\c -or -regex
Nirmal .*\\.\\h -or -regex .*\\C\\.in \) -print
Nirmal This works well and from man find on OS X, there does not seem
Nirmal to be support for the | syntax for the logical OR (I'm pasting
Nirmal some of the relevant parts of man find below)..
I took a look at the find man page which reads:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/find.1.html]
 -regex pattern
  True if the whole path of the file matches pattern using regular
  expression. To match a file named ``./foo/xyzzy'', you can use the
  regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not ``xyzzy''
  or ``/foo/''.
This is OK. However, there is also this option about the type of
regular expressions:
 -E 
  Interpret regular expressions followed by -regex and -iregex
  options as extended (modern) regular expressions rather than basic
  regular expressions (BRE's). The re_format(7) manual page fully
  describes both formats.

So, what is a basic RE according to apple? The man page re_format
says:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/re_format.7.html]
  Obsolete (``basic'') regular expressions differ in several respects.
  `|' is an ordinary character and there is no equivalent for its
  functionality. [...]
So it seems that Darwin's find cannot handle our find regular
expression, because BRE cannot do `or'. OTOH, it seems that we cannot
use EREs with GNU find.
Except for the .C.in case, it seems that we could use 
  find src -name '*.[Cch]' -print
(this is basically what we did in 1.3.x)

So what is the truly portable way to do a ``or'' in find-world? Shall
we use \( foo -or bar \)?
Hi Jean-Marc,
as far as I know I would do it like that:
find path-name-list \( -name foo -o -name bar \) -print
Stephan


'find' portability problem (was Re: LyX and OS X)

2004-07-13 Thread Jean-Marc Lasgouttes
> "Nirmal" == Nirmal Govind <[EMAIL PROTECTED]> writes:

Hello lyx-devel, I continue this private discussion with Nirmal and
Bennett here, since I am sure somebody will come up with the one true
find syntax we need.

The problem is that compilation hangs in po, and the reason is the
following find invokation in po/Makefile.in.in:

  find src -regex ".*\\.\\(C\\|c\\|h\\|C\\.in\\)" -print

Nirmal> My bad.. the correct syntax should be:

Nirmal> find src \( -regex ".*\\.\\C" -or -regex ".*\\.\\c" -or -regex
Nirmal> ".*\\.\\h" -or -regex ".*\\C\\.in" \) -print

Nirmal> This works well and from man find on OS X, there does not seem
Nirmal> to be support for the | syntax for the logical OR (I'm pasting
Nirmal> some of the relevant parts of man find below)..

I took a look at the find man page which reads:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/find.1.html]

 -regex pattern

  True if the whole path of the file matches pattern using regular
  expression. To match a file named ``./foo/xyzzy'', you can use the
  regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not ``xyzzy''
  or ``/foo/''.

This is OK. However, there is also this option about the type of
regular expressions:

 -E 
  Interpret regular expressions followed by -regex and -iregex
  options as extended (modern) regular expressions rather than basic
  regular expressions (BRE's). The re_format(7) manual page fully
  describes both formats.

So, what is a basic RE according to apple? The man page re_format
says:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/re_format.7.html]

  Obsolete (``basic'') regular expressions differ in several respects.
  `|' is an ordinary character and there is no equivalent for its
  functionality. [...]


So it seems that Darwin's find cannot handle our find regular
expression, because BRE cannot do `or'. OTOH, it seems that we cannot
use EREs with GNU find.

Except for the .C.in case, it seems that we could use 
  find src -name '*.[Cch]' -print
(this is basically what we did in 1.3.x)

So what is the truly portable way to do a ``or'' in find-world? Shall
we use "\( foo -or bar \)"?

JMarc


Re: 'find' portability problem (was Re: LyX and OS X)

2004-07-13 Thread Stephan Witt
Jean-Marc Lasgouttes wrote:
"Nirmal" == Nirmal Govind <[EMAIL PROTECTED]> writes:

Hello lyx-devel, I continue this private discussion with Nirmal and
Bennett here, since I am sure somebody will come up with the one true
find syntax we need.
The problem is that compilation hangs in po, and the reason is the
following find invokation in po/Makefile.in.in:
  find src -regex ".*\\.\\(C\\|c\\|h\\|C\\.in\\)" -print
Nirmal> My bad.. the correct syntax should be:
Nirmal> find src \( -regex ".*\\.\\C" -or -regex ".*\\.\\c" -or -regex
Nirmal> ".*\\.\\h" -or -regex ".*\\C\\.in" \) -print
Nirmal> This works well and from man find on OS X, there does not seem
Nirmal> to be support for the | syntax for the logical OR (I'm pasting
Nirmal> some of the relevant parts of man find below)..
I took a look at the find man page which reads:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/find.1.html]
 -regex pattern
  True if the whole path of the file matches pattern using regular
  expression. To match a file named ``./foo/xyzzy'', you can use the
  regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not ``xyzzy''
  or ``/foo/''.
This is OK. However, there is also this option about the type of
regular expressions:
 -E 
  Interpret regular expressions followed by -regex and -iregex
  options as extended (modern) regular expressions rather than basic
  regular expressions (BRE's). The re_format(7) manual page fully
  describes both formats.

So, what is a basic RE according to apple? The man page re_format
says:
[http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/re_format.7.html]
  Obsolete (``basic'') regular expressions differ in several respects.
  `|' is an ordinary character and there is no equivalent for its
  functionality. [...]
So it seems that Darwin's find cannot handle our find regular
expression, because BRE cannot do `or'. OTOH, it seems that we cannot
use EREs with GNU find.
Except for the .C.in case, it seems that we could use 
  find src -name '*.[Cch]' -print
(this is basically what we did in 1.3.x)

So what is the truly portable way to do a ``or'' in find-world? Shall
we use "\( foo -or bar \)"?
Hi Jean-Marc,
as far as I know I would do it like that:
find path-name-list \( -name foo -o -name bar \) -print
Stephan