diff mbox series

[bug#36023] linux-boot: Fix e2fsck warning.

Message ID 20190531112735.15985-1-dannym@scratchpost.org
State Accepted
Headers show
Series [bug#36023] linux-boot: Fix e2fsck warning. | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Danny Milosavljevic May 31, 2019, 11:27 a.m. UTC
* gnu/build/linux-boot.scm (boot-system): Fix e2fsck warning.
---
 gnu/build/linux-boot.scm | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ludovic Courtès June 1, 2019, 1:13 p.m. UTC | #1
Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * gnu/build/linux-boot.scm (boot-system): Fix e2fsck warning.

Oooh, thanks for fixing this one.  LGTM!

Ludo’.
Danny Milosavljevic June 3, 2019, 4:09 p.m. UTC | #2
Thanks for the review!

Pushed it to guix master as commit aa901521e4e5625dd8a63e67a64be2f562ca61c7.
Jonathan Brielmaier June 3, 2019, 4:17 p.m. UTC | #3
On 5/31/19 1:27 PM, Danny Milosavljevic wrote:
> +       (setenv "EXT2FS_NO_MTAB_OK" "1")
> +
[...]
> +       (setenv "EXT2FS_NO_MTAB_OK" #f)
> +

Maybe it would be nice to have them constintly using either "0" and "1"
or #t and #f :)
Danny Milosavljevic June 3, 2019, 4:53 p.m. UTC | #4
Hi Jonathan,

On Mon, 3 Jun 2019 18:17:14 +0200
Jonathan Brielmaier <jonathan.brielmaier@web.de> wrote:

> On 5/31/19 1:27 PM, Danny Milosavljevic wrote:
> > +       (setenv "EXT2FS_NO_MTAB_OK" "1")
> > +  
> [...]
> > +       (setenv "EXT2FS_NO_MTAB_OK" #f)
> > +  
> 
> Maybe it would be nice to have them constintly using either "0" and "1"
> or #t and #f :)

Well, the UNIX environment interface and/or Guile's interface to it doesn't
work that way.  The UNIX environment is a string array.

e2fsck uses if(getenv("EXT2FS_NO_MTAB_OK")) to read the value of the entry
with the key "EXT2FS_NO_MTAB_OK".

So we can set the environment entry to any value we want and e2fsck's "if"
condition will evaluate to true.

And in order to remove it from the environment again, we call setenv with
#f.

We could also call unsetenv instead, I guess.  Should we?
Jonathan Brielmaier June 3, 2019, 5:01 p.m. UTC | #5
On 6/3/19 6:53 PM, Danny Milosavljevic wrote:
> Hi Jonathan,
>
> On Mon, 3 Jun 2019 18:17:14 +0200
> Jonathan Brielmaier <jonathan.brielmaier@web.de> wrote:
>
>> On 5/31/19 1:27 PM, Danny Milosavljevic wrote:
>>> +       (setenv "EXT2FS_NO_MTAB_OK" "1")
>>> +
>> [...]
>>> +       (setenv "EXT2FS_NO_MTAB_OK" #f)
>>> +
>>
>> Maybe it would be nice to have them constintly using either "0" and "1"
>> or #t and #f :)
>
> Well, the UNIX environment interface and/or Guile's interface to it doesn't
> work that way.  The UNIX environment is a string array.
>
> e2fsck uses if(getenv("EXT2FS_NO_MTAB_OK")) to read the value of the entry
> with the key "EXT2FS_NO_MTAB_OK".
>
> So we can set the environment entry to any value we want and e2fsck's "if"
> condition will evaluate to true.
>
> And in order to remove it from the environment again, we call setenv with
> #f.
>
> We could also call unsetenv instead, I guess.  Should we?

Ah, oke. Thanks for the explanation. I think we can leave it as it is...
diff mbox series

Patch

diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index a35d18ad7c..03f2ea245c 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -517,6 +517,8 @@  upon error."
          (unless (pre-mount)
            (error "pre-mount actions failed")))
 
+       (setenv "EXT2FS_NO_MTAB_OK" "1")
+
        (if root
            ;; The "--root=SPEC" kernel command-line option always provides a
            ;; string, but the string can represent a device, a UUID, or a
@@ -533,6 +535,8 @@  upon error."
        (for-each mount-file-system
                  (remove root-mount-point? mounts))
 
+       (setenv "EXT2FS_NO_MTAB_OK" #f)
+
        (if to-load
            (begin
              (switch-root "/root")