[PATCH core-updates-frozen] openresolv: Wrap it.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Vivien Kraus
Owner
unassigned
Submitted by
Vivien Kraus
Severity
normal

Debbugs page

Vivien Kraus wrote 3 years ago
(address . guix-patches@gnu.org)
8735nq5sz2.fsf@planete-kraus.eu
Dear guix,

When I boot my system on core-updates-frozen, I get an error message:

/gnu/store/xxx-openresolv-3.12.0/sbin/resolvconf: line 824: mkdir: command not found
Failed to create needed directory /var/run/resolvconf

I didn’t experience any DNS issue, but my network is simple on that
machine. In any case, I think it would do no harm to wrap resolvconf to
set its path to the coreutils so that it can find mkdir and rm. I didn’t
find resolvconf to invoke any other program.

What do you think?

Best regards,

Vivien
From 426c613e226b5c7e041d6a8476c09abfeffe151c Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Sat, 20 Nov 2021 23:48:17 +0100
Subject: [PATCH] gnu: openresolv: Wrap resolvconf.

* gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
coreutils programs mkdir and rm.
* gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
to run the wrapper and the wrapped script.
---
gnu/packages/dns.scm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index b289aa999e..55c6c0d82d 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -1417,7 +1417,18 @@ (define-public openresolv
#:configure-flags
(list (string-append "--sysconfdir=/etc"))
#:make-flags
- (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
+ (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (coreutils (assoc-ref inputs "coreutils")))
+ (wrap-program (string-append out "/sbin/resolvconf")
+ `("PATH" ":" = (,(string-append coreutils "/bin"))))))))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("coreutils" ,coreutils)))
(home-page "https://roy.marples.name/projects/openresolv/")
(synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
(description "openresolv is an implementation of @command{resolvconf}, the
--
2.34.0
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCAAdFiEEq4yIHjMvkliPpwQnO7C8EjLYuCwFAmGZfxIACgkQO7C8EjLY
uCywHAwArRad4xqQm169UWQ46b2zxkLJhU2IVK7pUXRnYr9Af5/pLz6RfN+do84R
3/lkxWDvYbAreAfe1caosfrLMxqS4HrvaNsiprIe+wwzD8+H4A0+RaiMYnU/z/qZ
/jlZsjVDfI9NOGB6Vf9aLdozQfsumpRp/LuxgvDPVZjrAS4A53I2Xw2NSS15PXN9
9C2ljG6+z4LOA4Dnk4b/Ma7o+a+tLDzlSkw8FoclPZpxywPEBpplHUgj0sefAOpv
YPUOWxgP4lBbN5LOvrLvDBVW4durP2/Wh1oyAzahGtQLZe9DgmQtJBxOEUdLh4X4
VnuulkuZ/onGF0wx1rWoNRF6msL/+QfrNSzthCPLMxyQn8KbhbGu3FjUO9WOUqPd
yMd+vDmwMVmcfxgZFSFkAquME1N7Fk4AKjqGDQMVxTo2fCxpteOZCHxcFKSZ7g34
cgMZ204KG2ylN4F0LGLzBUALiMCmUY3uwdP++/RW3IhMIE5mm11gHaVZPJPt/+7x
GhUwSwqJ
=xR6T
-----END PGP SIGNATURE-----

Ludovic Courtès wrote 3 years ago
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)(address . 52009@debbugs.gnu.org)
877dczn9p0.fsf@gnu.org
Vivien Kraus <vivien@planete-kraus.eu> skribis:

Toggle quote (10 lines)
> From 426c613e226b5c7e041d6a8476c09abfeffe151c Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <vivien@planete-kraus.eu>
> Date: Sat, 20 Nov 2021 23:48:17 +0100
> Subject: [PATCH] gnu: openresolv: Wrap resolvconf.
>
> * gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
> coreutils programs mkdir and rm.
> * gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
> to run the wrapper and the wrapped script.

[...]

Toggle quote (10 lines)
> + (add-after 'install 'wrap-program
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out"))
> + (coreutils (assoc-ref inputs "coreutils")))
> + (wrap-program (string-append out "/sbin/resolvconf")
> + `("PATH" ":" = (,(string-append coreutils "/bin"))))))))))
> + (inputs
> + `(("bash-minimal" ,bash-minimal)
> + ("coreutils" ,coreutils)))

Since /sbin/resolvconf is a shell script, how about, instead of wrapping
it, inserting with ‘substitute*’ something like:

PATH=/gnu/store/…-coreutils/bin:$PATH

somewhere at the top?

That would be more lightweight.

(We could also use ‘coreutils-minimal’ here.)

Thanks,
Ludo’.
Vivien Kraus wrote 3 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 52009@debbugs.gnu.org)
87zgpvkfeu.fsf@planete-kraus.eu
Ludovic Courtès <ludo@gnu.org> writes:
Toggle quote (18 lines)
> Vivien Kraus <vivien@planete-kraus.eu> skribis:
>> + (add-after 'install 'wrap-program
>> + (lambda* (#:key inputs outputs #:allow-other-keys)
>> + (let ((out (assoc-ref outputs "out"))
>> + (coreutils (assoc-ref inputs "coreutils")))
>> + (wrap-program (string-append out "/sbin/resolvconf")
>> + `("PATH" ":" = (,(string-append coreutils "/bin"))))))))))
>> + (inputs
>> + `(("bash-minimal" ,bash-minimal)
>> + ("coreutils" ,coreutils)))
>
> Since /sbin/resolvconf is a shell script, how about, instead of wrapping
> it, inserting with ‘substitute*’ something like:
>
> PATH=/gnu/store/…-coreutils/bin:$PATH
>
> somewhere at the top?

Good idea.

Toggle quote (2 lines)
> (We could also use ‘coreutils-minimal’ here.)

It contains the required binaries, so let’s go with it.

Vivien
From 8b26dda4284de0c3db8aa40c5d9ddd6130ded590 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Sat, 20 Nov 2021 23:48:17 +0100
Subject: [PATCH] gnu: openresolv: Wrap resolvconf.

* gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
coreutils programs mkdir and rm.
* gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
to run the wrapper and the wrapped script.
---
gnu/packages/dns.scm | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

Toggle diff (30 lines)
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index b289aa999e..f025b2242b 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -1417,7 +1417,22 @@ (define-public openresolv
#:configure-flags
(list (string-append "--sysconfdir=/etc"))
#:make-flags
- (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
+ (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (coreutils (assoc-ref inputs "coreutils-minimal")))
+ (substitute* (string-append out "/sbin/resolvconf")
+ (("RESOLVCONF=\"\\$0\"")
+ (format #f "\
+RESOLVCONF=\"$0\"
+PATH=~a/bin:$PATH"
+ coreutils)))))))))
+ (inputs
+ `(("bash-minimal" ,bash-minimal)
+ ("coreutils-minimal" ,coreutils-minimal)))
(home-page "https://roy.marples.name/projects/openresolv/")
(synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
(description "openresolv is an implementation of @command{resolvconf}, the
--
2.34.0
Ludovic Courtès wrote 3 years ago
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)(address . 52009-done@debbugs.gnu.org)
8735nnn7c2.fsf_-_@gnu.org
Vivien Kraus <vivien@planete-kraus.eu> skribis:

Toggle quote (10 lines)
>>From 8b26dda4284de0c3db8aa40c5d9ddd6130ded590 Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <vivien@planete-kraus.eu>
> Date: Sat, 20 Nov 2021 23:48:17 +0100
> Subject: [PATCH] gnu: openresolv: Wrap resolvconf.
>
> * gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
> coreutils programs mkdir and rm.
> * gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
> to run the wrapper and the wrapped script.

That was fast! Applied without “bash-minimal” (it’s no longer needed.)

Thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 52009@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 52009
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help