Package: src:cpm
Version: 0.28-1
Severity: serious
Tags: upstream patch
Justification: fails to build from source (but built successfully in the past)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

cpm fails to build from source [1] on SPARC and SPARC64 do to upstream commit
2ba8958a7c. As that commit was needed to build on kFreeBSD, my guess is
that a check should be implemented to see if PT_SYSCALL is defined and if
not use PTRACE_SYSCALL. Be aware, I have no idea what I am doing code-wise
here, but the package builds on SPARC (porterbox) with the attached patch
applied.

Paul

[1] 
https://buildd.debian.org/status/fetch.php?pkg=cpm&arch=sparc&ver=0.28-1&stamp=1368555383
security.c:531:26: error: 'PT_SYSCALL' undeclared (first use in this function)

- -- System Information:
Debian Release: 7.3
  APT prefers stable
  APT policy: (500, 'stable'), (99, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBCAAGBQJSycBMAAoJEJxcmesFvXUKzacH/j0edA2kNxPNI2L26MY2hhyO
AykzdWDbevtWXgt64gDLmBJ4dSYAYmwDn6xcyqkF+9OjX/KeXxiUVo6h7QulLH/1
S3ibxFsDHXZC90BuquNOQPlyCjQmqJK6/59bwTJXhlgr3stW+qP1E7KQYTba9rhA
mCgJJHCmqn4yFXKaXZ0WHrfrGwcaUCQ4ZwTaSfi52PMF4x2HXWMkdP+mBabJcYzp
pdRV/joRCfPwyhGVcdO7YnT/giRWgDEY113JxULhA8hegh/p6qLmaSToq/tGpWb6
NAdTgbuRQ/SKip46d/HVT7I3SCGVoa9bsb3lI/FLXDBCgL3pHxAtsk60g3/A54c=
=jEjt
-----END PGP SIGNATURE-----
Description: cpm fails to build on SPARC as PT_ATTACH/PT_SYSCALL is not available
 The original upstream implementation used PTRACE_ATTCACH/PTRACE_SYSCALL but
 that FTBFS on kFreeBSD. So apperently we need to check what we have
Author: Paul Gevers <elb...@debian.org>
Comment: Upstream commit is
 https://github.com/comotion/cpm/commit/2ba8958a7c935d96b4db183b70f6747ca8151b02

diff --git a/security.c b/security.c
index 4735636..7e4b6b2 100644
--- a/security.c
+++ b/security.c
@@ -521,14 +521,22 @@ int initSecurity(int* max_mem_lock, int* memory_safe, int* ptrace_safe,
            }
 #endif
 
+#if defined(PT_ATTACH)
            if (ptrace(PT_ATTACH, p0, 0, 0) != 0) {
+#else
+           if (ptrace(PTRACE_ATTACH, p0, 0, 0) != 0) {
+#endif
                // someone is already attached to us; shoot the parent in the head
                fprintf(stderr, "Can't attach to parent!\n");
                kill(p0, SIGKILL);
                _exit(1);
            }
            while (1) {
+#if defined(PT_SYSCALL)
                if(ptrace(PT_SYSCALL, p0, 0, 0) == 0)
+#else
+               if(ptrace(PTRACE_SYSCALL, p0, 0, 0) == 0)
+#endif
                    waitpid(p0, &status, 0);
                if(errno == ESRCH && kill(p0, 0) == -1)
                    exit(0); // parent is dead

Reply via email to