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

cannot load linked haskell libraries in postswitch script when run from udev rule #344

Open
ndwarshuis opened this issue Apr 20, 2023 · 0 comments

Comments

@ndwarshuis
Copy link

This may or may not be a bug in autorandr.

Minimal example, I have a postswtich script that looks like this:

#!/bin/bash

ldd /usr/bin/dhall-to-yaml > /tmp/autorandr.log 2>&1
ldd /usr/bin/conky >> /tmp/autorandr.log 2>&1

For context, I want to restart conky when connecting monitors, and my conky config calls dhall-to-yaml as part of the startup process. Conky doesn't actually start because dhall-to-yaml throws an error (as explained below).

When disconnecting a monitor manually (and thus invoking the udev rule which in turn triggers autorandr to run in --batch mode), this is the output:

/usr/bin/dhall-to-yaml: error while loading shared libraries: libHSrts-ghc9.0.2.so: cannot enable executable stack as shared object requires: Operation not permitted
        linux-vdso.so.1 (0x00007fff591a0000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fba04c64000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x00007fba04c4f000)
        liblua.so.5.4 => /usr/lib/liblua.so.5.4 (0x00007fba04c0a000)
        libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00007fba04c05000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fba04b1d000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fba04800000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fba04afb000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fba04619000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fba04ad0000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fba04e89000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fba04acb000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fba04ac3000)

This permission error doesn't happen when invoking autorandr manually from a shell.

If this is an autorandr bug, it might have something to do with the user environment not being copied correctly when running --batch mode. For whatever reason this only seems to apply to haskell libraries (eg it fails for the haskell program but not the C program).

Other context:

  • OS = arch linux
  • autorandr version = 1.13.3
  • dhall-to-yaml is installed as an Arch package (which uses dynamic linking)
  • I'm not running SELinux/apparmor (the only other things I could find that lead to this 'operation not permitted' behavior)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant