Okay, I dug deeper yesterday and have made some more progress on this issue.

I downloaded the tarball specified in the iproute2 package, unpacked it, and 
reviewed its build scripts. From what I can tell, there is an error in the 
#:make-flags argument in the current Guix iproute2 package. Specifically, the 
HDRDIR and CONFDIR flags are incorrectly set currently. According the Makefile 
in that package, HDRDIR should be #$output/include/iproute2 and CONFDIR should 
be #$output/etc/iproute2. The Guix package has HDRDIR set to #$output/include 
and CONFDIR set to #$output/etc.

This is the reason that /etc in the Guix shell container is polluted with the 
iproute2 package's config files. The error that I originally reported is 
happening because /etc/iproute2/group is being placed in /etc/group, thus 
conflicting with the real /etc/group file that is placed there by `guix shell 
--container` and `guix shell --container --emulate-fhs`. Note that 
/etc/iproute2/group is NOT a valid substitute for /etc/group. It lists 
configured network devices, not Unix user groups.

So...we need a patch for the iproute2 package to fix these #:make-flags. Here 
is my currently working package with those flags corrected for reference.

;;=====================================================================================================

(define-module (lambdatronic iproute)
  #:use-module ((gnu packages linux) #:select (iproute))
  #:use-module ((guix gexp)          #:select (gexp))
  #:use-module ((guix packages)      #:select (package package-arguments))
  #:use-module ((guix utils)         #:select (cc-for-target))
  #:use-module ((srfi srfi-1)        #:select (take-while drop-while)))

(define-public iproute-patched
  (package
   (inherit iproute)
   (name "iproute2-patched")
   (arguments (let* ((old-args       (package-arguments iproute))
                     (head           (take-while (lambda (arg) (not (eq? arg 
#:make-flags))) old-args))
                     (tail           (drop-while (lambda (arg) (not (eq? arg 
#:make-flags))) old-args))
                     (new-make-flags (list #:make-flags
                                           #~(let ((out #$output))
                                               (list (string-append "CC=" 
#$(cc-for-target))
                                                     "HOSTCC=gcc"
                                                     (string-append 
"BASH_COMPDIR=" out
                                                                    
"/etc/bash_completion.d")
                                                     (string-append "LIBDIR=" 
out "/lib")
                                                     (string-append "HDRDIR=" 
out "/include/iproute2")
                                                     (string-append "SBINDIR=" 
out "/sbin")
                                                     (string-append "CONFDIR=" 
out "/etc/iproute2")
                                                     (string-append "MANDIR=" 
out "/share/man"))))))
                (append head
                        new-make-flags
                        (cddr tail))))))

;;=====================================================================================================

As you can see, this package can be included in an --emulate-fhs container:

;;=====================================================================================================

$ guix shell -CFN coreutils iproute2-patched -- cat /etc/group
users:x:998:
overflow:x:65534:

;;=====================================================================================================

Thanks, Guix!
  Gary

-- 
GPG Key ID: C4FBEDBD
Use `gpg --search-keys [email protected]' to find me
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Reply via email to