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

mednaffe: 0.8 -> 0.8.6, drop autoreconfHook, drop g_strdup() from patch #29855

Merged
merged 1 commit into from Sep 28, 2017

Conversation

lukateras
Copy link
Member

@lukateras lukateras commented Sep 27, 2017

Motivation for this change

Hasn't been updated in a while, and g_strdup() in patch is not required.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@joachifm
Copy link
Contributor

cc @sheenobu

@lukateras lukateras changed the title mednaffe: 0.8 -> 0.8.6, drop patch in favor of autoreconfHook mednaffe: 0.8 -> 0.8.6, drop autoreconfHook, drop g_strdup() from patch Sep 28, 2017
@Mic92 Mic92 merged commit ea13049 into NixOS:master Sep 28, 2017
@AmatCoder
Copy link
Contributor

@yegortimoshenko
First, thanks for update this, really appreciated :)

But g_strdup() function was required because binpath is freed at shutdown and it can not be a literal but a allocated string (see #15688).
Alternatively you can remove any g_free(gui->binpath) from source.

Also, out of curiosity, why autoreconfHook? It does not seem necessary for release versions.

@lukateras
Copy link
Member Author

lukateras commented Sep 30, 2017

@AmatCoder Sorry for a subpar patch.

I can't reproduce this segfault with mednaffe, but can trigger it with this synthetic test:

$ cat segfault.c
#include <glib.h>

int main() {
  gchar *binpath = "hello";
  g_free(binpath);
}
$ nix-shell -p gcc glib pkgconfig --run 'gcc $(pkg-config --cflags --libs glib-2.0) segfault.c -o /tmp/segfault; /tmp/segfault'
*** Error in `/tmp/segfault': munmap_chunk(): invalid pointer: 0x00000000004007f4 ***
======= Backtrace: =========
/nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libc.so.6(+0x711e6)[0x7f88f21881e6]
/nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libc.so.6(+0x775c6)[0x7f88f218e5c6]
/tmp/segfault[0x400660]
/nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libc.so.6(__libc_start_main+0xf0)[0x7f88f2137560]
/tmp/segfault[0x40069a]
======= Memory map: ========
00400000-00401000 r-xp 00000000 00:16 11249                              /tmp/segfault
00600000-00601000 r--p 00000000 00:16 11249                              /tmp/segfault
00601000-00602000 rw-p 00001000 00:16 11249                              /tmp/segfault
02284000-022a5000 rw-p 00000000 00:00 0                                  [heap]
7f88f1a70000-7f88f1a86000 r-xp 00000000 00:16 549051                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libgcc_s.so.1
7f88f1a86000-7f88f1c85000 ---p 00016000 00:16 549051                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libgcc_s.so.1
7f88f1c85000-7f88f1c86000 rw-p 00015000 00:16 549051                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libgcc_s.so.1
7f88f1c86000-7f88f1c9f000 r-xp 00000000 00:16 549085                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libpthread-2.25.so
7f88f1c9f000-7f88f1e9e000 ---p 00019000 00:16 549085                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libpthread-2.25.so
7f88f1e9e000-7f88f1e9f000 r--p 00018000 00:16 549085                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libpthread-2.25.so
7f88f1e9f000-7f88f1ea0000 rw-p 00019000 00:16 549085                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libpthread-2.25.so
7f88f1ea0000-7f88f1ea4000 rw-p 00000000 00:00 0 
7f88f1ea4000-7f88f1f16000 r-xp 00000000 00:16 644786                     /nix/store/pd5c65d1d99hn33831lxmrgqhnxg7q6z-pcre-8.40/lib/libpcre.so.1.2.8
7f88f1f16000-7f88f2115000 ---p 00072000 00:16 644786                     /nix/store/pd5c65d1d99hn33831lxmrgqhnxg7q6z-pcre-8.40/lib/libpcre.so.1.2.8
7f88f2115000-7f88f2116000 r--p 00071000 00:16 644786                     /nix/store/pd5c65d1d99hn33831lxmrgqhnxg7q6z-pcre-8.40/lib/libpcre.so.1.2.8
7f88f2116000-7f88f2117000 rw-p 00072000 00:16 644786                     /nix/store/pd5c65d1d99hn33831lxmrgqhnxg7q6z-pcre-8.40/lib/libpcre.so.1.2.8
7f88f2117000-7f88f22ad000 r-xp 00000000 00:16 549037                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libc-2.25.so
7f88f22ad000-7f88f24ac000 ---p 00196000 00:16 549037                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libc-2.25.so
7f88f24ac000-7f88f24b0000 r--p 00195000 00:16 549037                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libc-2.25.so
7f88f24b0000-7f88f24b2000 rw-p 00199000 00:16 549037                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/libc-2.25.so
7f88f24b2000-7f88f24b6000 rw-p 00000000 00:00 0 
7f88f24b6000-7f88f25c7000 r-xp 00000000 00:16 4095                       /nix/store/imrm10f7byq5xwm1jkllzyr30g88q3bi-glib-2.52.3/lib/libglib-2.0.so.0.5200.3
7f88f25c7000-7f88f27c6000 ---p 00111000 00:16 4095                       /nix/store/imrm10f7byq5xwm1jkllzyr30g88q3bi-glib-2.52.3/lib/libglib-2.0.so.0.5200.3
7f88f27c6000-7f88f27c7000 r--p 00110000 00:16 4095                       /nix/store/imrm10f7byq5xwm1jkllzyr30g88q3bi-glib-2.52.3/lib/libglib-2.0.so.0.5200.3
7f88f27c7000-7f88f27c8000 rw-p 00111000 00:16 4095                       /nix/store/imrm10f7byq5xwm1jkllzyr30g88q3bi-glib-2.52.3/lib/libglib-2.0.so.0.5200.3
7f88f27c8000-7f88f27c9000 rw-p 00000000 00:00 0 
7f88f27c9000-7f88f27ec000 r-xp 00000000 00:16 549028                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/ld-2.25.so
7f88f29e6000-7f88f29ec000 rw-p 00000000 00:00 0 
7f88f29ec000-7f88f29ed000 r--p 00023000 00:16 549028                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/ld-2.25.so
7f88f29ed000-7f88f29ee000 rw-p 00024000 00:16 549028                     /nix/store/zpg78y1mf0di6127q6r51kgx2q8cxsvv-glibc-2.25-49/lib/ld-2.25.so
7f88f29ee000-7f88f29ef000 rw-p 00000000 00:00 0 
7ffdc0a17000-7ffdc0a3a000 rw-p 00000000 00:00 0                          [stack]
7ffdc0af9000-7ffdc0afb000 r--p 00000000 00:00 0                          [vvar]
7ffdc0afb000-7ffdc0afd000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
/run/user/1000/nix-shell.x5qcAd/rc: line 1:  8102 Aborted                 /tmp/segfault

Actually it makes sense to drop the patchPhase entirely and just wrap the executable with PATH pointing to mednafen. I'll open a new pull request, along with updating this derivation to GTK+3.

NixOS is a source-based distribution, so it makes sense to build everything from source, including build systems.

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

Successfully merging this pull request may close these issues.

None yet

4 participants