-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cabal 3.10.2.1 cannot parse pkg-config
: hGetContents: invalid argument (invalid byte sequence)
#9608
Comments
Hmm, given the
I'm not sure what to do fix this though. I can't uninstall |
What does |
Is this what you're looking for?
I've been staring at the package in the meantime (see package and PKGBUILD and upstream), and I think the symbol is a "®" symbol. I'm trying to figure out if this is a Cabal problem or a "this package is malformed" problem. |
Yup, I think I'm newly encountering this problem because of a branding change upstream here which was just packaged into Arch Linux yesterday (see package last updated time). |
UTF-8 locale. I wonder why |
Yeah, running |
The invalid Unicode is in the upstream |
I don't know enough about |
They introduced invalid UTF-8 characters into the |
I've opened an issue with upstream at intel/libvpl#117. I'm pretty sure upstream is at fault here, since I'll leave this open in case maintainers decide they want to support parsing Unicode characters from |
We do parse Unicode; the problem is the characters aren't Unicode. I wouldn't be surprised to find they're ISO8859-1. |
Yeah, I think it is. EDIT: Ah, and also:
Okay, will close this issue. Thanks for the assist! |
It would be more robust if Cabal parsed the file as binary |
I'm reopening this based on @Bodigrim's comment. |
we call getProgramOutput which in turn calls getProgramInvocationOutput. We could switch to getProgramInvocationLBS instead, should be a good first ticket for anyone that wants to pick it up. |
Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has a the time of writing, 2024-01-11, see haskell#9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in haskell#9608 (comment) switches to using a lazy ByteString for reading in the output, and splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored.
Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has at the time of writing, 2024-01-11, see haskell#9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in haskell#9608 (comment) switches to using a lazy ByteString for reading in the output, and splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored.
Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has at the time of writing, 2024-01-11, see haskell#9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in haskell#9608 (comment) switches to using a lazy ByteString for reading in the output, splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored.
Thank you for this. I am downgrading vpl for now. |
Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has at the time of writing, 2024-01-11, see haskell#9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in haskell#9608 (comment) switches to using a lazy ByteString for reading in the output, splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored.
I'm not much of an Arch expert, I don't know much about what these packages do or why sudo pacman -U https://archive.archlinux.org/packages/o/onevpl/onevpl-2023.4.0-1-x86_64.pkg.tar.zst |
I fixed this the lazy way on my machine by just editing |
Another thing that may be worth trying: it looks like |
I’ve independently run into this same problem: https://discourse.haskell.org/t/haskell-wlroots-bindings/8426/46. Again, the culprit was |
* Ignore invalid Unicode in pkg-config descriptions Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has at the time of writing, 2024-01-11, see #9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in #9608 (comment) switches to using a lazy ByteString for reading in the output, splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored. * Add changelog entry * cabal-install-solver: Add bounds on 'text' * No literal ASCII values, use 'ord' * Address review comments re invalid unicode from pkg-config * Add test for invalid unicode from pkg-config * Compatibility with text-1.2.5.0 * Align imports * Handle different exception type * Use only POSIX shell syntax * Add invalid-input handler in pkg-config shim This is to appease shellcheck * Actually implement all required stuff in the pkg-config shim * Less exception dance * Fix shebang lines MacOS doesn't have /usr/bin/sh, and /bin/sh is the standard (for a POSIX shell) anyway * Don't expect a particular representation of invalid characters --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Ignore invalid Unicode in pkg-config descriptions Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has at the time of writing, 2024-01-11, see #9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in #9608 (comment) switches to using a lazy ByteString for reading in the output, splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored. * Add changelog entry * cabal-install-solver: Add bounds on 'text' * No literal ASCII values, use 'ord' * Address review comments re invalid unicode from pkg-config * Add test for invalid unicode from pkg-config * Compatibility with text-1.2.5.0 * Align imports * Handle different exception type * Use only POSIX shell syntax * Add invalid-input handler in pkg-config shim This is to appease shellcheck * Actually implement all required stuff in the pkg-config shim * Less exception dance * Fix shebang lines MacOS doesn't have /usr/bin/sh, and /bin/sh is the standard (for a POSIX shell) anyway * Don't expect a particular representation of invalid characters --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 0b34b4e) # Conflicts: # Cabal/src/Distribution/Simple/Program/Run.hs
* Ignore invalid Unicode in pkg-config descriptions Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has at the time of writing, 2024-01-11, see #9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in #9608 (comment) switches to using a lazy ByteString for reading in the output, splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored. * Add changelog entry * cabal-install-solver: Add bounds on 'text' * No literal ASCII values, use 'ord' * Address review comments re invalid unicode from pkg-config * Add test for invalid unicode from pkg-config * Compatibility with text-1.2.5.0 * Align imports * Handle different exception type * Use only POSIX shell syntax * Add invalid-input handler in pkg-config shim This is to appease shellcheck * Actually implement all required stuff in the pkg-config shim * Less exception dance * Fix shebang lines MacOS doesn't have /usr/bin/sh, and /bin/sh is the standard (for a POSIX shell) anyway * Don't expect a particular representation of invalid characters --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 0b34b4e)
* Ignore invalid Unicode in pkg-config descriptions Previously, if any of the pkg-config packages on the system had invalid Unicode in their description fields (like the Intel vpl package has at the time of writing, 2024-01-11, see haskell#9608), cabal would crash because it tried to interpret the entire `pkg-config --list-all` output as Unicode. This change, as suggested by gbaz in haskell#9608 (comment) switches to using a lazy ByteString for reading in the output, splitting on the first space in byte land, and then parsing only the package _name_ to a String. For further future-proofing, package names that don't parse as valid Unicode don't crash Cabal, but are instead ignored. * Add changelog entry * cabal-install-solver: Add bounds on 'text' * No literal ASCII values, use 'ord' * Address review comments re invalid unicode from pkg-config * Add test for invalid unicode from pkg-config * Compatibility with text-1.2.5.0 * Align imports * Handle different exception type * Use only POSIX shell syntax * Add invalid-input handler in pkg-config shim This is to appease shellcheck * Actually implement all required stuff in the pkg-config shim * Less exception dance * Fix shebang lines MacOS doesn't have /usr/bin/sh, and /bin/sh is the standard (for a POSIX shell) anyway * Don't expect a particular representation of invalid characters --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Describe the bug
Trying to run
cabal build
on https://github.com/fossas/fossa-cli/tree/64c2f202dc923e3784267cf1d974a952da5baf09 works with Cabal 3.6.2.0, but not with Cabal 3.10.2.1. Here's the error message:This is strange, because
/usr/bin/pkg-config --list-all
exits zero, and/usr/bin/pkg-config --modversion liblzma
outputs5.4.5
. Here are somepkg-config
outputs:I have also the output of
/usr/bin/pkg-config --list-all
, available here: pkg-config-list-all.txt.I'm on Arch Linux (which symlinks
pkg-config
topkgconf
), and I suspect this may be related to #8930, which also impacts me. I've been having troubles withpkg-config
in general (see #8495 and #8494) since Cabal 3.8 when thepkg-config
logic was changed. The commit in this bug report also does not build on Cabal 3.8.1.0 for me, failing with the same error message.To Reproduce
cabal build
on https://github.com/fossas/fossa-cli/tree/64c2f202dc923e3784267cf1d974a952da5baf09 using Cabal 3.8.* or 3.10.* reliably reproduces this issue for me, although it may be because of my machine's specificpkg-config
database.Expected behavior
I expect the build to succeed building in Cabal 3.10, since it succeeded in Cabal 3.6, and my
pkg-config
database clearly has the required package.System information
The text was updated successfully, but these errors were encountered: