Skip to content
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

postgresql tests fail in pkgsMusl #150930

Closed
cdepillabout opened this issue Dec 16, 2021 · 6 comments
Closed

postgresql tests fail in pkgsMusl #150930

cdepillabout opened this issue Dec 16, 2021 · 6 comments
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: portability General portability concerns, not specific to cross-compilation or a specific platform

Comments

@cdepillabout
Copy link
Member

cdepillabout commented Dec 16, 2021

Describe the bug

The tests for postgresql fail for pkgsMusl.postgresql.

Here's the test output on nixos-21.11 commit 5730959:

file.txt

The failing test lines are:

$ nix-build -A pkgsMusl.postgresql
this derivation will be built:
  /nix/store/rx4di64xhxr9rszpddrh7rp89m0qzk01-postgresql-13.4.drv
building '/nix/store/rx4di64xhxr9rszpddrh7rp89m0qzk01-postgresql-13.4.drv'...
unpacking sources
unpacking source archive /nix/store/j76apgvazybh6fhiif7yj67xnfj6x7fr-postgresql-13.4.tar.bz2
source root is postgresql-13.4
...
PATH="/build/postgresql-13.4/tmp_install/nix/store/ymyaxiha5d4c48dxwccjfr3iqdxh4vmw-postgresql-13.4/bin:$PATH" LD_LIBRARY_PATH="/build/postgresql-13.4/tmp_install/nix/store/fwx1f5x7hy0kf46rj52qfiw88wq6mnl2-postgresql-13.4-lib/lib"  ../../../src/test/regress/pg_regress --temp-instance=./tmp_check --inputdir=. --bindir=     --dlpath=. --max-concurrent-tests=20  --schedule=./parallel_schedule  
============== creating temporary instance            ==============
============== initializing database system           ==============
============== starting postmaster                    ==============
running on port 64468 with PID 27232
============== creating database "regression"         ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test tablespace                   ... ok          272 ms
parallel group (20 tests):  regproc name varchar int2 char int4 text oid money int8 float4 txid pg_lsn boolean float8 uuid bit enum numeric rangetypes
     boolean                      ... ok          110 ms
     char                         ... ok           78 ms
...
     tsrf                         ... ok           64 ms
     tid                          ... ok           69 ms
     tidscan                      ... ok           57 ms
     collate.icu.utf8             ... FAILED      472 ms
     incremental_sort             ... ok          207 ms
parallel group (6 tests):  collate.linux.utf8 amutils psql_crosstab psql rules stats_ext
     rules                        ... ok          388 ms
     psql                         ... ok          275 ms
     psql_crosstab                ... ok           62 ms
...
     tsearch                      ... ok          382 ms
     tsdicts                      ... ok          161 ms
     foreign_data                 ... FAILED      729 ms
     window                       ... ok          486 ms
     xmlmap                       ... ok          178 ms
...

A couple more things:

  • I imagine this problem also occurs on master, but I didn't actually run the build.
  • I'm not sure if this test is an actual issue, or just some minor problem in the postgresql test suite.
  • I didn't check the other versions of postgresql to see if they also have a similar problem.
  • I didn't check if pkgsMusl.postgresql builds correctly in previous versions of nixpkgs.

Notify maintainers

I'm not sure who is interested in pkgsMusl problems. Maybe @sternenseemann knows?

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.81, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.5pre20211126_55275fc`
 - channels(root): `"nixos-21.11.334247.573095944e7"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: pkgsMusl.postgresql
# a list of nixos modules affected by the problem
module:
@cdepillabout cdepillabout added 0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: portability General portability concerns, not specific to cross-compilation or a specific platform labels Dec 16, 2021
@sternenseemann
Copy link
Member

Alpine have given up figuring out what this test's problem is: https://github.com/alpinelinux/aports/blob/master/main/postgresql13/disable-test-collate.icu.utf8.patch

@cdepillabout
Copy link
Member Author

@sternenseemann Oh, that's smart looking for alpine patches!

It looks like they have another patch file that is disabling some tests, but it doesn't appear to disable the foreign_data test that is failing above as far as I can tell: https://github.com/alpinelinux/aports/blob/4a58f6fd7ede68b1541d6d577ba5ea0517386e4c/main/postgresql13/disable-broken-tests.patch

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 19, 2022
@cdepillabout
Copy link
Member Author

This is still an issue with postgres-14 with a recent nixpkgs master.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 22, 2022
@angerman
Copy link
Contributor

A year later ... and this is still an issue :D
Looking at the diff of the utf8 test:

diff -u ./src/test/regress/expected/collate.icu.utf8.out ./src/test/regress/results/collate.icu.utf8.out
--- ./src/test/regress/expected/collate.icu.utf8.out    2023-02-06 21:41:14.000000000 +0000
+++ ./src/test/regress/results/collate.icu.utf8.out     2023-05-19 04:06:50.965424988 +0000
@@ -1035,6 +1035,9 @@
           quote_literal(current_setting('lc_ctype')) || ');';
 END
 $$;
+ERROR:  collations with different collate and ctype values are not supported by ICU
+CONTEXT:  SQL statement "CREATE COLLATION test1 (provider = icu, lc_collate = 'C', lc_ctype = 'C.UTF-8');"
+PL/pgSQL function inline_code_block line 3 at EXECUTE
 CREATE COLLATION test3 (provider = icu, lc_collate = 'en_US.utf8'); -- fail, need lc_ctype
 ERROR:  parameter "lc_ctype" must be specified
 CREATE COLLATION testx (provider = icu, locale = 'nonsense'); /* never fails with ICU */  DROP COLLATION testx;
@@ -1045,13 +1048,12 @@
  collname 
 ----------
  test0
- test1
  test5
-(3 rows)
+(2 rows)
 
 ALTER COLLATION test1 RENAME TO test11;
+ERROR:  collation "test1" for encoding "UTF8" does not exist
 ALTER COLLATION test0 RENAME TO test11; -- fail
-ERROR:  collation "test11" already exists in schema "collate_tests"
 ALTER COLLATION test1 RENAME TO test22; -- fail
 ERROR:  collation "test1" for encoding "UTF8" does not exist
 ALTER COLLATION test11 OWNER TO regress_test_role;
@@ -1059,18 +1061,19 @@
 ERROR:  role "nonsense" does not exist
 ALTER COLLATION test11 SET SCHEMA test_schema;
 COMMENT ON COLLATION test0 IS 'US English';
+ERROR:  collation "test0" for encoding "UTF8" does not exist
 SELECT collname, nspname, obj_description(pg_collation.oid, 'pg_collation')
     FROM pg_collation JOIN pg_namespace ON (collnamespace = pg_namespace.oid)
     WHERE collname LIKE 'test%'
     ORDER BY 1;
  collname |    nspname    | obj_description 
 ----------+---------------+-----------------
- test0    | collate_tests | US English
  test11   | test_schema   | 
  test5    | collate_tests | 
-(3 rows)
+(2 rows)
 
 DROP COLLATION test0, test_schema.test11, test5;
+ERROR:  collation "test0" for encoding "UTF8" does not exist
 DROP COLLATION test0; -- fail
 ERROR:  collation "test0" for encoding "UTF8" does not exist
 DROP COLLATION IF EXISTS test0;
@@ -1078,10 +1081,17 @@
 SELECT collname FROM pg_collation WHERE collname LIKE 'test%';
  collname 
 ----------
-(0 rows)
+ test11
+ test5
+(2 rows)
 
 DROP SCHEMA test_schema;
+ERROR:  cannot drop schema test_schema because other objects depend on it
+DETAIL:  collation test_schema.test11 depends on schema test_schema
+HINT:  Use DROP ... CASCADE to drop the dependent objects too.
 DROP ROLE regress_test_role;
+ERROR:  role "regress_test_role" cannot be dropped because some objects depend on it
+DETAIL:  owner of collation test_schema.test11
 -- ALTER
 ALTER COLLATION "en-x-icu" REFRESH VERSION;
 NOTICE:  version has not changed

we find something unexpected:

+ERROR:  collations with different collate and ctype values are not supported by ICU
+CONTEXT:  SQL statement "CREATE COLLATION test1 (provider = icu, lc_collate = 'C', lc_ctype = 'C.UTF-8');"

we do set

Setting LC_CTYPE ontop to C does make the tests pass.

I'm somewhat puzzled as to where LC_CTYPE is being pulled from. Maybe this is a static ICU issue?

angerman added a commit to input-output-hk/haskell.nix that referenced this issue May 19, 2023
The reason that necessitates setting LC_CTYPE is not fully clear to me,
I've left some comments on the nixos/nixpkgs issue tracker.
It appears as if we are pulling LC_CTYPE to be some UTC8 value if it's
not set, instead of inheriting it from LC_ALL as it supposed to.

NixOS/nixpkgs#150930 (comment)
angerman added a commit to input-output-hk/haskell.nix that referenced this issue May 19, 2023
The reason that necessitates setting LC_CTYPE is not fully clear to me,
I've left some comments on the nixos/nixpkgs issue tracker.
It appears as if we are pulling LC_CTYPE to be some UTC8 value if it's
not set, instead of inheriting it from LC_ALL as it supposed to.

NixOS/nixpkgs#150930 (comment)
@patka-123
Copy link
Contributor

Hello @cdepillabout & @angerman

I just tried to reproduce this and it seems to work. Does this mean that the issue is now resolved? If so, would you be able to close this issue @cdepillabout ?

(I'm going through older issues to try to see what can be resolved. If you still experience this issue, then don't mind me).

@cdepillabout
Copy link
Member Author

@patka-123 Thanks for checking this out.

I just tried building pkgsMusl.postgresql_14, pkgsMusl.postgresql_15, and pkgsMusl.postgresql_16 on current nixpkgs-unstable (commit 8b8c940), and they all built fine.

jonathanlking added a commit to jonathanlking/static-haskell-nix that referenced this issue Dec 30, 2023
This no longer has the (same) failing test issue previously commented
on, see NixOS/nixpkgs#150930 (comment)
jonathanlking added a commit to jonathanlking/static-haskell-nix that referenced this issue Jan 1, 2024
This no longer has the (same) failing test issue previously commented
on, see NixOS/nixpkgs#150930 (comment)
nh2 pushed a commit to nh2/static-haskell-nix that referenced this issue Jun 8, 2024
This no longer has the (same) failing test issue previously commented
on, see NixOS/nixpkgs#150930 (comment)
nh2 pushed a commit to nh2/static-haskell-nix that referenced this issue Jun 15, 2024
This no longer has the (same) failing test issue previously commented
on, see NixOS/nixpkgs#150930 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: portability General portability concerns, not specific to cross-compilation or a specific platform
Projects
None yet
Development

No branches or pull requests

4 participants