Commit Graph

45 Commits

Author SHA1 Message Date
Alyssa Ross
1a60dd2adc
Merge remote-tracking branch 'nixpkgs/staging-next' into staging
Conflicts:
	pkgs/development/python-modules/cupy/default.nix
	pkgs/development/python-modules/staticjinja/default.nix
2022-01-24 15:39:34 +00:00
Jonathan Ringer
4bde5a3a68
libredirect: fix build for aarch64-darwin (PR #156460) 2022-01-24 12:20:51 +01:00
Robert Scott
86783a69c2 libredirect: add support for mktemp 2022-01-18 20:20:29 +00:00
Robert Scott
d38832ace0 libredirect: add support for mkdtemp 2022-01-18 20:20:28 +00:00
Robert Scott
2185a70fa4 libredirect: add support for mkstemp family of functions 2022-01-18 20:20:28 +00:00
Robert Scott
b3a7dc22d1 libredirect: add support for unlink, unlinkat, rmdir
add coverage of these and mkdir functions in tests
2022-01-18 20:20:27 +00:00
Jörg Thalheim
37ed2951d2
libredirect: improve musl support (#154039)
__nss_files_open is glibc only. Also mark some linux specific system
calls as such for better portability with other unixes.
2022-01-12 01:35:23 -05:00
Jan Tojnar
f7aa55946b Merge branch 'staging-next' into staging
; Conflicts:
;	nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
;	nixos/doc/manual/release-notes/rl-2205.section.md
;	pkgs/build-support/libredirect/default.nix
2022-01-10 01:26:05 +01:00
Dmitry Bogatov
17577f6b54
pkgsStatic.libredirect: print error message why it won't work
The whole point of libredirect is manipulation with LD_PRELOAD, which is not
supposed to work on static builds.
2022-01-08 14:14:35 +00:00
Moritz Angermann
38377ab026
libredirect: build fat library for x86_64, arm64, arm64e on darwin (#153441)
macOS's dyld can be rather picky as to what dylib it accepts. This
even changes across macOS versions. Therefore we now build a fat
dylib with all three architectures (x86_64, arm64, arm64e). This
should then be compatible with pretty much any macOS's dyld.
2022-01-07 18:32:21 -05:00
Ryan Burns
830900ff6a libredirect: fix musl build 2021-12-30 15:29:30 -08:00
Stéphan Kochen
7acc0e054c libredirect: workaround dyld env not inherited 2021-11-05 20:47:11 +01:00
Stéphan Kochen
d1a3b5c4cc libredirect: use __interpose on darwin
DYLD_FORCE_FLAT_NAMESPACE was removed in recent versions of macOS.
2021-11-05 08:24:22 +01:00
Bjørn Forsman
864f96cd7f libredirect: handle mkdir(2) + mkdirat(2)
Fixes https://github.com/NixOS/nixpkgs/issues/140735.

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2021-10-09 19:58:45 +02:00
Pascal Bach
fc5196c2f0 libredirect: add subprocess test 2021-09-03 23:45:46 +02:00
Niklas Hambüchen
4961547d05 libredirect: Fix redirects not working for subprocesses 2021-09-03 22:26:22 +02:00
Niklas Hambüchen
0afbd6c86a libredirect: Enable debug symbols 2021-09-03 22:26:21 +02:00
Niklas Hambüchen
5ca0265505 libredirect: Add missing phase hooks 2021-09-03 22:26:20 +02:00
Felix Buehler
6f04cd0e69 application/development: /s/name/pname&version/ 2021-06-30 09:55:22 +02:00
Matt Christ
a9b7300f6f brscan5: init at 1.2.6-0 2021-05-21 12:59:30 -05:00
Pavol Rusnak
90f7338112
treewide: stdenv.lib -> lib 2021-01-24 01:49:49 +01:00
Maximilian Bosch
25e60944c6
python3Packages.python-engineio: fix build w/glibc-2.32
Also had to wrap `__nss_files_fopen` in `libredirect` as this is the way
now `nss` uses to retrieve file-databases[1].

[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=299210c1fa67e2dfb564475986fce11cd33db9ad;hp=469c03907b116c37c98d8ad7a9edac2bdbf3e934
2020-09-12 23:04:50 +02:00
Mario Rodas
c3ccac15eb
libredirect: fix build on darwin
Fix build failure on darwin due to absence of `O_TMPFILE`.
2020-01-23 20:20:20 -05:00
Demin Dmitriy
b6e37c3146 libredirect: fix access return type
`access` should return `int` not `int*`. Actually compiler produced
identical assembly with any of those types, so by luck it "just worked".
2019-11-12 04:29:11 +03:00
Demin Dmitriy
6432f92e42 libredirect: fix argument forwarding in open* functions
Flag `O_TMPFILE` was added in Linux 3.11. It affects whether or not
`mode` argument should be passed.
2019-11-12 04:29:11 +03:00
Maximilian Bosch
a3667ee6be
libredirect: add posix_spawnp support
After bumping sublime3 in #61636 we realized that saving files as root
doesn’t work anymore and somehow the paths weren’t patched by
`libredirect`.

After some debugging it came out that Sublime switched from `posix_spawn(3)`
to `posix_spawnp(3)` to start new processes internally. Since `libredirect`
only handled the former, `/usr/bin/pkexec` stopped being redirected.

Wrapping `posix_spawnp` fixes the problem.
2019-06-18 22:47:11 +02:00
Jan Tojnar
a0c6efb9fd
libredirect: remove dlopen support
While it might be useful in some cases, there are too many caveats to be worth it.
When libredirect intercepts dlopen call and calls the original function, the dynamic
loader will use libredirect.so's DT_RUNPATH entry instead of the one from the ELF file
the dlopen call originated from. That means that when program tries to dlopen a library
that it expects to find on its RPATH, the call will fail.
This broke Sublime Text for just that reason.
2019-05-04 05:53:18 +02:00
Jan Tojnar
90f3a237eb
libredirect: add support for openat and dlopen
gobject-introspection uses glib’s g_module_open function, which in turn relies
on dlopen. I also implemented openat, since I initially thought this function
was used but turns out dlopen uses the openat signal directly. We might as
well keep it, even thought I do not need it at the moment.
2019-04-20 03:09:17 +02:00
zimbatm
d04a1265a1
libredirect: set install_name on Darwin
fixes https://github.com/NixOS/nixpkgs/pull/50246#issuecomment-437975038
2018-11-14 00:05:26 +01:00
zimbatm
91c130e2f5
libredirect: introduce optional setup-hook
This allows to simplify the usage of libredirect inside of nix build
sandboxes. Add "libredirect.hook" to the build inputs to get everything
linked in automaticall. All that's left is to set NIX_REDIRECTS and call
the target program.
2018-11-14 00:05:23 +01:00
zimbatm
e62db105c4
libredirect: specify libName
reduces a bit of duplication and can also be used from the outside:

   export LD_PRELOAD=${libredirect}/lib/${libredirect.libName}
2018-11-13 12:26:15 +01:00
aszlig
a815f53c60
libredirect: Add preload wrapper for stat()
Pull request #50246 was merged a bit too quickly and it was supposed to
fix libredirect on Darwin. However it still failed on Darwin and this
was missed by the person merging the pull request.

The reason this was failing was that there is no __xstat* on Darwin.

So I'm adding a wrapper for stat() as well as it works on Darwin and it
still doesn't hurt on GNU/Linux.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @edolstra, @zimbatm
2018-11-12 13:31:43 +01:00
aszlig
34dd1c68f8
libredirect: Add a small test
This is just a sanity check on whether the library correctly wraps the
syscalls and it's using the "true" executable for posix_spawn() and
execv().

The installCheckPhase is not executed if we are cross-compiling, so this
shouldn't break cross-compilation.

One thing I'm not actually sure is whether ${coreutils}/bin/true is
universally available on all the platforms, nor whether all the
functions we use in the test are available, but we can still fix that
after we've found out about that.

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-12 11:02:54 +01:00
aszlig
ba1fddb315
libredirect: Use extensions.sharedLibrary
This is to make sure we get the correct shared library suffix of the
target platform. While for example on Darwin it would even work with the
hardcoded .so prefix it's IMHO a bit nicer to have the actual native
extension.

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-12 10:08:02 +01:00
zimbatm
9ef52352bd
assume that it works on all unix platforms 2018-11-12 00:09:36 +01:00
zimbatm
d76ec523bb
use for cross-compilation 2018-11-12 00:08:18 +01:00
aszlig
753743c37b
libredirect: Add support for Darwin
The library can be used also on Darwin using it like this:

  NIX_REDIRECTS='foo=bar' \
  DYLD_INSERT_LIBRARIES=${libredirect}/lib/libredirect.so \
  DYLD_FORCE_FLAT_NAMESPACE=1 \
  some_program

So let's actually not hardcade gcc and add Darwin to meta.platforms.

No other changes seem to be required.

Signed-off-by: aszlig <aszlig@nix.build>
2018-11-11 19:29:12 +01:00
Orivej Desh
76a97fdb31 libredirect: add description
Fixes #32675
2017-12-14 19:03:35 +00:00
michael bishop
5677ce2008
libredirect: allow null paths 2017-05-24 11:29:06 -03:00
Tuomas Tynkkynen
2258b21e4b treewide: Add lots of platforms to packages with no meta
Build-tested on x86_64 Linux and on Darwin.
2016-08-02 21:17:44 +03:00
obadz
fb6b4860c7 xl2tpd: add nixos module for service
(required adding execv to libredirect)
2016-06-20 21:41:59 +01:00
obadz
972381b66a citrix-receiver: init at 13.2.1, fixes #8458 2015-11-11 22:27:15 +01:00
Demin Dmitriy
0cea20a652 libredirect: add __xlib64 and posix_spawn 2015-10-24 18:04:33 +03:00
Longrin Wischnewski
19f0b18b99 libredirect: add access syscall 2015-01-20 18:52:37 +01:00
Eelco Dolstra
a0072b4d2d hipchat: Fix access to /usr/share/X11/xkb
HipChat (or rather its copy of Qt) expects to find keyboard data in
/usr/share/X11/xkb. So use a LD_PRELOAD library to intercept and
rewrite the Glibc calls that access those paths. We've been doing the
same thing with packages like Spotify, but now this functionality has
been abstracted into a reusable library, libredirect.so. It uses an
environment variable $NIX_REDIRECTS containing a colon-separated list
of path prefixes to be rewritten, e.g. "/foo=bar:/xyzzy=/fnord".
2014-05-27 01:06:54 +02:00