public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* Cygport Bug: "find: No such file" Errors When Packaging
@ 2022-09-15 19:38 William Hu
  2022-09-17 12:27 ` Jon Turney
  0 siblings, 1 reply; 5+ messages in thread
From: William Hu @ 2022-09-15 19:38 UTC (permalink / raw)
  To: cygwin-apps

Hello,

I think I've found a (relatively innocuous) bug in cygport. It can be reproduced 
by compiling the OCaml package without having OCaml installed (which doesn't 
sound like an unreasonable thing to try; it'd be odd if OCaml depended on 
itself). This results in many unattractive errors at the end of the `cygport 
package` stage when cygport searches for dependencies:

*** Info: Tagging package hint files as test:
find: ‘/usr/lib/ocaml’: No such file or directory
find: ‘/usr/lib/ocaml’: No such file or directory
>>> ocaml requires: cygwin libgcc1 flexdll ocaml-runtime
find: ‘/usr/lib/ocaml’: No such file or directory
find: ‘/usr/lib/ocaml’: No such file or directory
>>> ocaml-runtime requires: cygwin libgcc1
find: ‘/usr/lib/ocaml’: No such file or directory
find: ‘/usr/lib/ocaml’: No such file or directory
>>> ocaml-compiler-libs requires: ocaml-runtime ocaml
find: ‘/usr/lib/ocaml’: No such file or directory
find: ‘/usr/lib/ocaml’: No such file or directory
>>> ocaml-ocamldoc requires: cygwin libgcc1 ocaml-compiler-libs ocaml-runtime
find: ‘/usr/lib/ocaml’: No such file or directory
find: ‘/usr/lib/ocaml’: No such file or directory
>>> ocaml-source requires:
find: ‘/usr/lib/ocaml’: No such file or directory
find: ‘/usr/lib/ocaml’: No such file or directory
>>> ocaml-doc requires:

Looking at cygport's code 
<https://github.com/cygwin/cygport/blob/8407994126516d73aeb17b6b829578c0848a4c4d/lib/pkg_info.cygpart#L364>
 it seems cygport checks for the existence of ocamlc.opt on PATH. Because the 
(package being built)'s install directory is appended to PATH by cygport, this 
will always be true in my case.

OCaml's compilers hardcode their location at compile time, so ocamlc.opt believes 
the standard library lives in "/usr/lib/ocaml" which is placed in `mldir`.

Cygport checks one more time to make sure mldir exists in the package being built 
(this second check is why those errors are hard to trigger on a non-OCaml package) 
and then calls `find` on both ${D}${mldir} and ${mldir}. Of course, since the 
*real* /usr/lib/ocaml won't exist if OCaml isn't installed on your actual system 
when you build it, find will output an error when run on those two directories.

Two ways to fix this would be to either remove the ${mldir} argument from find or 
test if ${mldir} exists and set it to the empty string if it doesn't. The second 
would likely preserve compatibility if there exist packages that depend on find 
searching both directories. The buggy test was added in 
<https://github.com/cygwin/cygport/commit/7d24eb71bdd91e2a368739728dbd522ddd4faaac>. 
Does anyone else have any insights or suggestions or does the above fix sound
reasonable?

Thanks,
William


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-02 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 19:38 Cygport Bug: "find: No such file" Errors When Packaging William Hu
2022-09-17 12:27 ` Jon Turney
2022-09-17 21:14   ` William Hu
2022-09-18 13:17     ` Jon Turney
2022-10-02 20:49       ` William Hu

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).