-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9658 from haskell/mergify/bp/3.10/pr-9609
Ignore invalid Unicode in pkg-config descriptions (backport #9609)
- Loading branch information
Showing
11 changed files
with
166 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/sh | ||
#!/bin/sh | ||
|
||
exit 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module MyLibrary () where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
packages: *.cabal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: PkgConfigParse | ||
version: 0.1 | ||
license: BSD3 | ||
author: Tom Smeding | ||
maintainer: Tom Smeding | ||
synopsis: Pkg Config Parse | ||
category: PackageTests | ||
build-type: Simple | ||
cabal-version: 2.0 | ||
|
||
description: | ||
Check that Cabal does not crash when pkg-config outputs invalid Unicode. | ||
|
||
Library | ||
pkgconfig-depends: vpl | ||
default-language: Haskell2010 | ||
build-depends: base <5.0 | ||
exposed-modules: | ||
MyLibrary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
# ugly, but "good enough" for this test | ||
# This will need to be updated whenever cabal invokes pkg-config | ||
# in new ways | ||
case "$*" in | ||
'--version') | ||
echo 2.1.0 # whatever | ||
;; | ||
|
||
'--variable pc_path pkg-config') | ||
echo '.' | ||
;; | ||
|
||
'--list-all') | ||
printf 'zlib zlib - zlib compression library\n' | ||
# \256 = \xAE is the iso-8859-1 (latin-1) encoded version of U+00AE, | ||
# i.e. the "registered sign": ® | ||
# This resulted in problems, see #9608 | ||
printf 'vpl Intel\256 Video Processing Library - Accelerated video decode, encode, and frame processing capabilities on Intel\256 GPUs\n' | ||
# \360 = \xF0 is latin-1 for ð; this is orð, Icelandic for "word"/"words". | ||
printf 'or\360 Icelandic characters\n' | ||
;; | ||
|
||
'--modversion '*) | ||
shift # drop the --modversion | ||
for arg; do | ||
case "$arg" in | ||
zlib) echo 1.3; ;; # whatever | ||
vpl) echo 2.10; ;; # whatever | ||
# No entry for orð here; let's not even try to match on that | ||
*) | ||
echo >&2 "Package $arg was not found in the pkg-config search path." | ||
exit 1 | ||
esac | ||
done | ||
;; | ||
|
||
# Ignore some stuff we're not implementing | ||
'--cflags '*) ;; | ||
'--libs '*) ;; | ||
|
||
*) | ||
echo >&2 "pkg-config: unrecognised arguments $* (this is an incomplete shim)" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# cabal v2-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- Test that invalid unicode in pkg-config output doesn't trip up cabal very much | ||
main = cabalTest $ do | ||
-- skipped on windows because using a script to dummy up an executable doesn't work the same. | ||
skipIfWindows | ||
cdir <- testCurrentDir `fmap` getTestEnv | ||
res <- cabal' "v2-build" ["--extra-prog-path="++cdir, "-v2"] | ||
assertOutputContains "Some pkg-config packages have names containing invalid unicode: or" res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
synopsis: Ignore invalid Unicode in pkg-config descriptions | ||
packages: cabal-install-solver | ||
prs: #9609 | ||
issues: #9608 | ||
|
||
description: { | ||
|
||
Previously, cabal-install would crash when `pkg-config --list-all` contained | ||
invalid Unicode. With this change, invalid unicode in package descriptions is | ||
ignored, and unparseable package names are considered nonexistent. | ||
|
||
} |