unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] linux-boot: Make /etc/mtab a symlink to /proc/self/mounts.
@ 2015-01-05 14:28 宋文武
  2015-01-05 16:45 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: 宋文武 @ 2015-01-05 14:28 UTC (permalink / raw)
  To: guix-devel

Fixes <http://bugs.gnu.org/19491>.

* gnu/build/linux-boot.scm (mount-root-file-system): Make /root/etc/mtab
  a symlink to /proc/self/mounts.
* gnu/build/file-systems.scm (mount-file-system): Don't update /etc/mtab.
* guix/build/syscalls.scm (mount, umount): Have #:update-mtab? default to
  #f.
---
 gnu/build/file-systems.scm | 9 +--------
 gnu/build/linux-boot.scm   | 5 ++++-
 guix/build/syscalls.scm    | 4 ++--
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 84f5853..38e4851 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -287,13 +287,6 @@ run a file system check."
        (mount source mount-point type (mount-flags->bit-mask flags)
               (if options
                   (string->pointer options)
-                  %null-pointer))
-
-       ;; Update /etc/mtab.
-       (mkdir-p (string-append root "/etc"))
-       (let ((port (open-file (string-append root "/etc/mtab") "a")))
-         (format port "~a ~a ~a ~a 0 0~%"
-                 source mount-point type (or options "rw"))
-         (close-port port))))))
+                  %null-pointer))))))
 
 ;;; file-systems.scm ends here
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index b2ed1a8..3096989 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -275,7 +275,10 @@ UNIONFS."
         (check-file-system root type)
         (mount root "/root" type)))
 
-  (copy-file "/proc/mounts" "/root/etc/mtab"))
+  ;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts.
+  (when (file-exists? "/root/etc/mtab")
+    (delete-file "/root/etc/mtab"))
+  (symlink "/proc/self/mounts" "/root/etc/mtab"))
 
 (define (switch-root root)
   "Switch to ROOT as the root file system, in a way similar to what
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index b210f8f..b62a8cc 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -130,7 +130,7 @@
   (let* ((ptr  (dynamic-func "mount" (dynamic-link)))
          (proc (pointer->procedure int ptr `(* * * ,unsigned-long *))))
     (lambda* (source target type #:optional (flags 0) options
-                     #:key (update-mtab? #t))
+                     #:key (update-mtab? #f))
       "Mount device SOURCE on TARGET as a file system TYPE.  Optionally, FLAGS
 may be a bitwise-or of the MS_* <sys/mount.h> constants, and OPTIONS may be a
 string.  When FLAGS contains MS_REMOUNT, SOURCE and TYPE are ignored.  When
@@ -159,7 +159,7 @@ error."
   (let* ((ptr  (dynamic-func "umount2" (dynamic-link)))
          (proc (pointer->procedure int ptr `(* ,int))))
     (lambda* (target #:optional (flags 0)
-                     #:key (update-mtab? #t))
+                     #:key (update-mtab? #f))
       "Unmount TARGET.  Optionally FLAGS may be one of the MNT_* or UMOUNT_*
 constants from <sys/mount.h>."
       (let ((ret (proc (string->pointer target) flags))
-- 
2.1.2

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

* Re: [PATCH] linux-boot: Make /etc/mtab a symlink to /proc/self/mounts.
  2015-01-05 14:28 [PATCH] linux-boot: Make /etc/mtab a symlink to /proc/self/mounts 宋文武
@ 2015-01-05 16:45 ` Ludovic Courtès
  2015-01-06 11:16   ` 宋文武
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2015-01-05 16:45 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> Fixes <http://bugs.gnu.org/19491>.
>
> * gnu/build/linux-boot.scm (mount-root-file-system): Make /root/etc/mtab
>   a symlink to /proc/self/mounts.
> * gnu/build/file-systems.scm (mount-file-system): Don't update /etc/mtab.
> * guix/build/syscalls.scm (mount, umount): Have #:update-mtab? default to
>   #f.

Assuming you noticed no regressions (with ‘guix system vm’ or ‘guix
system reconfigure’ on bare metal), please push.

Thanks!

Ludo’.

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

* Re: [PATCH] linux-boot: Make /etc/mtab a symlink to /proc/self/mounts.
  2015-01-05 16:45 ` Ludovic Courtès
@ 2015-01-06 11:16   ` 宋文武
  0 siblings, 0 replies; 3+ messages in thread
From: 宋文武 @ 2015-01-06 11:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> Fixes <http://bugs.gnu.org/19491>.
>>
>> * gnu/build/linux-boot.scm (mount-root-file-system): Make /root/etc/mtab
>>   a symlink to /proc/self/mounts.
>> * gnu/build/file-systems.scm (mount-file-system): Don't update /etc/mtab.
>> * guix/build/syscalls.scm (mount, umount): Have #:update-mtab? default to
>>   #f.
>
> Assuming you noticed no regressions (with ‘guix system vm’ or ‘guix
> system reconfigure’ on bare metal), please push.
Done, thanks for review.
>
> Thanks!
>
> Ludo’.

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

end of thread, other threads:[~2015-01-06 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-05 14:28 [PATCH] linux-boot: Make /etc/mtab a symlink to /proc/self/mounts 宋文武
2015-01-05 16:45 ` Ludovic Courtès
2015-01-06 11:16   ` 宋文武

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).