unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/4] gnu: Separate util-linux into three packages.
@ 2016-11-10 21:14 John Darrington
  2016-11-10 21:14 ` [PATCH 2/4] gnu: nfs-utils: Change input from util-linux to util-linux/mount John Darrington
                   ` (4 more replies)
  0 siblings, 5 replies; 32+ messages in thread
From: John Darrington @ 2016-11-10 21:14 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/linux.scm (util-linux/base): New variable,
(util-linux/mount): New variable,  (util-linux) Refine
inheriting from util-linux/base.
---
 gnu/packages/linux.scm | 69 ++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 55 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 73c177a..0a1eff5 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -430,15 +430,15 @@ use the proc file system.  We're not about changing the world, but
 providing the system administrator with some help in common tasks.")
     (license license:gpl2+)))
 
-(define-public util-linux
+(define-public util-linux/base
   (package
-    (name "util-linux")
+    (name "util-linux-base")
     (version "2.27")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://kernel.org/linux/utils/"
-                                  name "/v" (version-major+minor version) "/"
-                                  name "-" version ".tar.xz"))
+                                  "util-linux" "/v" (version-major+minor version) "/"
+                                  "util-linux" "-" version ".tar.xz"))
               (sha256
                (base32
                 "1ivdx1bhjbakf77agm9dn3wyxia1wgz9lzxgd61zqxw3xzih9gzw"))
@@ -453,8 +453,40 @@ providing the system administrator with some help in common tasks.")
                     (("build_kill=yes") "build_kill=no"))
                   #t))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after
+                      'install 'move-static-libraries
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out    (assoc-ref outputs "out"))
+                            (static (assoc-ref outputs "static")))
+                        (mkdir-p (string-append static "/lib"))
+                        (with-directory-excursion out
+                          (for-each (lambda (file)
+                                      (rename-file file
+                                                   (string-append static "/"
+                                                                  file)))
+                                    (find-files "lib" "\\.a$")))
+                        #t))))))
     (outputs '("out"
                "static"))      ; >2 MiB of static .a libraries
+    (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
+    (synopsis "Collection of utilities for the Linux kernel")
+    (description "Util-linux is a diverse collection of Linux kernel
+utilities.  It provides dmesg and includes tools for working with file systems,
+block devices, UUIDs, TTYs, and many other tools.")
+
+    ;; Note that util-linux doesn't use the same license for all the
+    ;; code.  GPLv2+ is the default license for a code without an
+    ;; explicitly defined license.
+    (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
+                   license:bsd-4 license:public-domain))))
+
+(define-public util-linux
+  (package
+    (inherit util-linux/base)
+    (name "util-linux")
+    (source (origin (inherit (package-source util-linux/base))))
     (arguments
      `(#:configure-flags (list "--disable-use-tty-group"
 
@@ -500,18 +532,27 @@ providing the system administrator with some help in common tasks.")
               ("ncurses" ,ncurses)))
     (native-inputs
      `(("perl" ,perl)
-       ("net-base" ,net-base)))                   ;for tests
-    (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
-    (synopsis "Collection of utilities for the Linux kernel")
+       ("net-base" ,net-base)))))                   ;for tests
+
+(define-public util-linux/mount
+  (package
+    (inherit util-linux/base)
+    (name "util-linux-mount")
+    (source (origin (inherit (package-source util-linux/base))))
+    (arguments
+     `(#:configure-flags (list "--disable-all-programs"
+                               "--disable-bash-completion"
+                               "--disable-nls"
+                               "--enable-libmount"
+                               "--enable-libblkid"
+                               "--enable-libuuid"
+                               "--enable-mount")
+       ,@(package-arguments util-linux/base)))
+    (synopsis "Mount/Umount utilities for the Linux kernel")
     (description "Util-linux is a diverse collection of Linux kernel
-utilities.  It provides dmesg and includes tools for working with file systems,
-block devices, UUIDs, TTYs, and many other tools.")
+utilities.  However, this is a minimally configured package providing just
+the @code{mount} and @code{umount} utilities.")))
 
-    ;; Note that util-linux doesn't use the same license for all the
-    ;; code.  GPLv2+ is the default license for a code without an
-    ;; explicitly defined license.
-    (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
-                   license:bsd-4 license:public-domain))))
 
 (define-public procps
   (package
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/4] gnu: nfs-utils: Change input from util-linux to util-linux/mount.
  2016-11-10 21:14 [PATCH 1/4] gnu: Separate util-linux into three packages John Darrington
@ 2016-11-10 21:14 ` John Darrington
  2016-11-10 21:14 ` [PATCH 3/4] gnu: Move util-linux/mount to new file and deal with the effects John Darrington
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: John Darrington @ 2016-11-10 21:14 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/nfs.scm (inputs): Remove util-linux, Add util-linux/mount.
---
 gnu/packages/nfs.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/nfs.scm b/gnu/packages/nfs.scm
index 650a2af..761b19c 100644
--- a/gnu/packages/nfs.scm
+++ b/gnu/packages/nfs.scm
@@ -99,7 +99,7 @@
               ("sqlite" ,sqlite)
               ("lvm2" ,lvm2)
               ("gss" ,gss)
-              ("util-linux" ,util-linux)
+              ("util-linux" ,util-linux/mount)
               ("mit-krb5" ,mit-krb5)
               ("libtirpc" ,libtirpc)))
     (native-inputs
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/4] gnu: Move util-linux/mount to new file and deal with the effects.
  2016-11-10 21:14 [PATCH 1/4] gnu: Separate util-linux into three packages John Darrington
  2016-11-10 21:14 ` [PATCH 2/4] gnu: nfs-utils: Change input from util-linux to util-linux/mount John Darrington
@ 2016-11-10 21:14 ` John Darrington
  2016-11-10 21:14 ` [PATCH 4/4] Add fs-search paths to util-linux John Darrington
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: John Darrington @ 2016-11-10 21:14 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/linux-base.scm: New file.
* gnu/local.mk: Add it.
* gnu/packages/linux.scm (util-linux/base util-linux/mount lvm2 eudev procps kmod): Remove.
* gnu/packages/admin.scm: Use module linux-base.
* gnu/packages/bash.scm: Use module linux-base.
* gnu/packages/guile.scm: Use module linux-base.
* gnu/packages/linux-base.scm: Use module linux-base.
* gnu/packages/linux.scm: Use module linux-base.
* gnu/packages/nfs.scm: Use module linux-base.
* gnu/packages/texinfo.scm: Use module linux-base.
* gnu/packages/tls.scm: Use module linux-base.
---
 gnu/local.mk                |   1 +
 gnu/packages/admin.scm      |   1 +
 gnu/packages/bash.scm       |   1 -
 gnu/packages/guile.scm      |   2 +-
 gnu/packages/linux-base.scm | 296 ++++++++++++++++++++++++++++++++++++++++++++
 gnu/packages/linux.scm      | 292 +------------------------------------------
 gnu/packages/nfs.scm        |  32 ++++-
 gnu/packages/texinfo.scm    |   3 +-
 gnu/packages/tls.scm        |   1 +
 9 files changed, 334 insertions(+), 295 deletions(-)
 create mode 100644 gnu/packages/linux-base.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index b3a4cd5..16c337a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -224,6 +224,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/lighting.scm                     \
   %D%/packages/links.scm			\
   %D%/packages/linux.scm			\
+  %D%/packages/linux-base.scm			\
   %D%/packages/lirc.scm				\
   %D%/packages/lisp.scm				\
   %D%/packages/llvm.scm				\
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 77432c4..7af79f1 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -46,6 +46,7 @@
   #:use-module (gnu packages cyrus-sasl)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages linux-base)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages guile)
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index f3d8517..6c3c0ba 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -24,7 +24,6 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages bison)
-  #:use-module (gnu packages linux)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index f712514..8b17aeb 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -36,7 +36,7 @@
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages libunistring)
-  #:use-module (gnu packages linux)
+  #:use-module (gnu packages linux-base)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages pkg-config)
diff --git a/gnu/packages/linux-base.scm b/gnu/packages/linux-base.scm
new file mode 100644
index 0000000..4a11397
--- /dev/null
+++ b/gnu/packages/linux-base.scm
@@ -0,0 +1,296 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 John Darrington <jmd@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages linux-base)
+  #:use-module (gnu packages)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages gperf)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (guix utils))
+
+(define-public util-linux/base
+  (package
+    (name "util-linux-base")
+    (version "2.27")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://kernel.org/linux/utils/"
+                                  "util-linux" "/v" (version-major+minor version) "/"
+                                  "util-linux" "-" version ".tar.xz"))
+              (sha256
+               (base32
+                "1ivdx1bhjbakf77agm9dn3wyxia1wgz9lzxgd61zqxw3xzih9gzw"))
+              (patches (search-patches "util-linux-tests.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; We take the 'logger' program from GNU Inetutils and 'kill'
+               ;; from GNU Coreutils.
+               '(begin
+                  (substitute* "configure"
+                    (("build_logger=yes") "build_logger=no")
+                    (("build_kill=yes") "build_kill=no"))
+                  #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after
+                      'install 'move-static-libraries
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out    (assoc-ref outputs "out"))
+                            (static (assoc-ref outputs "static")))
+                        (mkdir-p (string-append static "/lib"))
+                        (with-directory-excursion out
+                          (for-each (lambda (file)
+                                      (rename-file file
+                                                   (string-append static "/"
+                                                                  file)))
+                                    (find-files "lib" "\\.a$")))
+                        #t))))))
+    (outputs '("out"
+               "static"))      ; >2 MiB of static .a libraries
+    (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
+    (synopsis "Collection of utilities for the Linux kernel")
+    (description "Util-linux is a diverse collection of Linux kernel
+utilities.  It provides dmesg and includes tools for working with file systems,
+block devices, UUIDs, TTYs, and many other tools.")
+
+    ;; Note that util-linux doesn't use the same license for all the
+    ;; code.  GPLv2+ is the default license for a code without an
+    ;; explicitly defined license.
+    (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
+                   license:bsd-4 license:public-domain))))
+
+(define-public util-linux/mount
+  (package
+    (inherit util-linux/base)
+    (name "util-linux-mount")
+    (source (origin (inherit (package-source util-linux/base))))
+    (arguments
+     `(#:configure-flags (list "--disable-all-programs"
+                               "--disable-bash-completion"
+                               "--disable-nls"
+                               "--enable-libmount"
+                               "--enable-libblkid"
+                               "--enable-libuuid"
+                               "--enable-mount")
+       ,@(package-arguments util-linux/base)))
+    (synopsis "Mount/Umount utilities for the Linux kernel")
+    (description "Util-linux is a diverse collection of Linux kernel
+utilities.  However, this is a minimally configured package providing just
+the @code{mount} and @code{umount} utilities.")))
+
+(define-public lvm2
+  (package
+    (name "lvm2")
+    (version "2.02.166")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
+                                  version ".tgz"))
+              (sha256
+               (base32
+                "150v0mawd2swdvypcmkjd3h3s4n5i1220h6sxx94a8jvp1kb0871"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (use-modules (guix build utils))
+
+                  ;; Honor sysconfdir.
+                  (substitute* "make.tmpl.in"
+                    (("confdir = .*$")
+                     "confdir = @sysconfdir@\n")
+                    (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
+                     "DEFAULT_SYS_DIR = @sysconfdir@"))))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("procps" ,procps)))                       ;tests use 'pgrep'
+    (inputs
+     `(("udev" ,eudev)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'set-makefile-shell
+           (lambda _
+             ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
+             ;; expected.
+             (setenv "SHELL" (which "sh"))
+
+             ;; Replace /bin/sh with the right file name.
+             (patch-makefile-SHELL "make.tmpl")
+             #t))
+         (add-before 'strip 'make-objects-writable
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Make compiled objects writable so they can be stripped.
+             (let ((out (assoc-ref outputs "out")))
+               (for-each (lambda (file)
+                           (chmod file #o755))
+                         (append
+                           (find-files (string-append out "/lib"))
+                           (find-files (string-append out "/sbin"))))
+               #t))))
+
+       #:configure-flags (list (string-append "--sysconfdir="
+                                              (assoc-ref %outputs "out")
+                                              "/etc/lvm")
+                               "--enable-udev_sync"
+                               "--enable-udev_rules"
+
+                               ;; Make sure programs such as 'dmsetup' can
+                               ;; find libdevmapper.so.
+                               (string-append "LDFLAGS=-Wl,-rpath="
+                                              (assoc-ref %outputs "out")
+                                              "/lib"))
+
+       ;; The tests use 'mknod', which requires root access.
+       #:tests? #f))
+    (home-page "http://sourceware.org/lvm2/")
+    (synopsis "Logical volume management for Linux")
+    (description
+     "LVM2 is the logical volume management tool set for Linux-based systems.
+This package includes the user-space libraries and tools, including the device
+mapper.  Kernel components are part of Linux-libre.")
+
+    ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
+    ;; Command-line tools are GPLv2.
+    (license (list license:gpl2 license:lgpl2.1))))
+
+(define-public eudev
+  ;; The post-systemd fork, maintained by Gentoo.
+  (package
+    (name "eudev")
+    (version "3.1.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://dev.gentoo.org/~blueness/eudev/eudev-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "0akg9gcc3c2p56xbhlvbybqavcprly5q0bvk655zwl6d62j8an7p"))
+              (patches (search-patches "eudev-rules-directory.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("perl" ,perl)
+       ("gperf" ,gperf)))
+    (inputs
+     ;; When linked against libblkid, eudev can populate /dev/disk/by-label
+     ;; and similar; it also installs the '60-persistent-storage.rules' file,
+     ;; which contains the rules to do that.
+     `(
+       ("util-linux" ,util-linux/mount)                 ;for blkid
+       ("kmod" ,kmod)))
+    (home-page "https://wiki.gentoo.org/wiki/Project:Eudev")
+    (synopsis "Userspace device management")
+    (description "Udev is a daemon which dynamically creates and removes
+device nodes from /dev/, handles hotplug events and loads drivers at boot
+time.")
+    (license license:gpl2+)))
+
+
+(define-public procps
+  (package
+    (name "procps")
+    (version "3.3.11")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/procps-ng/Production/"
+                                  "procps-ng-" version ".tar.xz"))
+              (sha256
+               (base32
+                "1va4n0mpsq327ca9dqp4hnrpgs6821rp0f2m0jyc1bfjl9lk2jg9"))
+              (patches
+               (list (search-patch "procps-non-linux.patch")))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:modules ((guix build utils)
+                  (guix build gnu-build-system)
+                  (srfi srfi-1)
+                  (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after
+          'install 'post-install
+          ;; Remove commands and man pages redudant with
+          ;; Coreutils.
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out"))
+                   (dup (append-map (cut find-files out <>)
+                                    '("^kill" "^uptime"))))
+              (for-each delete-file dup)
+              #t))))))
+    (inputs `(("ncurses" ,ncurses)))
+    (home-page "https://gitlab.com/procps-ng/procps/")
+    (synopsis "Utilities that give information about processes")
+    (description
+     "Procps is the package that has a bunch of small useful utilities
+that give information about processes using the Linux /proc file system.
+The package includes the programs ps, top, vmstat, w, kill, free,
+slabtop, and skill.")
+    (license license:gpl2)))
+
+(define-public kmod
+  (package
+    (name "kmod")
+    (version "22")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
+                              "kmod-" version ".tar.xz"))
+              (sha256
+               (base32
+                "10lzfkmnpq6a43a3gkx7x633njh216w0bjwz31rv8a1jlgg1sfxs"))
+              (patches (search-patches "kmod-module-directory.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("xz" ,xz)
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:tests? #f ; FIXME: Investigate test failures
+       #:configure-flags '("--with-xz" "--with-zlib")
+       #:phases (alist-cons-after
+                 'install 'install-modprobe&co
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let* ((out (assoc-ref outputs "out"))
+                          (bin (string-append out "/bin")))
+                     (for-each (lambda (tool)
+                                 (symlink "kmod"
+                                          (string-append bin "/" tool)))
+                               '("insmod" "rmmod" "lsmod" "modprobe"
+                                 "modinfo" "depmod"))))
+                 %standard-phases)))
+    (home-page "https://www.kernel.org/")
+    (synopsis "Kernel module tools")
+    (description "Kmod is a set of tools to handle common tasks with Linux
+kernel modules like insert, remove, list, check properties, resolve
+dependencies and aliases.
+
+These tools are designed on top of libkmod, a library that is shipped with
+kmod.  The aim is to be compatible with tools, configurations and indices
+from the module-init-tools project.")
+    (license license:gpl2+))) ; library under lgpl2.1+
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 0a1eff5..ac7277c 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -58,6 +58,7 @@
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages libusb)
+  #:use-module (gnu packages linux-base)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages perl)
@@ -430,58 +431,6 @@ use the proc file system.  We're not about changing the world, but
 providing the system administrator with some help in common tasks.")
     (license license:gpl2+)))
 
-(define-public util-linux/base
-  (package
-    (name "util-linux-base")
-    (version "2.27")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://kernel.org/linux/utils/"
-                                  "util-linux" "/v" (version-major+minor version) "/"
-                                  "util-linux" "-" version ".tar.xz"))
-              (sha256
-               (base32
-                "1ivdx1bhjbakf77agm9dn3wyxia1wgz9lzxgd61zqxw3xzih9gzw"))
-              (patches (search-patches "util-linux-tests.patch"))
-              (modules '((guix build utils)))
-              (snippet
-               ;; We take the 'logger' program from GNU Inetutils and 'kill'
-               ;; from GNU Coreutils.
-               '(begin
-                  (substitute* "configure"
-                    (("build_logger=yes") "build_logger=no")
-                    (("build_kill=yes") "build_kill=no"))
-                  #t))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:phases (modify-phases %standard-phases
-                  (add-after
-                      'install 'move-static-libraries
-                    (lambda* (#:key outputs #:allow-other-keys)
-                      (let ((out    (assoc-ref outputs "out"))
-                            (static (assoc-ref outputs "static")))
-                        (mkdir-p (string-append static "/lib"))
-                        (with-directory-excursion out
-                          (for-each (lambda (file)
-                                      (rename-file file
-                                                   (string-append static "/"
-                                                                  file)))
-                                    (find-files "lib" "\\.a$")))
-                        #t))))))
-    (outputs '("out"
-               "static"))      ; >2 MiB of static .a libraries
-    (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
-    (synopsis "Collection of utilities for the Linux kernel")
-    (description "Util-linux is a diverse collection of Linux kernel
-utilities.  It provides dmesg and includes tools for working with file systems,
-block devices, UUIDs, TTYs, and many other tools.")
-
-    ;; Note that util-linux doesn't use the same license for all the
-    ;; code.  GPLv2+ is the default license for a code without an
-    ;; explicitly defined license.
-    (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
-                   license:bsd-4 license:public-domain))))
-
 (define-public util-linux
   (package
     (inherit util-linux/base)
@@ -534,66 +483,6 @@ block devices, UUIDs, TTYs, and many other tools.")
      `(("perl" ,perl)
        ("net-base" ,net-base)))))                   ;for tests
 
-(define-public util-linux/mount
-  (package
-    (inherit util-linux/base)
-    (name "util-linux-mount")
-    (source (origin (inherit (package-source util-linux/base))))
-    (arguments
-     `(#:configure-flags (list "--disable-all-programs"
-                               "--disable-bash-completion"
-                               "--disable-nls"
-                               "--enable-libmount"
-                               "--enable-libblkid"
-                               "--enable-libuuid"
-                               "--enable-mount")
-       ,@(package-arguments util-linux/base)))
-    (synopsis "Mount/Umount utilities for the Linux kernel")
-    (description "Util-linux is a diverse collection of Linux kernel
-utilities.  However, this is a minimally configured package providing just
-the @code{mount} and @code{umount} utilities.")))
-
-
-(define-public procps
-  (package
-    (name "procps")
-    (version "3.3.11")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://sourceforge/procps-ng/Production/"
-                                  "procps-ng-" version ".tar.xz"))
-              (sha256
-               (base32
-                "1va4n0mpsq327ca9dqp4hnrpgs6821rp0f2m0jyc1bfjl9lk2jg9"))
-              (patches
-               (list (search-patch "procps-non-linux.patch")))))
-    (build-system gnu-build-system)
-    (arguments
-     '(#:modules ((guix build utils)
-                  (guix build gnu-build-system)
-                  (srfi srfi-1)
-                  (srfi srfi-26))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after
-          'install 'post-install
-          ;; Remove commands and man pages redudant with
-          ;; Coreutils.
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let* ((out (assoc-ref outputs "out"))
-                   (dup (append-map (cut find-files out <>)
-                                    '("^kill" "^uptime"))))
-              (for-each delete-file dup)
-              #t))))))
-    (inputs `(("ncurses" ,ncurses)))
-    (home-page "https://gitlab.com/procps-ng/procps/")
-    (synopsis "Utilities that give information about processes")
-    (description
-     "Procps is the package that has a bunch of small useful utilities
-that give information about processes using the Linux /proc file system.
-The package includes the programs ps, top, vmstat, w, kill, free,
-slabtop, and skill.")
-    (license license:gpl2)))
 
 (define-public usbutils
   (package
@@ -1605,157 +1494,6 @@ for systems using the Linux kernel.  This includes commands such as
 to use Linux' inotify mechanism, which allows file accesses to be monitored.")
     (license license:gpl2+)))
 
-(define-public kmod
-  (package
-    (name "kmod")
-    (version "22")
-    (source (origin
-              (method url-fetch)
-              (uri
-               (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
-                              "kmod-" version ".tar.xz"))
-              (sha256
-               (base32
-                "10lzfkmnpq6a43a3gkx7x633njh216w0bjwz31rv8a1jlgg1sfxs"))
-              (patches (search-patches "kmod-module-directory.patch"))))
-    (build-system gnu-build-system)
-    (native-inputs
-     `(("pkg-config" ,pkg-config)))
-    (inputs
-     `(("xz" ,xz)
-       ("zlib" ,zlib)))
-    (arguments
-     `(#:tests? #f ; FIXME: Investigate test failures
-       #:configure-flags '("--with-xz" "--with-zlib")
-       #:phases (alist-cons-after
-                 'install 'install-modprobe&co
-                 (lambda* (#:key outputs #:allow-other-keys)
-                   (let* ((out (assoc-ref outputs "out"))
-                          (bin (string-append out "/bin")))
-                     (for-each (lambda (tool)
-                                 (symlink "kmod"
-                                          (string-append bin "/" tool)))
-                               '("insmod" "rmmod" "lsmod" "modprobe"
-                                 "modinfo" "depmod"))))
-                 %standard-phases)))
-    (home-page "https://www.kernel.org/")
-    (synopsis "Kernel module tools")
-    (description "Kmod is a set of tools to handle common tasks with Linux
-kernel modules like insert, remove, list, check properties, resolve
-dependencies and aliases.
-
-These tools are designed on top of libkmod, a library that is shipped with
-kmod.  The aim is to be compatible with tools, configurations and indices
-from the module-init-tools project.")
-    (license license:gpl2+))) ; library under lgpl2.1+
-
-(define-public eudev
-  ;; The post-systemd fork, maintained by Gentoo.
-  (package
-    (name "eudev")
-    (version "3.1.5")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "http://dev.gentoo.org/~blueness/eudev/eudev-"
-                    version ".tar.gz"))
-              (sha256
-               (base32
-                "0akg9gcc3c2p56xbhlvbybqavcprly5q0bvk655zwl6d62j8an7p"))
-              (patches (search-patches "eudev-rules-directory.patch"))))
-    (build-system gnu-build-system)
-    (native-inputs
-     `(("pkg-config" ,pkg-config)
-       ("perl" ,perl)
-       ("gperf" ,gperf)))
-    (inputs
-     ;; When linked against libblkid, eudev can populate /dev/disk/by-label
-     ;; and similar; it also installs the '60-persistent-storage.rules' file,
-     ;; which contains the rules to do that.
-     `(("util-linux" ,util-linux)                 ;for blkid
-       ("kmod" ,kmod)))
-    (home-page "https://wiki.gentoo.org/wiki/Project:Eudev")
-    (synopsis "Userspace device management")
-    (description "Udev is a daemon which dynamically creates and removes
-device nodes from /dev/, handles hotplug events and loads drivers at boot
-time.")
-    (license license:gpl2+)))
-
-(define-public lvm2
-  (package
-    (name "lvm2")
-    (version "2.02.166")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
-                                  version ".tgz"))
-              (sha256
-               (base32
-                "150v0mawd2swdvypcmkjd3h3s4n5i1220h6sxx94a8jvp1kb0871"))
-              (modules '((guix build utils)))
-              (snippet
-               '(begin
-                  (use-modules (guix build utils))
-
-                  ;; Honor sysconfdir.
-                  (substitute* "make.tmpl.in"
-                    (("confdir = .*$")
-                     "confdir = @sysconfdir@\n")
-                    (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
-                     "DEFAULT_SYS_DIR = @sysconfdir@"))))))
-    (build-system gnu-build-system)
-    (native-inputs
-     `(("pkg-config" ,pkg-config)
-       ("procps" ,procps)))                       ;tests use 'pgrep'
-    (inputs
-     `(("udev" ,eudev)))
-    (arguments
-     '(#:phases
-       (modify-phases %standard-phases
-         (add-after 'configure 'set-makefile-shell
-           (lambda _
-             ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
-             ;; expected.
-             (setenv "SHELL" (which "sh"))
-
-             ;; Replace /bin/sh with the right file name.
-             (patch-makefile-SHELL "make.tmpl")
-             #t))
-         (add-before 'strip 'make-objects-writable
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; Make compiled objects writable so they can be stripped.
-             (let ((out (assoc-ref outputs "out")))
-               (for-each (lambda (file)
-                           (chmod file #o755))
-                         (append
-                           (find-files (string-append out "/lib"))
-                           (find-files (string-append out "/sbin"))))
-               #t))))
-
-       #:configure-flags (list (string-append "--sysconfdir="
-                                              (assoc-ref %outputs "out")
-                                              "/etc/lvm")
-                               "--enable-udev_sync"
-                               "--enable-udev_rules"
-
-                               ;; Make sure programs such as 'dmsetup' can
-                               ;; find libdevmapper.so.
-                               (string-append "LDFLAGS=-Wl,-rpath="
-                                              (assoc-ref %outputs "out")
-                                              "/lib"))
-
-       ;; The tests use 'mknod', which requires root access.
-       #:tests? #f))
-    (home-page "http://sourceware.org/lvm2/")
-    (synopsis "Logical volume management for Linux")
-    (description
-     "LVM2 is the logical volume management tool set for Linux-based systems.
-This package includes the user-space libraries and tools, including the device
-mapper.  Kernel components are part of Linux-libre.")
-
-    ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
-    ;; Command-line tools are GPLv2.
-    (license (list license:gpl2 license:lgpl2.1))))
 
 (define-public wireless-tools
   (package
@@ -2965,34 +2703,6 @@ native Linux file system, and has been part of the Linux kernel since version
     ;; grant additional permission to link with OpenSSL.
     (license license:gpl2+)))
 
-(define-public libnfsidmap
-  (package
-    (name "libnfsidmap")
-    (version "0.25")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append
-                   "http://www.citi.umich.edu/projects/nfsv4/linux/"
-                   name "/" name "-" version ".tar.gz"))
-             (sha256
-              (base32
-               "1kzgwxzh83qi97rblcm9qj80cdvnv8kml2plz0q103j0hifj8vb5"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:configure-flags (list
-                          (string-append "--with-pluginpath="
-                                         (assoc-ref %outputs "out")
-                                         "/lib/libnfsidmap"))))
-    (home-page
-     "http://www.citi.umich.edu/projects/nfsv4/crossrealm/libnfsidmap_config.html")
-    (synopsis
-     "NFSv4 support library for name/ID mapping")
-    (description "Libnfsidmap is a library holding mulitiple methods of
-mapping names to ids and visa versa, mainly for NFSv4.  It provides an
-extensible array of mapping functions, currently consisting of two choices:
-the default @code{nsswitch} and the experimental @code{umich_ldap}.")
-    (license (license:non-copyleft "file://COPYING"
-                                   "See COPYING in the distribution."))))
 
 (define-public module-init-tools
   (package
diff --git a/gnu/packages/nfs.scm b/gnu/packages/nfs.scm
index 761b19c..cae6a34 100644
--- a/gnu/packages/nfs.scm
+++ b/gnu/packages/nfs.scm
@@ -18,7 +18,7 @@
 
 (define-module (gnu packages nfs)
   #:use-module (gnu packages)
-  #:use-module (gnu packages linux)
+  #:use-module (gnu packages linux-base)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages gsasl)
   #:use-module (gnu packages libevent)
@@ -38,6 +38,36 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match))
 
+
+(define-public libnfsidmap
+  (package
+    (name "libnfsidmap")
+    (version "0.25")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append
+                   "http://www.citi.umich.edu/projects/nfsv4/linux/"
+                   name "/" name "-" version ".tar.gz"))
+             (sha256
+              (base32
+               "1kzgwxzh83qi97rblcm9qj80cdvnv8kml2plz0q103j0hifj8vb5"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags (list
+                          (string-append "--with-pluginpath="
+                                         (assoc-ref %outputs "out")
+                                         "/lib/libnfsidmap"))))
+    (home-page
+     "http://www.citi.umich.edu/projects/nfsv4/crossrealm/libnfsidmap_config.html")
+    (synopsis
+     "NFSv4 support library for name/ID mapping")
+    (description "Libnfsidmap is a library holding mulitiple methods of
+mapping names to ids and visa versa, mainly for NFSv4.  It provides an
+extensible array of mapping functions, currently consisting of two choices:
+the default @code{nsswitch} and the experimental @code{umich_ldap}.")
+    (license (license:non-copyleft "file://COPYING"
+                                   "See COPYING in the distribution."))))
+
 (define-public nfs-utils
   (package
     (name "nfs-utils")
diff --git a/gnu/packages/texinfo.scm b/gnu/packages/texinfo.scm
index 5b22e84..2b1970b 100644
--- a/gnu/packages/texinfo.scm
+++ b/gnu/packages/texinfo.scm
@@ -25,8 +25,9 @@
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages linux-base)
   #:use-module (gnu packages perl)
-  #:use-module (gnu packages linux)
+
   #:use-module (gnu packages ncurses))
 
 (define-public texinfo
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index 8318dd2..987688d 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -39,6 +39,7 @@
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages libidn)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages linux-base)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages perl)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/4] Add fs-search paths to util-linux
  2016-11-10 21:14 [PATCH 1/4] gnu: Separate util-linux into three packages John Darrington
  2016-11-10 21:14 ` [PATCH 2/4] gnu: nfs-utils: Change input from util-linux to util-linux/mount John Darrington
  2016-11-10 21:14 ` [PATCH 3/4] gnu: Move util-linux/mount to new file and deal with the effects John Darrington
@ 2016-11-10 21:14 ` John Darrington
  2016-11-11 14:43 ` [PATCH 1/4] gnu: Separate util-linux into three packages Hartmut Goebel
  2016-11-12 14:53 ` Ludovic Courtès
  4 siblings, 0 replies; 32+ messages in thread
From: John Darrington @ 2016-11-10 21:14 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/linux.scm (util-linux) [arguments]: Add configure flag --enable-fs-paths=.
[inputs]: Add nfs-utils.
---
 gnu/packages/bash.scm  | 1 +
 gnu/packages/guile.scm | 1 +
 gnu/packages/linux.scm | 9 ++++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 6c3c0ba..d37b676 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -23,6 +23,7 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages bison)
   #:use-module (guix packages)
   #:use-module (guix download)
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 8b17aeb..8bde0e3 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -37,6 +37,7 @@
   #:use-module (gnu packages flex)
   #:use-module (gnu packages libunistring)
   #:use-module (gnu packages linux-base)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages pkg-config)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index ac7277c..d07fb66 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -61,6 +61,7 @@
   #:use-module (gnu packages linux-base)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages nfs)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pkg-config)
@@ -439,6 +440,11 @@ providing the system administrator with some help in common tasks.")
     (arguments
      `(#:configure-flags (list "--disable-use-tty-group"
 
+                               ;; FIXME: Add path to  mount.fuse here
+                               (string-append "--enable-fs-paths-default="
+                                              (assoc-ref %build-inputs "nfs-utils")
+                                              "/sbin")
+
                                ;; Install completions where our
                                ;; bash-completion package expects them.
                                (string-append "--with-bashcompletiondir="
@@ -478,7 +484,8 @@ providing the system administrator with some help in common tasks.")
                                    (find-files "lib" "\\.a$")))
                        #t))))))
     (inputs `(("zlib" ,zlib)
-              ("ncurses" ,ncurses)))
+              ("ncurses" ,ncurses)
+              ("nfs-utils" ,nfs-utils)))
     (native-inputs
      `(("perl" ,perl)
        ("net-base" ,net-base)))))                   ;for tests
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-10 21:14 [PATCH 1/4] gnu: Separate util-linux into three packages John Darrington
                   ` (2 preceding siblings ...)
  2016-11-10 21:14 ` [PATCH 4/4] Add fs-search paths to util-linux John Darrington
@ 2016-11-11 14:43 ` Hartmut Goebel
  2016-11-11 16:03   ` John Darrington
  2016-11-12 14:53 ` Ludovic Courtès
  4 siblings, 1 reply; 32+ messages in thread
From: Hartmut Goebel @ 2016-11-11 14:43 UTC (permalink / raw)
  To: John Darrington, guix-devel

Am 10.11.2016 um 22:14 schrieb John Darrington:
> +(define-public util-linux/base
>    (package
> -    (name "util-linux")
> +    (name "util-linux-base")

I'm in favour of naming the variable as the package. This eases using them.

> +(define-public util-linux
> +  (package
> +    (inherit util-linux/base)
> +    (name "util-linux")
> +    (source (origin (inherit (package-source util-linux/base))))

I'm curious: Why do you need to inherit the package-source here?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-11 14:43 ` [PATCH 1/4] gnu: Separate util-linux into three packages Hartmut Goebel
@ 2016-11-11 16:03   ` John Darrington
  2016-11-11 16:40     ` Hartmut Goebel
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-11 16:03 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

On Fri, Nov 11, 2016 at 03:43:32PM +0100, Hartmut Goebel wrote:
     Am 10.11.2016 um 22:14 schrieb John Darrington:
     > +(define-public util-linux/base
     >    (package
     > -    (name "util-linux")
     > +    (name "util-linux-base")
     
     I'm in favour of naming the variable as the package. This eases using them.

I tried that.  It seems that there is a precident to use /variant  for the variable.
However / is not permitted in the name
     
     > +(define-public util-linux
     > +  (package
     > +    (inherit util-linux/base)
     > +    (name "util-linux")
     > +    (source (origin (inherit (package-source util-linux/base))))
     
     I'm curious: Why do you need to inherit the package-source here?
     

Well I don't actually *need* to.  I could have copied it.  But I thought that
having 3 copies would make maintenance difficult---somebody might update one,
but forget the other two.
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-11 16:03   ` John Darrington
@ 2016-11-11 16:40     ` Hartmut Goebel
  2016-11-11 19:36       ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Hartmut Goebel @ 2016-11-11 16:40 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

Am 11.11.2016 um 17:03 schrieb John Darrington:
>     
>      > +(define-public util-linux
>      > +  (package
>      > +    (inherit util-linux/base)
>      > +    (name "util-linux")
>      > +    (source (origin (inherit (package-source util-linux/base))))
>      
>      I'm curious: Why do you need to inherit the package-source here?
>      
>
> Well I don't actually *need* to.  I could have copied it.  But I thought that
> having 3 copies would make maintenance difficult---somebody might update one,
> but forget the other two.

Sorry for not being precise enough. I meant why are us using "inherit"
here? I thought

    (source (package-source util-linux/base))

would suffice and result in the same?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-11 16:40     ` Hartmut Goebel
@ 2016-11-11 19:36       ` John Darrington
  0 siblings, 0 replies; 32+ messages in thread
From: John Darrington @ 2016-11-11 19:36 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

On Fri, Nov 11, 2016 at 05:40:51PM +0100, Hartmut Goebel wrote:
     Am 11.11.2016 um 17:03 schrieb John Darrington:
     >     
     >      > +(define-public util-linux
     >      > +  (package
     >      > +    (inherit util-linux/base)
     >      > +    (name "util-linux")
     >      > +    (source (origin (inherit (package-source util-linux/base))))
     >      
     >      I'm curious: Why do you need to inherit the package-source here?
     >      
     >
     > Well I don't actually *need* to.  I could have copied it.  But I thought that
     > having 3 copies would make maintenance difficult---somebody might update one,
     > but forget the other two.
     
     Sorry for not being precise enough. I meant why are us using "inherit"
     here? I thought
     
         (source (package-source util-linux/base))
     
     would suffice and result in the same?
     
You're right.  Thanks for the suggestion.

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-10 21:14 [PATCH 1/4] gnu: Separate util-linux into three packages John Darrington
                   ` (3 preceding siblings ...)
  2016-11-11 14:43 ` [PATCH 1/4] gnu: Separate util-linux into three packages Hartmut Goebel
@ 2016-11-12 14:53 ` Ludovic Courtès
  2016-11-12 15:28   ` John Darrington
  4 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-12 14:53 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

Hi!

John Darrington <jmd@gnu.org> skribis:

> * gnu/packages/linux.scm (util-linux/base): New variable,
> (util-linux/mount): New variable,  (util-linux) Refine
> inheriting from util-linux/base.

Do I get it right that these changes aim to make ‘mount -t nfs’ work?
That is, to allow ‘mount’ to find the ‘mount.nfs’(?) program.

If so, would it work to just do:

  "--enable-fs-paths-default=/run/current-system/profile/sbin"

?

That would only work on GuixSD, but Guix’s ‘mount’ is certainly not very
useful on foreign distros.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-12 14:53 ` Ludovic Courtès
@ 2016-11-12 15:28   ` John Darrington
  2016-11-12 17:09     ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-12 15:28 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1116 bytes --]

On Sat, Nov 12, 2016 at 03:53:59PM +0100, Ludovic Court??s wrote:
     Hi!
     
     John Darrington <jmd@gnu.org> skribis:
     
     > * gnu/packages/linux.scm (util-linux/base): New variable,
     > (util-linux/mount): New variable,  (util-linux) Refine
     > inheriting from util-linux/base.
     
     Do I get it right that these changes aim to make ???mount -t nfs??? work?
     That is, to allow ???mount??? to find the ???mount.nfs???(?) program.

That is correct.
     
     If so, would it work to just do:
     
       "--enable-fs-paths-default=/run/current-system/profile/sbin"
     
     ?
     
     That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
     useful on foreign distros.
     

That would certainly be a solution easier to do.   
But doesn't it mean that we have a "functionally impure" system?

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-12 15:28   ` John Darrington
@ 2016-11-12 17:09     ` John Darrington
  2016-11-12 22:55       ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-12 17:09 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

On Sat, Nov 12, 2016 at 04:28:08PM +0100, John Darrington wrote:
          
          If so, would it work to just do:
          
            "--enable-fs-paths-default=/run/current-system/profile/sbin"
          
          ?
          
          That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
          useful on foreign distros.
     
     That would certainly be a solution easier to do.   
     But doesn't it mean that we have a "functionally impure" system?
     

Also, it would only work if nfs-utils was installed in the current system profile,
which need not be the case.  It might be installed only in root's profile or I might 
want to see what happens if I use an alternative version of nfs-utils.

J'



-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-12 17:09     ` John Darrington
@ 2016-11-12 22:55       ` Ludovic Courtès
  2016-11-13  8:21         ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-12 22:55 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> On Sat, Nov 12, 2016 at 04:28:08PM +0100, John Darrington wrote:
>           
>           If so, would it work to just do:
>           
>             "--enable-fs-paths-default=/run/current-system/profile/sbin"
>           
>           ?
>           
>           That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
>           useful on foreign distros.
>      
>      That would certainly be a solution easier to do.   
>      But doesn't it mean that we have a "functionally impure" system?
>      
>
> Also, it would only work if nfs-utils was installed in the current system profile,
> which need not be the case.  It might be installed only in root's profile or I might 
> want to see what happens if I use an alternative version of nfs-utils.

That ‘mount’ can invoke ‘mount.nfs’ looks like a convenience to me, not
something highly critical.

I would say that dynamic composition (‘mount’ looking up ‘mount.nfs’ &
co. in $PATH) is OK in this case.  The NFS service in GuixSD could
extend ‘profile-service-type’ such that ‘nfs-utils’ is indeed in the
system profile.

WDYT?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-12 22:55       ` Ludovic Courtès
@ 2016-11-13  8:21         ` John Darrington
  2016-11-13 11:59           ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-13  8:21 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2035 bytes --]

On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     > On Sat, Nov 12, 2016 at 04:28:08PM +0100, John Darrington wrote:
     >           
     >           If so, would it work to just do:
     >           
     >             "--enable-fs-paths-default=/run/current-system/profile/sbin"
     >           
     >           ?
     >           
     >           That would only work on GuixSD, but Guix???s ???mount??? is certainly not very
     >           useful on foreign distros.
     >      
     >      That would certainly be a solution easier to do.   
     >      But doesn't it mean that we have a "functionally impure" system?
     >      
     >
     > Also, it would only work if nfs-utils was installed in the current system profile,
     > which need not be the case.  It might be installed only in root's profile or I might 
     > want to see what happens if I use an alternative version of nfs-utils.
     
     That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
     something highly critical.

Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
many networks) can be automatically mounted at boot time.
     
     I would say that dynamic composition (???mount??? looking up ???mount.nfs??? &
     co. in $PATH) is OK in this case.  The NFS service in GuixSD could
     extend ???profile-service-type??? such that ???nfs-utils??? is indeed in the
     system profile.
     
Ok If you think it's acceptable I'll push a change with just the
"--enable-fs-paths-default=/run/current-system/profile/sbin" option for now.  If it
turns out not to be good enough then we can rethink it later.

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-13  8:21         ` John Darrington
@ 2016-11-13 11:59           ` Ludovic Courtès
  2016-11-13 14:06             ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-13 11:59 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <john@darrington.wattle.id.au> skribis:

> On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:

[...]

>      > Also, it would only work if nfs-utils was installed in the current system profile,
>      > which need not be the case.  It might be installed only in root's profile or I might 
>      > want to see what happens if I use an alternative version of nfs-utils.
>      
>      That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
>      something highly critical.
>
> Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
> many networks) can be automatically mounted at boot time.

GuixSD doesn’t use the ‘mount’ command to mount file systems so that
shouldn’t have any influence.

>      I would say that dynamic composition (???mount??? looking up ???mount.nfs??? &
>      co. in $PATH) is OK in this case.  The NFS service in GuixSD could
>      extend ???profile-service-type??? such that ???nfs-utils??? is indeed in the
>      system profile.
>      
> Ok If you think it's acceptable I'll push a change with just the
> "--enable-fs-paths-default=/run/current-system/profile/sbin" option for now.  If it
> turns out not to be good enough then we can rethink it later.

Yes, I agree.

1,093 packages depend on util-linux.  Per the strategy outlined at
<https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>
this could go to ‘staging’ but I think this should go to ‘core-updates’
which we’ll reopen to fix <http://bugs.gnu.org/24703>.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-13 11:59           ` Ludovic Courtès
@ 2016-11-13 14:06             ` John Darrington
  2016-11-14  9:48               ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-13 14:06 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]

On Sun, Nov 13, 2016 at 12:59:50PM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     > On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:
     
     [...]
     
     >      > Also, it would only work if nfs-utils was installed in the current system profile,
     >      > which need not be the case.  It might be installed only in root's profile or I might 
     >      > want to see what happens if I use an alternative version of nfs-utils.
     >      
     >      That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
     >      something highly critical.
     >
     > Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
     > many networks) can be automatically mounted at boot time.
     
     GuixSD doesn???t use the ???mount??? command to mount file systems so that
     shouldn???t have any influence.

What does it use instead?
     
     1,093 packages depend on util-linux.  Per the strategy outlined at
     <https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>
     this could go to ???staging??? but I think this should go to ???core-updates???
     which we???ll reopen to fix <http://bugs.gnu.org/24703>.

I'm irritated that util-linux has so many, completely unrelated things in it.  For example
it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
suggest we consider separating it anyway, into several packages all deriving from the common
source.
     

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-13 14:06             ` John Darrington
@ 2016-11-14  9:48               ` Ludovic Courtès
  2016-11-14 17:46                 ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-14  9:48 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <john@darrington.wattle.id.au> skribis:

> On Sun, Nov 13, 2016 at 12:59:50PM +0100, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>      
>      > On Sat, Nov 12, 2016 at 11:55:13PM +0100, Ludovic Court??s wrote:
>      
>      [...]
>      
>      >      > Also, it would only work if nfs-utils was installed in the current system profile,
>      >      > which need not be the case.  It might be installed only in root's profile or I might 
>      >      > want to see what happens if I use an alternative version of nfs-utils.
>      >      
>      >      That ???mount??? can invoke ???mount.nfs??? looks like a convenience to me, not
>      >      something highly critical.
>      >
>      > Well it's critical if "mount -a" is going to work, and thus if NFS filesystems (such as /home in
>      > many networks) can be automatically mounted at boot time.
>      
>      GuixSD doesn???t use the ???mount??? command to mount file systems so that
>      shouldn???t have any influence.
>
> What does it use instead?

The ‘mount’ system call; see (gnu build file-systems).

>      1,093 packages depend on util-linux.  Per the strategy outlined at
>      <https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>
>      this could go to ???staging??? but I think this should go to ???core-updates???
>      which we???ll reopen to fix <http://bugs.gnu.org/24703>.
>
> I'm irritated that util-linux has so many, completely unrelated things in it.  For example
> it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
> suggest we consider separating it anyway, into several packages all deriving from the common
> source.

The strategy is to stick to what upstream does, in general, and I’m not
convinced splitting would buy us much (in terms of disk usage, for
instance.)

Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-14  9:48               ` Ludovic Courtès
@ 2016-11-14 17:46                 ` John Darrington
  2016-11-15 10:46                   ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-14 17:46 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]

On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:

     >      GuixSD doesn???t use the ???mount??? command to mount file systems so that
     >      shouldn???t have any influence.
     >
     > What does it use instead?
     
     The ???mount??? system call; see (gnu build file-systems).

I confess, I have not really thought about this before. But supposing somebody has in their /etc/config.scm:

  (file-systems 
   (cons*
    (file-system
      (device "my-root")
      (title 'label)
      (mount-point "/")
      (type "ext4"))
    (file-system
      (device "fileserver.example.com:/home")
      (title 'device)
      (mount-point "/home")
      (type "nfs4"))
    %base-file-systems))

Would the /home filesystem then get mounted on boot?
     
     > I'm irritated that util-linux has so many, completely unrelated things in it.  For example
     > it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
     > suggest we consider separating it anyway, into several packages all deriving from the common
     > source.
     
     The strategy is to stick to what upstream does, in general, and I???m not
     convinced splitting would buy us much (in terms of disk usage, for
     instance.)

In general I think that is a sensible strategy.  Splitting, would not buy us anything 
in terms of disk space, but I think it would mean less rebuilding when some configure 
option needs to be changed.

J'
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/4] gnu: Separate util-linux into three packages.
  2016-11-14 17:46                 ` John Darrington
@ 2016-11-15 10:46                   ` Ludovic Courtès
  2016-11-16 21:06                     ` mount syscall John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-15 10:46 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <john@darrington.wattle.id.au> skribis:

> On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>
>      >      GuixSD doesn???t use the ???mount??? command to mount file systems so that
>      >      shouldn???t have any influence.
>      >
>      > What does it use instead?
>      
>      The ???mount??? system call; see (gnu build file-systems).
>
> I confess, I have not really thought about this before. But supposing somebody has in their /etc/config.scm:
>
>   (file-systems 
>    (cons*
>     (file-system
>       (device "my-root")
>       (title 'label)
>       (mount-point "/")
>       (type "ext4"))
>     (file-system
>       (device "fileserver.example.com:/home")
>       (title 'device)
>       (mount-point "/home")
>       (type "nfs4"))
>     %base-file-systems))
>
> Would the /home filesystem then get mounted on boot?

Maybe not.  :-)

The man page for mount(2) says:

--8<---------------cut here---------------start------------->8--- Values
for the filesystemtype argument supported by the kernel are listed in
/proc/filesystems (e.g., "btrfs", "ext4", "jfs", "xfs", "vfat", "fuse",
"tmpfs", "cgroup", "proc", "mqueue", "nfs", "cifs", "iso9660").  Further
types may become available when the appropriate modules are loaded.
--8<---------------cut here---------------end--------------->8---

I don’t know what happens with NFS, you’ll have to tell us.

>      > I'm irritated that util-linux has so many, completely unrelated things in it.  For example
>      > it contains the "mount", "cal" and "col" commands.    Regardless of the NFS issues, I 
>      > suggest we consider separating it anyway, into several packages all deriving from the common
>      > source.
>      
>      The strategy is to stick to what upstream does, in general, and I???m not
>      convinced splitting would buy us much (in terms of disk usage, for
>      instance.)
>
> In general I think that is a sensible strategy.  Splitting, would not buy us anything 
> in terms of disk space, but I think it would mean less rebuilding when some configure 
> option needs to be changed.

Yeah, but that’s probably not a significant improvement in terms of
avoiding rebuilds.

Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* mount syscall
  2016-11-15 10:46                   ` Ludovic Courtès
@ 2016-11-16 21:06                     ` John Darrington
  2016-11-17  9:47                       ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-16 21:06 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 4332 bytes --]

On Tue, Nov 15, 2016 at 11:46:01AM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     > On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote:
     >      
     >      The ???mount??? system call; see (gnu build file-systems).
     >
     > I confess, I have not really thought about this before. But supposing somebody has in their /etc/config.scm:
     >
     >   (file-systems 
     >    (cons*
     >     (file-system
     >       (device "my-root")
     >       (title 'label)
     >       (mount-point "/")
     >       (type "ext4"))
     >     (file-system
     >       (device "fileserver.example.com:/home")
     >       (title 'device)
     >       (mount-point "/home")
     >       (type "nfs4"))
     >     %base-file-systems))
     >
     > Would the /home filesystem then get mounted on boot?
     
     Maybe not.  :-)
     
     The man page for mount(2) says:
     
     --8<---------------cut here---------------start------------->8--- Values
     for the filesystemtype argument supported by the kernel are listed in
     /proc/filesystems (e.g., "btrfs", "ext4", "jfs", "xfs", "vfat", "fuse",
     "tmpfs", "cgroup", "proc", "mqueue", "nfs", "cifs", "iso9660").  Further
     types may become available when the appropriate modules are loaded.
     --8<---------------cut here---------------end--------------->8---
     
     I don???t know what happens with NFS, you???ll have to tell us.

The answer seems to be that it would fail unless we patch our mount syscall
wrapper with something like:

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 2cee654..3435617 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -415,17 +415,33 @@ string.  When FLAGS contains MS_REMOUNT, SOURCE and TYPE are ignored.  When
 UPDATE-MTAB? is true, update /etc/mtab.  Raise a 'system-error' exception on
 error."
       (let-values (((ret err)
-                    (proc (if source
-                              (string->pointer source)
-                              %null-pointer)
-                          (string->pointer target)
-                          (if type
-                              (string->pointer type)
-                              %null-pointer)
-                          flags
-                          (if options
-                              (string->pointer options)
-                              %null-pointer))))
+                    (let ((xoptions
+                           (cond
+                            ((string-match "^nfs.*" type)
+                             (let* ((hosts (string-split source #\:))
+                                    (aa (car (getaddrinfo (car hosts)  #f)))
+                                    (sa (addrinfo:addr aa))
+                                    (inet-addr (inet-ntop (sockaddr:fam sa)
+                                                          (sockaddr:addr sa))))
+                               (string-append "addr="
+                                              inet-addr
+                                              (if options
+                                                  (string-append "," options)
+                                                  ""))))
+                            (else
+                             options))))
+                      (proc
+                       (if source
+                           (string->pointer source)
+                           %null-pointer)
+                       (string->pointer target)
+                       (if type
+                           (string->pointer type)
+                           %null-pointer)
+                       flags
+                       (if xoptions
+                           (string->pointer xoptions)
+                           %null-pointer)))))
         (unless (zero? ret)
           (throw 'system-error "mount" "mount ~S on ~S: ~A"
                  (list source target (strerror err))


WDYT?


     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: mount syscall
  2016-11-16 21:06                     ` mount syscall John Darrington
@ 2016-11-17  9:47                       ` Ludovic Courtès
  2016-11-22 19:15                         ` [PATCH] gnu: Allow nfs filesystems to be automatically mounted John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-17  9:47 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <john@darrington.wattle.id.au> skribis:

> On Tue, Nov 15, 2016 at 11:46:01AM +0100, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>      
>      > On Mon, Nov 14, 2016 at 10:48:18AM +0100, Ludovic Court??s wrote:
>      >      
>      >      The ???mount??? system call; see (gnu build file-systems).
>      >
>      > I confess, I have not really thought about this before. But supposing somebody has in their /etc/config.scm:
>      >
>      >   (file-systems 
>      >    (cons*
>      >     (file-system
>      >       (device "my-root")
>      >       (title 'label)
>      >       (mount-point "/")
>      >       (type "ext4"))
>      >     (file-system
>      >       (device "fileserver.example.com:/home")
>      >       (title 'device)
>      >       (mount-point "/home")
>      >       (type "nfs4"))
>      >     %base-file-systems))
>      >
>      > Would the /home filesystem then get mounted on boot?
>      
>      Maybe not.  :-)
>      
>      The man page for mount(2) says:
>      
>      --8<---------------cut here---------------start------------->8--- Values
>      for the filesystemtype argument supported by the kernel are listed in
>      /proc/filesystems (e.g., "btrfs", "ext4", "jfs", "xfs", "vfat", "fuse",
>      "tmpfs", "cgroup", "proc", "mqueue", "nfs", "cifs", "iso9660").  Further
>      types may become available when the appropriate modules are loaded.
>      --8<---------------cut here---------------end--------------->8---
>      
>      I don???t know what happens with NFS, you???ll have to tell us.
>
> The answer seems to be that it would fail unless we patch our mount syscall
> wrapper with something like:

[...]

> +                    (let ((xoptions
> +                           (cond
> +                            ((string-match "^nfs.*" type)
> +                             (let* ((hosts (string-split source #\:))
> +                                    (aa (car (getaddrinfo (car hosts)  #f)))
> +                                    (sa (addrinfo:addr aa))
> +                                    (inet-addr (inet-ntop (sockaddr:fam sa)
> +                                                          (sockaddr:addr sa))))
> +                               (string-append "addr="
> +                                              inet-addr
> +                                              (if options
> +                                                  (string-append "," options)
> +                                                  ""))))
> +                            (else
> +                             options))))

The ‘mount’ binding shouldn’t try to be smart and do things like this
IMO.  However, we could have a separate helper procedure to do that, if
needed and ‘file-system-shepherd-service’ would pick the right one.

Now, we should add system tests for that, otherwise it sounds like we’re
adding code that will rarely be used and we’ll never know whether it
actually works or how it’s supposed to be used.  :-)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] gnu: Allow nfs filesystems to be automatically mounted.
  2016-11-17  9:47                       ` Ludovic Courtès
@ 2016-11-22 19:15                         ` John Darrington
  2016-11-23 22:07                           ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-22 19:15 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington


How about this, then?





* gnu/build/file-systems.scm (mount-file-system): Append target addr= when
mounting nfs filesystems.
---
 gnu/build/file-systems.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 0d55e91..c6fc784 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -481,7 +481,21 @@ run a file system check."
              (call-with-output-file mount-point (const #t)))
            (mkdir-p mount-point))
 
-       (mount source mount-point type flags options)
+       (mount source mount-point type flags
+              (cond
+               ((string-match "^nfs.*" type)
+                (let* ((host (car (string-split source #\:)))
+                       (aa (car (getaddrinfo host #f)))
+                       (sa (addrinfo:addr aa))
+                       (inet-addr (inet-ntop (sockaddr:fam sa)
+                                             (sockaddr:addr sa))))
+                  (string-append "addr="
+                                 inet-addr
+                                 (if options
+                                     (string-append "," options)
+                                     ""))))
+               (else
+                options)))
 
        ;; For read-only bind mounts, an extra remount is needed, as per
        ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs filesystems to be automatically mounted.
  2016-11-22 19:15                         ` [PATCH] gnu: Allow nfs filesystems to be automatically mounted John Darrington
@ 2016-11-23 22:07                           ` Ludovic Courtès
  2016-11-23 23:32                             ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-23 22:07 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <jmd@gnu.org> skribis:

> How about this, then?
>
>
>
>
>
> * gnu/build/file-systems.scm (mount-file-system): Append target addr= when
> mounting nfs filesystems.
> ---
>  gnu/build/file-systems.scm | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
> index 0d55e91..c6fc784 100644
> --- a/gnu/build/file-systems.scm
> +++ b/gnu/build/file-systems.scm
> @@ -481,7 +481,21 @@ run a file system check."
>               (call-with-output-file mount-point (const #t)))
>             (mkdir-p mount-point))
>  
> -       (mount source mount-point type flags options)
> +       (mount source mount-point type flags
> +              (cond
> +               ((string-match "^nfs.*" type)
> +                (let* ((host (car (string-split source #\:)))
> +                       (aa (car (getaddrinfo host #f)))
> +                       (sa (addrinfo:addr aa))
> +                       (inet-addr (inet-ntop (sockaddr:fam sa)
> +                                             (sockaddr:addr sa))))
> +                  (string-append "addr="
> +                                 inet-addr
> +                                 (if options
> +                                     (string-append "," options)
> +                                     ""))))
> +               (else
> +                options)))

Looking at mount(8), it seems that the normal way is for ‘source’ to be
something like “knuth.cwi.nl:/dir”.  The kernel then takes care of
parsing that and doing name resolution somehow.

In that case, we don’t have anything to do, good for us.

mount(8) doesn’t mention ‘addr’.  Do you have documentation about it?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs filesystems to be automatically mounted.
  2016-11-23 22:07                           ` Ludovic Courtès
@ 2016-11-23 23:32                             ` John Darrington
  2016-11-24 16:08                               ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-23 23:32 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 4031 bytes --]

On Wed, Nov 23, 2016 at 11:07:27PM +0100, Ludovic Court??s wrote:
     John Darrington <jmd@gnu.org> skribis:
     
     > * gnu/build/file-systems.scm (mount-file-system): Append target addr= when
     > mounting nfs filesystems.
     > ---
     >  gnu/build/file-systems.scm | 16 +++++++++++++++-
     >  1 file changed, 15 insertions(+), 1 deletion(-)
     >
     > diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
     > index 0d55e91..c6fc784 100644
     > --- a/gnu/build/file-systems.scm
     > +++ b/gnu/build/file-systems.scm
     > @@ -481,7 +481,21 @@ run a file system check."
     >               (call-with-output-file mount-point (const #t)))
     >             (mkdir-p mount-point))
     >  
     > -       (mount source mount-point type flags options)
     > +       (mount source mount-point type flags
     > +              (cond
     > +               ((string-match "^nfs.*" type)
     > +                (let* ((host (car (string-split source #\:)))
     > +                       (aa (car (getaddrinfo host #f)))
     > +                       (sa (addrinfo:addr aa))
     > +                       (inet-addr (inet-ntop (sockaddr:fam sa)
     > +                                             (sockaddr:addr sa))))
     > +                  (string-append "addr="
     > +                                 inet-addr
     > +                                 (if options
     > +                                     (string-append "," options)
     > +                                     ""))))
     > +               (else
     > +                options)))
     
     Looking at mount(8), it seems that the normal way is for ???source??? to be
     something like ???knuth.cwi.nl:/dir???.  The kernel then takes care of
     parsing that and doing name resolution somehow.
     
     In that case, we don???t have anything to do, good for us.

Unforunately that is not the case.  :(

Attempting to mount a NFS system by a direct system call will fail unless you
pass addr= as an option (try it if you don't believe me).  The mount.nfs
command when used with -v shows what actually goes on:

$ sudo  mount.nfs -v 192.168.0.125:/export/junk  /mnt
 mount.nfs: timeout set for Wed Nov 23 23:50:43 2016
 mount.nfs: trying text-based options 'vers=4.2,addr=192.168.0.125,clientaddr=192.168.0.22'
 mount.nfs: mount(2): Protocol not supported
 mount.nfs: trying text-based options 'vers=4.1,addr=192.168.0.125,clientaddr=192.168.0.22'
 mount.nfs: mount(2): No such file or directory
 mount.nfs: trying text-based options 'addr=192.168.0.125'
 mount.nfs: prog 100003, trying vers=3, prot=6
 mount.nfs: trying 192.168.0.125 prog 100003 vers 3 prot TCP port 2049
 mount.nfs: prog 100005, trying vers=3, prot=17
 mount.nfs: trying 192.168.0.125 prog 100005 vers 3 prot UDP port 45585
 192.168.0.125:/export/junk on /mnt type nfs

As you can see, it does a kind of crude protocol negotiation with the server.

It's also instructive to experiment a bit by running a command like:

 sudo strace mount -v :/export/junk  -o addr=192.168.0.125 /mnt
in which one can see the system call: 
mount(":/export/junk", "/mnt", "nfs", MS_MGC_VAL, "addr=192.168.0.125") = 0

However running the same command but dropping the option will result in:
 sudo strace mount -v :/export/junk  /mnt
mount(":/export/junk", "/mnt", "nfs", MS_MGC_VAL, NULL) = -1 EINVAL (Invalid argument)


So I think we really do need this patch or something similar to it.


     mount(8) doesn???t mention ???addr???.  Do you have documentation about it?

This aspect of NFS is poorly documented.  The best I found is a discussion at
http://stackoverflow.com/questions/28350912/nfs-mount-system-call-in-linux


     
J'
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs filesystems to be automatically mounted.
  2016-11-23 23:32                             ` John Darrington
@ 2016-11-24 16:08                               ` Ludovic Courtès
  2016-11-26  9:36                                 ` [PATCH] gnu: Allow nfs file systems " John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-24 16:08 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> It's also instructive to experiment a bit by running a command like:
>
>  sudo strace mount -v :/export/junk  -o addr=192.168.0.125 /mnt
> in which one can see the system call: 
> mount(":/export/junk", "/mnt", "nfs", MS_MGC_VAL, "addr=192.168.0.125") = 0

Oooh, in that case the patch makes perfect sense.  Thanks for
explaining!

> diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
> index 0d55e91..c6fc784 100644
> --- a/gnu/build/file-systems.scm
> +++ b/gnu/build/file-systems.scm
> @@ -481,7 +481,21 @@ run a file system check."
>               (call-with-output-file mount-point (const #t)))
>             (mkdir-p mount-point))
>  
> -       (mount source mount-point type flags options)
> +       (mount source mount-point type flags
> +              (cond
> +               ((string-match "^nfs.*" type)
> +                (let* ((host (car (string-split source #\:)))
> +                       (aa (car (getaddrinfo host #f)))
> +                       (sa (addrinfo:addr aa))
> +                       (inet-addr (inet-ntop (sockaddr:fam sa)
> +                                             (sockaddr:addr sa))))
> +                  (string-append "addr="
> +                                 inet-addr
> +                                 (if options
> +                                     (string-append "," options)
> +                                     ""))))
> +               (else
> +                options)))

Could we write it as:

  (if (string-prefix? "nfs" type)
      (mount-nfs source mount-point type flags options)
      (mount source mount-point type flags options))

and have a separate:

  (define (mount-nfs source mount-point type flags options)
    …)

?

Also, the code above must be changed to use ‘match’ instead of ‘car’.

It should be (getaddrinfo host "nfs") instead of (getaddrinfo host #f).

I’m assuming the syntax for SOURCE doesn’t allow one to specify a TCP
port.  Is this correct?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-24 16:08                               ` Ludovic Courtès
@ 2016-11-26  9:36                                 ` John Darrington
  2016-11-26 18:37                                   ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-26  9:36 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/build/file-systems.scm (mount-file-system): Append target addr= when
mounting nfs filesystems.
---
 gnu/build/file-systems.scm | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index c6fc784..ca788ec 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -464,6 +464,22 @@ form:
 DEVICE, MOUNT-POINT, and TYPE must be strings; OPTIONS can be a string or #f;
 FLAGS must be a list of symbols.  CHECK? is a Boolean indicating whether to
 run a file system check."
+
+  (define (mount-nfs source mount-point type flags options)
+    (let* ((host (match (string-split source #\:) ((h _) h)))
+           (aa (car (getaddrinfo host "nfs")))
+           (sa (addrinfo:addr aa))
+           (inet-addr (inet-ntop (sockaddr:fam sa)
+                                 (sockaddr:addr sa))))
+
+      ;; Mounting an NFS file system requires passing the address
+      ;; of the server in the addr= option
+      (mount source mount-point type flags
+             (string-append "addr="
+                            inet-addr
+                            (if options
+                                (string-append "," options)
+                                "")))))
   (match spec
     ((source title mount-point type (flags ...) options check?)
      (let ((source      (canonicalize-device-spec source title))
@@ -481,21 +497,11 @@ run a file system check."
              (call-with-output-file mount-point (const #t)))
            (mkdir-p mount-point))
 
-       (mount source mount-point type flags
-              (cond
-               ((string-match "^nfs.*" type)
-                (let* ((host (car (string-split source #\:)))
-                       (aa (car (getaddrinfo host #f)))
-                       (sa (addrinfo:addr aa))
-                       (inet-addr (inet-ntop (sockaddr:fam sa)
-                                             (sockaddr:addr sa))))
-                  (string-append "addr="
-                                 inet-addr
-                                 (if options
-                                     (string-append "," options)
-                                     ""))))
-               (else
-                options)))
+       (cond
+        ((string-match "^nfs.*" type)
+         (mount-nfs source mount-point type flags options))
+        (else
+         (mount source mount-point type flags options)))
 
        ;; For read-only bind mounts, an extra remount is needed, as per
        ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-26  9:36                                 ` [PATCH] gnu: Allow nfs file systems " John Darrington
@ 2016-11-26 18:37                                   ` Ludovic Courtès
  2016-11-26 19:33                                     ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-26 18:37 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <jmd@gnu.org> skribis:

> * gnu/build/file-systems.scm (mount-file-system): Append target addr= when
> mounting nfs filesystems.

Looks like you forgot to address some of suggestions I made
(‘string-prefix?’, ‘match’, etc.) and left a question unanswered (port
number?):

  https://lists.gnu.org/archive/html/guix-devel/2016-11/msg00949.html

TIA!

Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-26 18:37                                   ` Ludovic Courtès
@ 2016-11-26 19:33                                     ` John Darrington
  2016-11-28 13:59                                       ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-26 19:33 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

On Sat, Nov 26, 2016 at 07:37:15PM +0100, Ludovic Court??s wrote:
     John Darrington <jmd@gnu.org> skribis:
     
     > * gnu/build/file-systems.scm (mount-file-system): Append target addr= when
     > mounting nfs filesystems.
     
     Looks like you forgot to address some of suggestions I made
     (???string-prefix????, 

Ok.  I will make that change.

     ???match???, 

Have another look: +    (let* ((host (match (string-split source #\:) ((h _) h)))


     and left a question unanswered (port number?):

Sorry.  The answer is, no so far as I'm aware, there is no convention which 
allows a port number to  be specifed in the source field.

     , etc)

The only other thing I think you mentioned was using "if" instead of "cond".
I can envisage that in the future there will be a need for other cases,  - 
it's not just an either/or choice - so it seemed to me that cond was more 
appropriate.
     
I am aware there is room for improvement in this patch (for example in the 
case of IP6 addresses?)  - any help will be gratefully accepted.

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-26 19:33                                     ` John Darrington
@ 2016-11-28 13:59                                       ` Ludovic Courtès
  2016-11-28 14:07                                         ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-28 13:59 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> On Sat, Nov 26, 2016 at 07:37:15PM +0100, Ludovic Court??s wrote:
>      John Darrington <jmd@gnu.org> skribis:
>      
>      > * gnu/build/file-systems.scm (mount-file-system): Append target addr= when
>      > mounting nfs filesystems.
>      
>      Looks like you forgot to address some of suggestions I made
>      (???string-prefix????, 
>
> Ok.  I will make that change.
>
>      ???match???, 
>
> Have another look: +    (let* ((host (match (string-split source #\:) ((h _) h)))

Right, but there are other occurrences of ‘car’ for ‘getaddrinfo’.  :-)

>      and left a question unanswered (port number?):
>
> Sorry.  The answer is, no so far as I'm aware, there is no convention which 
> allows a port number to  be specifed in the source field.

OK (this would have changed the way ‘source’ is parsed.)

>      , etc)
>
> The only other thing I think you mentioned was using "if" instead of "cond".
> I can envisage that in the future there will be a need for other cases,  - 
> it's not just an either/or choice - so it seemed to me that cond was more 
> appropriate.
>      
> I am aware there is room for improvement in this patch (for example in the 
> case of IP6 addresses?)  - any help will be gratefully accepted.

‘getaddrinfo’ can return both IPv4 and IPv6 addresses, so in theory,
the patch is IPv6 Ready.

Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-28 13:59                                       ` Ludovic Courtès
@ 2016-11-28 14:07                                         ` John Darrington
  2016-11-28 21:05                                           ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-28 14:07 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

On Mon, Nov 28, 2016 at 02:59:09PM +0100, Ludovic Court??s wrote:
     >      ???match???, 
     >
     > Have another look: +    (let* ((host (match (string-split source #\:) ((h _) h)))
     
     Right, but there are other occurrences of ???car??? for ???getaddrinfo???.  :-)

But that occurance applies to a real list, rather than a list used as record.
In other words, I really do just want to get the first item of that list.
As I understand it, match is supposed to be used for heterogenous lists where
each member has its own semantics.  That is not the case here.

Obviously, I could write (match ... (x . _) x) but I don't see what benefit that
brings.
     

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-28 14:07                                         ` John Darrington
@ 2016-11-28 21:05                                           ` Ludovic Courtès
  2016-11-29  6:27                                             ` John Darrington
  0 siblings, 1 reply; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-28 21:05 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> On Mon, Nov 28, 2016 at 02:59:09PM +0100, Ludovic Court??s wrote:
>      >      ???match???, 
>      >
>      > Have another look: +    (let* ((host (match (string-split source #\:) ((h _) h)))
>      
>      Right, but there are other occurrences of ???car??? for ???getaddrinfo???.  :-)
>
> But that occurance applies to a real list, rather than a list used as record.
> In other words, I really do just want to get the first item of that list.
> As I understand it, match is supposed to be used for heterogenous lists where
> each member has its own semantics.  That is not the case here.

‘match’ can be used to match anything, and I highly recommend using it
for lists (info "(guile) Pairs"): it generates clearer and foolproof
code.

In this case ‘getaddrinfo’ might well return an empty list.

Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-28 21:05                                           ` Ludovic Courtès
@ 2016-11-29  6:27                                             ` John Darrington
  2016-11-29 21:51                                               ` Ludovic Courtès
  0 siblings, 1 reply; 32+ messages in thread
From: John Darrington @ 2016-11-29  6:27 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1597 bytes --]

On Mon, Nov 28, 2016 at 10:05:15PM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     > On Mon, Nov 28, 2016 at 02:59:09PM +0100, Ludovic Court??s wrote:
     >      >      ???match???, 
     >      >
     >      > Have another look: +    (let* ((host (match (string-split source #\:) ((h _) h)))
     >      
     >      Right, but there are other occurrences of ???car??? for ???getaddrinfo???.  :-)
     >
     > But that occurance applies to a real list, rather than a list used as record.
     > In other words, I really do just want to get the first item of that list.
     > As I understand it, match is supposed to be used for heterogenous lists where
     > each member has its own semantics.  That is not the case here.
     
     ???match??? can be used to match anything, and I highly recommend using it
     for lists (info "(guile) Pairs"): it generates clearer and foolproof
     code.
     
     In this case ???getaddrinfo??? might well return an empty list.
     
So then "car" would raise an error (unless I check it first with pair?) - just
as match would raise an error unless I add a catch-all case.  I'm still not 
convinced that match has any advantages in this case.

However I've changed it despite that, and pushed this patch to master.  I hope
it's ok.

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] gnu: Allow nfs file systems to be automatically mounted.
  2016-11-29  6:27                                             ` John Darrington
@ 2016-11-29 21:51                                               ` Ludovic Courtès
  0 siblings, 0 replies; 32+ messages in thread
From: Ludovic Courtès @ 2016-11-29 21:51 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> On Mon, Nov 28, 2016 at 10:05:15PM +0100, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>      
>      > On Mon, Nov 28, 2016 at 02:59:09PM +0100, Ludovic Court??s wrote:
>      >      >      ???match???, 
>      >      >
>      >      > Have another look: +    (let* ((host (match (string-split source #\:) ((h _) h)))
>      >      
>      >      Right, but there are other occurrences of ???car??? for ???getaddrinfo???.  :-)
>      >
>      > But that occurance applies to a real list, rather than a list used as record.
>      > In other words, I really do just want to get the first item of that list.
>      > As I understand it, match is supposed to be used for heterogenous lists where
>      > each member has its own semantics.  That is not the case here.
>      
>      ???match??? can be used to match anything, and I highly recommend using it
>      for lists (info "(guile) Pairs"): it generates clearer and foolproof
>      code.
>      
>      In this case ???getaddrinfo??? might well return an empty list.
>      
> So then "car" would raise an error (unless I check it first with pair?) - just
> as match would raise an error unless I add a catch-all case.  I'm still not 
> convinced that match has any advantages in this case.
>
> However I've changed it despite that, and pushed this patch to master.  I hope
> it's ok.

No big deal, but it’s not what I meant.

An expression like:

  (let ((x (match lst1 ((a . b) a)))
        (y (match lst2 ((a . b) a))))
    …)

is almost equivalent to using ‘car’ twice, only more verbose.  That is,
the cases where ‘lst1’ or ‘lst2’ is empty are not handled (‘match’
raises an exception.)

The real gain is when each case is explicitly separated and handled:

  (match lst1
    ((x . _)
     (match lst2
       ((y . _)
        (do-something x y))
       (_
        (error "lst2 is empty"))))
    (_
     (error "lst1 is bogus")))

In this case we’d want to gracefully handle syntax errors in ‘source’
and host name lookup failures for instance.

Ludo’.

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2016-11-29 21:51 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-10 21:14 [PATCH 1/4] gnu: Separate util-linux into three packages John Darrington
2016-11-10 21:14 ` [PATCH 2/4] gnu: nfs-utils: Change input from util-linux to util-linux/mount John Darrington
2016-11-10 21:14 ` [PATCH 3/4] gnu: Move util-linux/mount to new file and deal with the effects John Darrington
2016-11-10 21:14 ` [PATCH 4/4] Add fs-search paths to util-linux John Darrington
2016-11-11 14:43 ` [PATCH 1/4] gnu: Separate util-linux into three packages Hartmut Goebel
2016-11-11 16:03   ` John Darrington
2016-11-11 16:40     ` Hartmut Goebel
2016-11-11 19:36       ` John Darrington
2016-11-12 14:53 ` Ludovic Courtès
2016-11-12 15:28   ` John Darrington
2016-11-12 17:09     ` John Darrington
2016-11-12 22:55       ` Ludovic Courtès
2016-11-13  8:21         ` John Darrington
2016-11-13 11:59           ` Ludovic Courtès
2016-11-13 14:06             ` John Darrington
2016-11-14  9:48               ` Ludovic Courtès
2016-11-14 17:46                 ` John Darrington
2016-11-15 10:46                   ` Ludovic Courtès
2016-11-16 21:06                     ` mount syscall John Darrington
2016-11-17  9:47                       ` Ludovic Courtès
2016-11-22 19:15                         ` [PATCH] gnu: Allow nfs filesystems to be automatically mounted John Darrington
2016-11-23 22:07                           ` Ludovic Courtès
2016-11-23 23:32                             ` John Darrington
2016-11-24 16:08                               ` Ludovic Courtès
2016-11-26  9:36                                 ` [PATCH] gnu: Allow nfs file systems " John Darrington
2016-11-26 18:37                                   ` Ludovic Courtès
2016-11-26 19:33                                     ` John Darrington
2016-11-28 13:59                                       ` Ludovic Courtès
2016-11-28 14:07                                         ` John Darrington
2016-11-28 21:05                                           ` Ludovic Courtès
2016-11-29  6:27                                             ` John Darrington
2016-11-29 21:51                                               ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).