GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> ,import (srfi srfi-64)
scheme@(guile-user)> ,import (guix build syscalls)
scheme@(guile-user)> (match (clone (logior CLONE_NEWUSER SIGCHLD))
    (0 (primitive-exit 42))
    (pid
     ;; Check if user namespaces are different.
     (and (not (equal? (readlink (user-namespace pid))
                       (readlink (user-namespace (getpid)))))
          (match (waitpid pid)
            ((_ . status)
             (= 42 (status:exit-val status)))))))
While compiling expression:
Syntax error:
unknown file:50:13: _: bad use of '_' syntactic keyword in subform (_ . status) of (_ . status)
scheme@(guile-user)> 
scheme@(guile-user)> ,use (ice-9 match)
scheme@(guile-user)> (match (clone (logior CLONE_NEWUSER SIGCHLD))
    (0 (primitive-exit 42))
    (pid
     ;; Check if user namespaces are different.
     (and (not (equal? (readlink (user-namespace pid))
                       (readlink (user-namespace (getpid)))))
          (match (waitpid pid)
            ((_ . status)
             (= 42 (status:exit-val status)))))))
;;; <stdin>:83:34: warning: possibly unbound variable `user-namespace'
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: user-namespace

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,
q
;;; <stdin>:92:0: warning: possibly unbound variable `q'
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: q

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [4]> ,q
scheme@(guile-user) [3]> ,q
scheme@(guile-user) [2]> ,q
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> (use-modules (guix utils)                    
                                  (guix build syscalls)           
                                  (gnu build linux-container)     
                                  (srfi srfi-1)                   
                                  (srfi srfi-26)                  
                                  (srfi srfi-64)                  
                                  (srfi srfi-71)                  
                                  (system foreign)                
                                  ((ice-9 ftw) #:select (scandir))
                                  (ice-9 match)))                  
While reading expression:
#<unknown port>:132:50: unexpected ")"
scheme@(guile-user)> (use-modules (guix utils)                    
                                  (guix build syscalls)           
                                  (gnu build linux-container)     
                                  (srfi srfi-1)                   
                                  (srfi srfi-26)                  
                                  (srfi srfi-64)                  
                                  (srfi srfi-71)                  
                                  (system foreign)                
                                  ((ice-9 ftw) #:select (scandir))
                                  (ice-9 match))
scheme@(guile-user)> 
scheme@(guile-user)> 
scheme@(guile-user)> (match (clone (logior CLONE_NEWUSER SIGCHLD))
    (0 (primitive-exit 42))
    (pid
     ;; Check if user namespaces are different.
     (and (not (equal? (readlink (user-namespace pid))
                       (readlink (user-namespace (getpid)))))
          (match (waitpid pid)
            ((_ . status)
             (= 42 (status:exit-val status)))))))
;;; <stdin>:154:34: warning: possibly unbound variable `user-namespace'
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: user-namespace

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> (pk 'a)

;;; (a)
$7 = a
scheme@(guile-user)> ,a user-namespace
(gnu build linux-container): user-namespace-supported?  #<procedure user-namespace-supported? ()>
(gnu build linux-container): unprivileged-user-namespace-supported?     #<procedure unprivileged-user-namespace-supported? ()>
scheme@(guile-user)> (user-namespace-supported?)
$8 = #t
scheme@(guile-user)> (match (clone (logior CLONE_NEWUSER SIGCHLD))
    (0 (primitive-exit 42))
    (pid
     ;; Check if user namespaces are different.
     (and (not (equal? (readlink (user-namespace pid))
                       (readlink (user-namespace (getpid)))))
          (match (waitpid pid)
            ((_ . status)
             (= 42 (status:exit-val status)))))))
;;; <stdin>:219:34: warning: possibly unbound variable `user-namespace'
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: user-namespace

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> (define (user-namespace pid)
  (string-append "/proc/" (number->string pid) "/ns/user"))
scheme@(guile-user)> (match (clone (logior CLONE_NEWUSER SIGCHLD))
    (0 (primitive-exit 42))
    (pid
     ;; Check if user namespaces are different.
     (and (not (equal? (readlink (user-namespace pid))
                       (readlink (user-namespace (getpid)))))
          (match (waitpid pid)
            ((_ . status)
             (= 42 (status:exit-val status)))))))
$9 = #t
scheme@(guile-user)> 
scheme@(guile-user)> (catch 'system-error
    (lambda ()
      (match (clone (logior CLONE_NEWUSER SIGCHLD))
        (0
;         (gc)                           ;create a garbage collection thread
         (unshare CLONE_THREAD)
         (primitive-exit 0))
        (pid
         (match (waitpid pid)
           ((_ . status)
            (zero? status))))))
    (lambda args
      (system-error-errno args)))
;;; <stdin>:259:18: warning: possibly unbound variable `CLONE_THREAD'
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: CLONE_THREAD

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> ,re
While executing meta-command:
unknown file name for module #<directory (guile-user) 7f62e0aaec80>
scheme@(guile-user)> (catch 'system-error
    (lambda ()
      (match (clone (logior CLONE_NEWUSER SIGCHLD))
        (0
;         (gc)                           ;create a garbage collection thread
         (unshare CLONE_THREAD)
         (primitive-exit 0))
        (pid
         (match (waitpid pid)
           ((_ . status)
            (zero? status))))))
    (lambda args
      (system-error-errno args)))
;;; <stdin>:342:18: warning: possibly unbound variable `CLONE_THREAD'
$10 = 1
scheme@(guile-user)> (define CLONE_SIGHAND           #x00000800)
(define CLONE_THREAD         #x00010000)
(define CLONE_VM             #x00000100)

scheme@(guile-user)> (catch 'system-error
    (lambda ()
      (match (clone (logior CLONE_NEWUSER SIGCHLD))
        (0
;         (gc)                           ;create a garbage collection thread
         (unshare CLONE_THREAD)
         (primitive-exit 0))
        (pid
         (match (waitpid pid)
           ((_ . status)
            (zero? status))))))
    (lambda args
      (system-error-errno args)))
$11 = 1
scheme@(guile-user)> 
scheme@(guile-user)> (catch 'system-error
    (lambda ()
      (match (clone (logior CLONE_NEWUSER SIGCHLD))
        (0
         (gc)                           ;create a garbage collection thread
         (unshare CLONE_THREAD)
         (primitive-exit 0))
        (pid
         (match (waitpid pid)
           ((_ . status)
            (zero? status))))))
    (lambda args
      (system-error-errno args)))
$12 = 1
scheme@(guile-user)> 
scheme@(guile-user)> 
scheme@(guile-user)> 
scheme@(guile-user)> (catch 'system-error
    (lambda ()
      (match (clone (logior CLONE_NEWUSER SIGCHLD))
        (0
         (gc)                           ;create a garbage collection thread
         (sigaction SIGPIPE SIG_IGN)
         (unshare CLONE_THREAD)
         (primitive-exit 0))
        (pid
         (match (waitpid pid)
           ((_ . status)
            (zero? status))))))
    (lambda args
      (system-error-errno args)))
$13 = 1
scheme@(guile-user)> 
scheme@(guile-user)> 
scheme@(guile-user)> (catch 'system-error
    (lambda ()
      (match (clone (logior CLONE_NEWUSER SIGCHLD))
        (0
         (gc)                           ;create a garbage collection thread
         (sigaction SIGPIPE SIG_IGN)
         (unshare CLONE_THREAD)
         (primitive-exit 0))
        (pid
         (match (waitpid pid)
           ((_ . status)
            (zero? status))))))
    (lambda args
      (system-error-errno args)))

Generated by apteryx using scpaste at Fri Oct 17 21:00:07 2025. JST. (original)