public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: William Hu <purplearmadillo77@proton.me>
To: "cygwin-apps@cygwin.com" <cygwin-apps@cygwin.com>
Subject: Cygport Bug: "find: No such file" Errors When Packaging
Date: Thu, 15 Sep 2022 19:38:04 +0000	[thread overview]
Message-ID: <gm6yTD7Gz9l0cL6auP3wvndqKLXAvtXT_Uayft3CSl19jNcuGzwV5vtpqSMnSDHW-VIkUxK7rWXXneA_Q2FOvq4tBwzf7SyFI3_9TYP0ZGs=@proton.me> (raw)

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


             reply	other threads:[~2022-09-15 19:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 19:38 William Hu [this message]
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

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='gm6yTD7Gz9l0cL6auP3wvndqKLXAvtXT_Uayft3CSl19jNcuGzwV5vtpqSMnSDHW-VIkUxK7rWXXneA_Q2FOvq4tBwzf7SyFI3_9TYP0ZGs=@proton.me' \
    --to=purplearmadillo77@proton.me \
    --cc=cygwin-apps@cygwin.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).