GNU bug report logs - #56880
[PATCH] gnu: system: file-systems: Add shared flag.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Oleg Pykhalov <go.wigust@HIDDEN>; Keywords: patch; dated Tue, 2 Aug 2022 11:24:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Aug 2022 11:23:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 02 07:23:41 2022
Received: from localhost ([127.0.0.1]:42621 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oIpzw-0004hx-Pb
	for submit <at> debbugs.gnu.org; Tue, 02 Aug 2022 07:23:41 -0400
Received: from lists.gnu.org ([209.51.188.17]:40126)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <go.wigust@HIDDEN>) id 1oIpzt-0004ho-Pp
 for submit <at> debbugs.gnu.org; Tue, 02 Aug 2022 07:23:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56264)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <go.wigust@HIDDEN>)
 id 1oIpzt-0003p8-9V
 for guix-patches@HIDDEN; Tue, 02 Aug 2022 07:23:37 -0400
Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:35708)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <go.wigust@HIDDEN>)
 id 1oIpzr-0006ah-HY
 for guix-patches@HIDDEN; Tue, 02 Aug 2022 07:23:37 -0400
Received: by mail-lj1-x229.google.com with SMTP id r14so15299045ljp.2
 for <guix-patches@HIDDEN>; Tue, 02 Aug 2022 04:23:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc;
 bh=SYDtzaZCM1fPNQkDpol6W2O7XDXyRxROLUjHYsS5gPk=;
 b=mJtOGOfHy6hnIRVn7LoN3TiHvGnbrcgQ2aQi6Dd2kruoU2+jQufXzYtjtj7K7YNiFV
 8bjfr2x3+F2QXmjFAHPxp+sChjB3vOA07Pz6qJNKiLGEOlU6DPreLXqYxHocCbcq8JIl
 t2KSAcTQNAdeM9DzqE6XiZdCGw1zqpxoCYW6QBeQEKNmf8Fzo6wmrUqqXW5jf2oJtPch
 z4LC8w5qk17rOGq4Macv4n9Gg9mJFUwid20YtgvtVPIP0AE/Hb6Cmw/nn68LbdHfRlAR
 EUdrGeZ6iTThcfoTLEoBNMRF457njlMW4C4dFQe1REZ5okMgj9lWilEtDIFOP/HZ0QOt
 6qOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc;
 bh=SYDtzaZCM1fPNQkDpol6W2O7XDXyRxROLUjHYsS5gPk=;
 b=FaWsPO/vPdDu8WtWq5Y+v1+8nicoBPIKeYGlEEnufgG8Hr/hJLJK8jgR0nnGaqkzyH
 Spo+RrsCAdbvjQJERFP+33sYEa3rMoZDzyl74QHUoVIIIX28gvON64FXo1U6uije75hy
 vyvZy4EGIgmpzVMGFZh3rT66VqkTWWl45yc84XdlEuWaPDXD6lQmCslJNhSKflO4x2nt
 q8jf4ZGieXuCOa2FUAjnffp4YoPLx4OzaI5DbSRIrX4IAKbVIAm+3FeoqFnrFxjo55ji
 q0Nz3ISD4NVa/ndFSyrDiJ6LAQrhn7+SDo79YbhVtfLS6Hx4rYt6SHIlxyyFJEOxt8J+
 OdRQ==
X-Gm-Message-State: AJIora/jGSetcOVHqaYYKPXq3+/VxAXM92oseGh6gVm0sHUGagfuj2MN
 DofemiACEcg8n4/4CnlcpBpWbVa8+Tw=
X-Google-Smtp-Source: AGRyM1s14SZOrvjepJVAF75tXRrUgSjEwTBkB4W2XGV7ow9uQl3RVonPU2sKLiZWY81iV+QZh6wRyQ==
X-Received: by 2002:a05:651c:b13:b0:25d:8342:e11 with SMTP id
 b19-20020a05651c0b1300b0025d83420e11mr6053396ljr.266.1659439411436; 
 Tue, 02 Aug 2022 04:23:31 -0700 (PDT)
Received: from guixsd.wugi.info ([88.201.161.72])
 by smtp.gmail.com with ESMTPSA id
 j7-20020a2e6e07000000b0025e65b3b24csm54936ljc.4.2022.08.02.04.23.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 02 Aug 2022 04:23:30 -0700 (PDT)
From: Oleg Pykhalov <go.wigust@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: system: file-systems: Add shared flag.
Date: Tue,  2 Aug 2022 14:23:09 +0300
Message-Id: <20220802112309.28423-1-go.wigust@HIDDEN>
X-Mailer: git-send-email 2.37.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::229;
 envelope-from=go.wigust@HIDDEN; helo=mail-lj1-x229.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Oleg Pykhalov <go.wigust@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

* gnu/build/file-systems.scm (mount-flags->bit-mask, mount-file-system):
Handle shared flag.
* gnu/system/file-systems.scm (invalid-file-system-flags): Add shared to known
flags.
* guix/build/syscalls.scm (MS_SHARED): New variable.
(option-string->mount-flags): Handle shared flag.
* doc/guix.texi (File Systems): Document shared flag.
---
 doc/guix.texi               | 5 +++--
 gnu/build/file-systems.scm  | 6 ++++++
 gnu/system/file-systems.scm | 4 +++-
 guix/build/syscalls.scm     | 6 +++++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9d17050ffc..106ab428d9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -16376,8 +16376,9 @@ include @code{read-only}, @code{bind-mount}, @code{no-dev} (disallow
 access to special files), @code{no-suid} (ignore setuid and setgid
 bits), @code{no-atime} (do not update file access times),
 @code{strict-atime} (update file access time), @code{lazy-time} (only
-update time on the in-memory version of the file inode), and
-@code{no-exec} (disallow program execution).
+update time on the in-memory version of the file inode),
+@code{no-exec} (disallow program execution), and @code{shared} (make the
+mount shared).
 @xref{Mount-Unmount-Remount,,, libc, The GNU C Library Reference
 Manual}, for more information on these flags.
 
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 1d3b33e7bd..b9d46c9350 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <me@HIDDEN>
 ;;; Copyright © 2019 David C. Trudgian <dave@HIDDEN>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
+;;; Copyright © 2022 Oleg Pykhalov <go.wigust@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1123,6 +1124,8 @@ (define (mount-flags->bit-mask flags)
        (logior MS_STRICTATIME (loop rest)))
       (('lazy-time rest ...)
        (logior MS_LAZYTIME (loop rest)))
+      (('shared rest ...)
+       (loop rest))
       (()
        0))))
 
@@ -1186,6 +1189,9 @@ (define (mount-nfs source mount-point type flags options)
         (cond
          ((string-prefix? "nfs" type)
           (mount-nfs source target type flags options))
+         ((memq 'shared (file-system-flags fs))
+          (mount source target type flags options)
+          (mount "none" target #f MS_SHARED))
          (else
           (mount source target type flags options)))
 
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index f8f4276283..464b76a2ca 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@HIDDEN>
 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@HIDDEN>
+;;; Copyright © 2022 Oleg Pykhalov <go.wigust@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -121,7 +122,8 @@ (define invalid-file-system-flags
     ;; Note: Keep in sync with 'mount-flags->bit-mask'.
     (let ((known-flags '(read-only
                          bind-mount no-suid no-dev no-exec
-                         no-atime strict-atime lazy-time)))
+                         no-atime strict-atime lazy-time
+                         shared)))
       (lambda (flags)
         "Return the subset of FLAGS that is invalid."
         (remove (cut memq <> known-flags) flags))))
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index a7401fd73f..ef0b1d67fd 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@HIDDEN>
 ;;; Copyright © 2021 Chris Marusich <cmmarusich@HIDDEN>
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@HIDDEN>
+;;; Copyright © 2022 Oleg Pykhalov <go.wigust@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,6 +50,7 @@ (define-module (guix build syscalls)
             MS_RELATIME
             MS_BIND
             MS_MOVE
+            MS_SHARED
             MS_LAZYTIME
             MNT_FORCE
             MNT_DETACH
@@ -537,6 +539,7 @@ (define MS_REMOUNT           32)
 (define MS_NOATIME         1024)
 (define MS_BIND            4096)
 (define MS_MOVE            8192)
+(define MS_SHARED       1048576)
 (define MS_RELATIME     2097152)
 (define MS_STRICTATIME 16777216)
 (define MS_LAZYTIME    33554432)
@@ -637,7 +640,8 @@ (define lst
                         ("nodev"      => MS_NODEV)
                         ("noexec"     => MS_NOEXEC)
                         ("relatime"   => MS_RELATIME)
-                        ("noatime"    => MS_NOATIME)))))))
+                        ("noatime"    => MS_NOATIME)
+                        ("shared"     => MS_SHARED)))))))
 
 (define (mount-flags mount)
   "Return the mount flags of MOUNT, a <mount> record, as an inclusive or of
-- 
2.37.0





Acknowledgement sent to Oleg Pykhalov <go.wigust@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#56880; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 2 Aug 2022 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.