Source: singularity-container
Version: 2.4-1
Severity: serious
Tags: sid buster patch

Hi,

singularity-container FTBFS on mips* with the error:
> In file included from mnt.c:41:0:
> ../../../../../src/util/setns.h:46:4: error: #error Please determine the 
> syscall number for setns on your architecture
>  #  error Please determine the syscall number for setns on your architecture
>     ^~~~~

This error happens because the setns.h header requires a __NR_setns
define for each architecture. However, this define is never used in the
case where glibc provides a setns function (as is the case for all
architectures in buster).

The attached "setns-syscall-nr.patch" patch fixes this by moving the
__NR_setns ifdefs into setns.c so it is only used in the case where
setns is not provided by libc.

After doing this, the package FTBFS again in a different way:
> util/signal.c:39:5: error: 'SIGSTKFLT' undeclared here (not in a function); 
> did you mean 'SIGSTKSZ'?
>      SIGSTKFLT,
>      ^~~~~~~~~
>      SIGSTKSZ

The SIGSTKFLT signal is not defined on mips (and a few other
architectures). This is fixed by the "maybe-sigstkflt.patch" patch which
only adds this signal to the all_signals list if it is defined.

Thanks,
James
--- a/src/util/signal.c
+++ b/src/util/signal.c
@@ -36,7 +36,9 @@ static const int all_signals[] = {
     SIGPIPE,
     SIGALRM,
     SIGTERM,
+#ifdef SIGSTKFLT
     SIGSTKFLT,
+#endif
     SIGCHLD,
     SIGCONT,
     SIGTSTP,
--- a/src/util/setns.c
+++ b/src/util/setns.c
@@ -21,7 +21,29 @@
 
 #if defined (NO_SETNS) && defined (SETNS_SYSCALL)
 
-#include "util/setns.h"
+#ifndef __NR_setns
+#  if defined (__x86_64__)
+#    define __NR_setns 308
+#  elif defined (__i386__)
+#    define __NR_setns 346
+#  elif defined (__alpha__)
+#    define __NR_setns 501
+#  elif defined (__arm__)
+#    define __NR_setns 375
+#  elif defined (__aarch64__)
+#    define __NR_setns 375
+#  elif defined (__ia64__)
+#    define __NR_setns 1330
+#  elif defined (__sparc__)
+#    define __NR_setns 337
+#  elif defined (__powerpc__)
+#    define __NR_setns 350
+#  elif defined (__s390__)
+#    define __NR_setns 339
+#  else
+#    error Please determine the syscall number for setns on your architecture
+#  endif
+#endif
 
 int setns(int fd, int nstype) {
     return syscall(__NR_setns, fd, nstype);
--- a/src/util/setns.h
+++ b/src/util/setns.h
@@ -16,34 +16,6 @@
 #ifndef __SETNS_H_
 #define __SETNS_H_
 
-#ifndef __NR_setns
-#  if defined (__x86_64__)
-#    define __NR_setns 308
-#  elif defined (__i386__)
-#    define __NR_setns 346
-#  elif defined (__alpha__)
-#    define __NR_setns 501
-#  elif defined (__arm__)
-#    define __NR_setns 375
-#  elif defined (__aarch64__)
-#    define __NR_setns 375
-#  elif defined (__ia64__)
-#    define __NR_setns 1330
-#  elif defined (__sparc__)
-#    define __NR_setns 337
-#  elif defined (__powerpc__)
-#    define __NR_setns 350
-#  elif defined (__s390__)
-#    define __NR_setns 339
-#  endif
-#endif
-
-#ifdef __NR_setns
-
 extern int setns(int fd, int nstype);
 
-#else /* !__NR_setns */
-#  error Please determine the syscall number for setns on your architecture
-#endif
-
 #endif /* __SETNS_H_ */

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to