guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: syscalls: mounts: Fix a matching bug.


From: guix-commits
Subject: branch master updated: syscalls: mounts: Fix a matching bug.
Date: Tue, 16 Mar 2021 00:25:38 -0400

This is an automated email from the git hooks/post-receive script.

marusich pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new 341dfe7  syscalls: mounts: Fix a matching bug.
341dfe7 is described below

commit 341dfe7eda4972af0a027357015ea595314438b0
Author: Chris Marusich <cmmarusich@gmail.com>
AuthorDate: Thu Mar 11 23:19:30 2021 -0800

    syscalls: mounts: Fix a matching bug.
    
    On some systems, the columns in /proc/self/mountinfo look like this:
    
    23 28 0:21 / /proc rw,nosuid,nodev,noexec,relatime shared:11 - proc proc rw
    
    Before this change, the mounts procedure was written with the assumption 
that
    the type and source could always be found in columns 8 and 9, respectively.
    However, the proc(5) man page explains that there can be zero or more 
optional
    fields starting at column 7 (e.g., "shared:11" above), so this assumption is
    false in some situations.
    
    * guix/build/syscalls.scm (mounts): Update the match pattern to use ellipsis
    to match zero or more optional fields followed by a single hyphen.  Remove 
the
    trailing ellipsis, since multiple ellipses are not allowed in the same 
level.
    The proc(5) man page indicates that there are no additional columns, so it 
is
    probably OK to match an exact number of columns at the end like this.
---
 guix/build/syscalls.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 6ed11a0..4379768 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -636,8 +636,9 @@ current process."
           (if (eof-object? line)
               (reverse result)
               (match (string-tokenize line)
+                ;; See the proc(5) man page for a description of the columns.
                 ((id parent-id major:minor root mount-point
-                     options _ type source _ ...)
+                     options _ ... "-" type source _)
                  (let ((devno (string->device-number major:minor)))
                    (loop (cons (%mount (octal-decode source)
                                        (octal-decode mount-point)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]