Skip to content

libwebsockets: fix plugin search path#532936

Merged
Mindavi merged 1 commit into
NixOS:masterfrom
hmenke:libwebsockets
Jul 2, 2026
Merged

libwebsockets: fix plugin search path#532936
Mindavi merged 1 commit into
NixOS:masterfrom
hmenke:libwebsockets

Conversation

@hmenke

@hmenke hmenke commented Jun 18, 2026

Copy link
Copy Markdown
Member

The update of libwebsockets from 4.4.1 to 4.4.51 introduced a regression where plugins could no longer be found.2 This could be traced back to a change in how the installation directory is computed since libwebsockets 4.4.23 and we patch it here with the correct path.

Fixes #532638

Tested using

cat <<-'EOF' | gdb --quiet --args ttyd -p 7681 bash
start
break lws_create_context
continue
catch syscall openat
commands 3
    x/s $rsi
    continue
end
continue
quit
EOF
Before
[...omitted...]
[2026/06/18 11:04:09:7248] N: ttyd 1.7.7 (libwebsockets 4.4.5-no_hash)
[2026/06/18 11:04:09:7248] N: tty configuration:
[2026/06/18 11:04:09:7248] N:   start command: bash
[2026/06/18 11:04:09:7248] N:   close signal: SIGHUP (1)
[2026/06/18 11:04:09:7248] N:   terminal type: xterm-256color
[2026/06/18 11:04:09:7248] N: The --writable option is not set, will start in readonly mode

Breakpoint 2, 0x00007ffff7f18fea in lws_create_context ()
   from /nix/store/l744pzvpq36rjwcz85qh10q7ci50vr2k-libwebsockets-4.4.5/lib/libwebsockets.so.20
=> 0x00007ffff7f18fea <lws_create_context+10>:	4c 8d 2d 6b 2c 06 00	lea    r13,[rip+0x62c6b]        # 0x7ffff7f7bc5c
(gdb) Catchpoint 3 (syscall 'openat' [257])
(gdb) >>>(gdb) Continuing.

Catchpoint 3 (call to syscall openat), 0x00007ffff7318bf6 in __open_nocancel
    ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f7fafb:	"."

Catchpoint 3 (returned from syscall openat), 0x00007ffff7318bf6 in __open_nocancel ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f7fafb:	"."

Catchpoint 3 (call to syscall openat), 0x00007ffff7318bf6 in __open_nocancel
    ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f81a20:	"/nix/store/l744pzvpq36rjwcz85qh10q7ci50vr2k-libwebsockets-4.4.5//nix/store/l744pzvpq36rjwcz85qh10q7ci50vr2k-libwebsockets-4.4.5/lib"

Catchpoint 3 (returned from syscall openat), 0x00007ffff7318bf6 in __open_nocancel ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f81a20:	"/nix/store/l744pzvpq36rjwcz85qh10q7ci50vr2k-libwebsockets-4.4.5//nix/store/l744pzvpq36rjwcz85qh10q7ci50vr2k-libwebsockets-4.4.5/lib"
[2026/06/18 11:04:09:7282] E: lws_create_context: failed to load evlib_uv
[2026/06/18 11:04:09:7282] E: libwebsockets context creation failed
[Inferior 1 (process 2389612) exited with code 01]
After
[...omitted...]
[2026/06/18 11:07:57:0258] N: ttyd 1.7.7 (libwebsockets 4.4.5-no_hash)
[2026/06/18 11:07:57:0258] N: tty configuration:
[2026/06/18 11:07:57:0258] N:   start command: bash
[2026/06/18 11:07:57:0258] N:   close signal: SIGHUP (1)
[2026/06/18 11:07:57:0258] N:   terminal type: xterm-256color
[2026/06/18 11:07:57:0258] N: The --writable option is not set, will start in readonly mode

Breakpoint 2, 0x00007ffff7f18fea in lws_create_context ()
   from /nix/store/grqrvcq4hm159fk80w93hnvwsf2z3giq-libwebsockets-4.4.5/lib/libwebsockets.so.20
=> 0x00007ffff7f18fea <lws_create_context+10>:	4c 8d 2d 6b 2c 06 00	lea    r13,[rip+0x62c6b]        # 0x7ffff7f7bc5c
(gdb) Catchpoint 3 (syscall 'openat' [257])
(gdb) >>>(gdb) Continuing.

Catchpoint 3 (call to syscall openat), 0x00007ffff7318bf6 in __open_nocancel
    ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f7fafb:	"."

Catchpoint 3 (returned from syscall openat), 0x00007ffff7318bf6 in __open_nocancel ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f7fafb:	"."

Catchpoint 3 (call to syscall openat), 0x00007ffff7318bf6 in __open_nocancel
    ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f81a20:	"/nix/store/grqrvcq4hm159fk80w93hnvwsf2z3giq-libwebsockets-4.4.5/lib"

Catchpoint 3 (returned from syscall openat), 0x00007ffff7318bf6 in __open_nocancel ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/libc.so.6
=> 0x00007ffff7318bf6 <__open_nocancel+70>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x7ffff7f81a20:	"/nix/store/grqrvcq4hm159fk80w93hnvwsf2z3giq-libwebsockets-4.4.5/lib"

Catchpoint 3 (call to syscall openat), 0x00007ffff7fe9fe5 in __open_nocancel
    ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/ld-linux-x86-64.so.2
=> 0x00007ffff7fe9fe5 <__open_nocancel+53>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x555555590410:	"/nix/store/grqrvcq4hm159fk80w93hnvwsf2z3giq-libwebsockets-4.4.5/lib/libwebsockets-evlib_uv.so"

Catchpoint 3 (returned from syscall openat), 0x00007ffff7fe9fe5 in __open_nocancel ()
   from /nix/store/57iz36553175g3178pvxjij8z5rcsd4n-glibc-2.42-61/lib/ld-linux-x86-64.so.2
=> 0x00007ffff7fe9fe5 <__open_nocancel+53>:	48 3d 00 f0 ff ff  	cmp    rax,0xfffffffffffff000
0x555555590410:	"/nix/store/grqrvcq4hm159fk80w93hnvwsf2z3giq-libwebsockets-4.4.5/lib/libwebsockets-evlib_uv.so"
[2026/06/18 11:07:57:0313] N: lws_create_context: LWS: 4.4.5-no_hash, NET CLI SRV H1 H2 WS SS-JSON-POL ConMon IPV6-off
[...omitted...]

Things done

Footnotes

  1. https://github.com/NixOS/nixpkgs/pull/529620

  2. https://github.com/NixOS/nixpkgs/issues/532638

  3. https://github.com/warmcat/libwebsockets/commit/bdbebaa3b5f89bd31128fceb72a4133c0a2f738d

@hmenke

hmenke commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

CI is broken

error: hash mismatch importing path '/nix/store/bl7rmhhsy7vjb9qm3jfwgqpv3cn7wfb1-openssl-3.6.2';
         specified: sha256:0nagwij5x8yi54380yw53xy1ksn9jclp98lxmizbqq6hgngqp553
         got:       sha256:1fypgxjwksn6kh2ig4fmaskfnflicjq60zf5il2s9nxblhkkvnww
error: path '/nix/store/bl7rmhhsy7vjb9qm3jfwgqpv3cn7wfb1-openssl-3.6.2' is required, but there is no substituter that can build it
error: some references of path '/nix/store/1l1z8rijqrx212nmb5sg5i8qd0xlnvzv-aws-c-auth-0.9.1' could not be realised
error: some references of path '/nix/store/2ng3ispf6dv39z2c8zx59x501admnhp7-libgit2-1.9.4-lib' could not be realised
error: some references of path '/nix/store/481q36wnk0awcbfhaqz44579bqm60hfk-nix-util-2.34.7' could not be realised
error: some references of path '/nix/store/6qk7ai1w44gvxcmy1788nwd645im5yph-nix-2.34.7' could not be realised
error: some references of path '/nix/store/sdkw9bldrvr3ka9sr2yaz0mpdhbc4p38-nix-2.34.7' could not be realised
error: some substitutes for the outputs of derivation '/nix/store/pazj44al4mxdab3hi9y2j2c3klg054nm-nix-2.34.7.drv' failed (usually happens due to networking issues); try '--fallback' to build derivation from source
error: Cannot build '/nix/store/75prz4fmicds1fa2x725prkp5dnd4nnb-attrpaths-superset.json.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/dj5f2f38idpamis5jr4aqlz6baryrm68-attrpaths-superset.json
error: Cannot build '/nix/store/mnkq3225kz7841v5qzyf6hzdxf3vly6q-nixpkgs-eval-x86_64-linux.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/c5lqfc5n9qcwdr4cqq3b6v60siw3navw-nixpkgs-eval-x86_64-linux
error: Build failed due to failed dependency

@hmenke hmenke requested review from MiniHarinn and sectore June 18, 2026 09:13
@drupol

drupol commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

We can safely ignore the CI failures because of NixOS/hydra#1804.

I just ran a nixpkgs-review, I'll merge it when it is done.

@hmenke hmenke requested a review from dotlambda June 18, 2026 09:14

@dotlambda dotlambda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test we could add to make sure this doesn't break again?

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". labels Jun 18, 2026
@sectore

sectore commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Thanks. It works. Test project to verify sectore/timr-tui#213

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Jun 18, 2026
@drupol

This comment was marked as resolved.

@nixpkgs-ci nixpkgs-ci Bot requested a review from Mindavi June 18, 2026 19:25
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Jun 18, 2026
The update of libwebsockets from 4.4.1 to 4.4.5[^1] introduced a regression where
plugins could no longer be found.[^2]  This could be traced back to a change in
how the installation directory is computed since libwebsockets 4.4.2[^3] and we
patch it here with the correct path.

Fixes NixOS#532638

[^1]: NixOS#529620
[^2]: NixOS#532638
[^3]: warmcat/libwebsockets@bdbebaa

@iblech iblech left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, very much appreciated! I was just bitten by this. I confirm that your fix works and I would merge this if I had the permissions.

@Mindavi Mindavi added this pull request to the merge queue Jul 2, 2026
@Mindavi

Mindavi commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Sorry for leaving this hanging, didn't notice it wasn't merged yet. It looks good.

Can we upstream this, or a more universal patch? Downstream patching is never preferred.

Merged via the queue into NixOS:master with commit 862f55c Jul 2, 2026
27 checks passed
@hmenke

hmenke commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

warmcat/libwebsockets#3623, but they have already ignored my previous PR warmcat/libwebsockets#3567 so I don't think this will ever be upstreamed.

@hmenke hmenke deleted the libwebsockets branch July 2, 2026 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vhs: recording failed (ttyd: navigation failed)

7 participants