* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
@ 2017-12-28 8:32 Rutger Helling
2017-12-28 17:35 ` Marius Bakke
0 siblings, 1 reply; 10+ messages in thread
From: Rutger Helling @ 2017-12-28 8:32 UTC (permalink / raw)
To: 29875, ludo
[-- Attachment #1.1: Type: text/plain, Size: 493 bytes --]
This patch adds a small hack to get Samba support working on QEMU,
without actually pulling it in as an input.
It seems to work surprisingly well. The only bad thing is that you need
to explicitly install Samba in your profile for Samba support. There's
no error if you try to run something like -net user,smb=/tmp without
having Samba installed in your profile. QEMU will just merrily keep on
running while not actually starting a Samba server.
I've also updated the URL of QEMU.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-qemu-Add-wrapper-for-Samba.patch --]
[-- Type: text/x-patch, Size: 2956 bytes --]
From f45a7663f646b195222dc4426b19884147051f05 Mon Sep 17 00:00:00 2001
From: Rutger Helling <rhelling@mykolab.com>
Date: Thu, 28 Dec 2017 08:57:28 +0100
Subject: [PATCH] gnu: qemu: Add wrapper for Samba.
* gnu/packages/virtualization.scm (qemu)[arguments]: Change #:configure-flags to
a list, add --smbd flag. Add 'create-samba-wrapper phase.
[home-page]: Update URL.
---
gnu/packages/virtualization.scm | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 0e4feb7b1..1584580ad 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -96,7 +96,10 @@
'(;; Running tests in parallel can occasionally lead to failures, like:
;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
#:parallel-tests? #f
- #:configure-flags '("--enable-usb-redir" "--enable-opengl")
+ #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
+ (string-append "--smbd="
+ (assoc-ref %outputs "out")
+ "/libexec/samba-wrapper"))
#:phases
(modify-phases %standard-phases
(replace 'configure
@@ -135,6 +138,21 @@
(install-file info infodir))
(find-files "." "\\.info"))
#t))))))
+ ;; Create a wrapper for Samba. This allows QEMU to use Samba without
+ ;; pulling it in as an input. Note that you need to explicitly install
+ ;; Samba in your Guix profile for Samba support.
+ (add-after 'install-info 'create-samba-wrapper
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref %outputs "out"))
+ (libexec (string-append out "/libexec")))
+ (system* "touch" "samba-wrapper")
+ (call-with-output-file "samba-wrapper"
+ (lambda (port)
+ (format port "#!/bin/sh
+ exec smbd $@")))
+ (chmod "samba-wrapper" #o755)
+ (install-file "samba-wrapper" libexec))
+ #t))
(add-before 'check 'make-gtester-verbose
(lambda _
;; Make GTester verbose to facilitate investigation upon failure.
@@ -176,7 +194,7 @@
("pkg-config" ,pkg-config)
("python" ,python-2) ; incompatible with Python 3 according to error message
("texinfo" ,texinfo)))
- (home-page "http://www.qemu-project.org")
+ (home-page "https://www.qemu.org")
(synopsis "Machine emulator and virtualizer")
(description
"QEMU is a generic machine emulator and virtualizer.
--
2.15.1
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2017-12-28 8:32 [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba Rutger Helling
@ 2017-12-28 17:35 ` Marius Bakke
2017-12-28 23:07 ` bug#29875: " Rutger Helling
2017-12-29 13:28 ` [bug#29875] " Ludovic Courtès
0 siblings, 2 replies; 10+ messages in thread
From: Marius Bakke @ 2017-12-28 17:35 UTC (permalink / raw)
To: Rutger Helling, 29875, ludo
[-- Attachment #1: Type: text/plain, Size: 2812 bytes --]
Rutger Helling <rhelling@mykolab.com> writes:
> This patch adds a small hack to get Samba support working on QEMU,
> without actually pulling it in as an input.
Awesome :)
> It seems to work surprisingly well. The only bad thing is that you need
> to explicitly install Samba in your profile for Samba support. There's
> no error if you try to run something like -net user,smb=/tmp without
> having Samba installed in your profile. QEMU will just merrily keep on
> running while not actually starting a Samba server.
Huh, I would have expected a warning at least. But not complaining :)
> I've also updated the URL of QEMU.
Can you push that as a separate patch?
> From f45a7663f646b195222dc4426b19884147051f05 Mon Sep 17 00:00:00 2001
> From: Rutger Helling <rhelling@mykolab.com>
> Date: Thu, 28 Dec 2017 08:57:28 +0100
> Subject: [PATCH] gnu: qemu: Add wrapper for Samba.
>
> * gnu/packages/virtualization.scm (qemu)[arguments]: Change #:configure-flags to
> a list, add --smbd flag. Add 'create-samba-wrapper phase.
> [home-page]: Update URL.
[...]
> diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
> index 0e4feb7b1..1584580ad 100644
> --- a/gnu/packages/virtualization.scm
> +++ b/gnu/packages/virtualization.scm
> @@ -96,7 +96,10 @@
> '(;; Running tests in parallel can occasionally lead to failures, like:
> ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
> #:parallel-tests? #f
> - #:configure-flags '("--enable-usb-redir" "--enable-opengl")
> + #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
> + (string-append "--smbd="
> + (assoc-ref %outputs "out")
> + "/libexec/samba-wrapper"))
Reading the script, would it work to simply pass "--smbd=smbd" here?
[...]
> + ;; Create a wrapper for Samba. This allows QEMU to use Samba without
> + ;; pulling it in as an input. Note that you need to explicitly install
> + ;; Samba in your Guix profile for Samba support.
> + (add-after 'install-info 'create-samba-wrapper
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let* ((out (assoc-ref %outputs "out"))
> + (libexec (string-append out "/libexec")))
> + (system* "touch" "samba-wrapper")
> + (call-with-output-file "samba-wrapper"
> + (lambda (port)
> + (format port "#!/bin/sh
> + exec smbd $@")))
> + (chmod "samba-wrapper" #o755)
> + (install-file "samba-wrapper" libexec))
> + #t))
The "touch" here is unnecessary.
If the above is insufficient, this LGTM.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#29875: [PATCH] gnu: qemu: Add wrapper for Samba.
2017-12-28 17:35 ` Marius Bakke
@ 2017-12-28 23:07 ` Rutger Helling
2017-12-29 13:28 ` [bug#29875] " Ludovic Courtès
1 sibling, 0 replies; 10+ messages in thread
From: Rutger Helling @ 2017-12-28 23:07 UTC (permalink / raw)
To: Marius Bakke; +Cc: 29875-done
[-- Attachment #1: Type: text/plain, Size: 3338 bytes --]
Hi Marius,
thanks for the review! I've pushed it as two seperate patches, minus
the "touch" command.
I tried the "--smbd=smbd" command and a bunch of variants,
unfortunately that just causes QEMU to complain about missing smbd and
quit immediately.
On Thu, 28 Dec 2017 18:35:55 +0100
Marius Bakke <mbakke@fastmail.com> wrote:
> Rutger Helling <rhelling@mykolab.com> writes:
>
> > This patch adds a small hack to get Samba support working on QEMU,
> > without actually pulling it in as an input.
>
> Awesome :)
>
> > It seems to work surprisingly well. The only bad thing is that you
> > need to explicitly install Samba in your profile for Samba support.
> > There's no error if you try to run something like -net
> > user,smb=/tmp without having Samba installed in your profile. QEMU
> > will just merrily keep on running while not actually starting a
> > Samba server.
>
> Huh, I would have expected a warning at least. But not complaining :)
>
> > I've also updated the URL of QEMU.
>
> Can you push that as a separate patch?
>
> > From f45a7663f646b195222dc4426b19884147051f05 Mon Sep 17 00:00:00
> > 2001 From: Rutger Helling <rhelling@mykolab.com>
> > Date: Thu, 28 Dec 2017 08:57:28 +0100
> > Subject: [PATCH] gnu: qemu: Add wrapper for Samba.
> >
> > * gnu/packages/virtualization.scm (qemu)[arguments]: Change
> > #:configure-flags to a list, add --smbd flag. Add
> > 'create-samba-wrapper phase. [home-page]: Update URL.
>
> [...]
>
> > diff --git a/gnu/packages/virtualization.scm
> > b/gnu/packages/virtualization.scm index 0e4feb7b1..1584580ad 100644
> > --- a/gnu/packages/virtualization.scm
> > +++ b/gnu/packages/virtualization.scm
> > @@ -96,7 +96,10 @@
> > '(;; Running tests in parallel can occasionally lead to
> > failures, like: ;; boot_sector_test: assertion failed (signature ==
> > SIGNATURE): (0x00000000 == 0x0000dead) #:parallel-tests? #f
> > - #:configure-flags '("--enable-usb-redir" "--enable-opengl")
> > + #:configure-flags (list "--enable-usb-redir"
> > "--enable-opengl"
> > + (string-append "--smbd="
> > + (assoc-ref %outputs
> > "out")
> > +
> > "/libexec/samba-wrapper"))
>
> Reading the script, would it work to simply pass "--smbd=smbd" here?
>
> [...]
>
> > + ;; Create a wrapper for Samba. This allows QEMU to use
> > Samba without
> > + ;; pulling it in as an input. Note that you need to
> > explicitly install
> > + ;; Samba in your Guix profile for Samba support.
> > + (add-after 'install-info 'create-samba-wrapper
> > + (lambda* (#:key inputs outputs #:allow-other-keys)
> > + (let* ((out (assoc-ref %outputs "out"))
> > + (libexec (string-append out "/libexec")))
> > + (system* "touch" "samba-wrapper")
> > + (call-with-output-file "samba-wrapper"
> > + (lambda (port)
> > + (format port "#!/bin/sh
> > + exec smbd $@")))
> > + (chmod "samba-wrapper" #o755)
> > + (install-file "samba-wrapper" libexec))
> > + #t))
>
> The "touch" here is unnecessary.
>
> If the above is insufficient, this LGTM.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2017-12-28 17:35 ` Marius Bakke
2017-12-28 23:07 ` bug#29875: " Rutger Helling
@ 2017-12-29 13:28 ` Ludovic Courtès
2017-12-29 14:02 ` Rutger Helling
1 sibling, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2017-12-29 13:28 UTC (permalink / raw)
To: Marius Bakke; +Cc: 29875, Rutger Helling
Hello!
Marius Bakke <mbakke@fastmail.com> skribis:
> Rutger Helling <rhelling@mykolab.com> writes:
[...]
>> + ;; Create a wrapper for Samba. This allows QEMU to use Samba without
>> + ;; pulling it in as an input. Note that you need to explicitly install
>> + ;; Samba in your Guix profile for Samba support.
>> + (add-after 'install-info 'create-samba-wrapper
>> + (lambda* (#:key inputs outputs #:allow-other-keys)
>> + (let* ((out (assoc-ref %outputs "out"))
>> + (libexec (string-append out "/libexec")))
>> + (system* "touch" "samba-wrapper")
>> + (call-with-output-file "samba-wrapper"
>> + (lambda (port)
>> + (format port "#!/bin/sh
>> + exec smbd $@")))
>> + (chmod "samba-wrapper" #o755)
>> + (install-file "samba-wrapper" libexec))
>> + #t))
Why not patch qemu to use exec*p instead of exec* so that ‘smbd’ is
searched for in $PATH?
The wrapper does the job, but it looks more complex to me than this
initial suggestion.
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2017-12-29 13:28 ` [bug#29875] " Ludovic Courtès
@ 2017-12-29 14:02 ` Rutger Helling
2018-01-07 10:44 ` Ludovic Courtès
0 siblings, 1 reply; 10+ messages in thread
From: Rutger Helling @ 2017-12-29 14:02 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 29875
[-- Attachment #1: Type: text/plain, Size: 1916 bytes --]
Hi Ludo,
I'm not sure it's as simple as that. AFAIK "/usr/sbin/smbd" only
appears in the configure file. You can modify it by specifying
smbd=/location/of/binary, which it then builds into the qemu* binaries.
I think it has to be a single binary (full path) with no arguments at
all or it doesn't work. That's why I chose to do it in this way.
Maybe someone more familiar with the QEMU source code can do it by
patching the source code itself, but I would have no idea how to go
about it. Plus I'm not sure if that would end up being less complex, or
if it's even possible at all.
On Fri, 29 Dec 2017 14:28:53 +0100
ludo@gnu.org (Ludovic Courtès) wrote:
> Hello!
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
> > Rutger Helling <rhelling@mykolab.com> writes:
>
> [...]
>
> >> + ;; Create a wrapper for Samba. This allows QEMU to use
> >> Samba without
> >> + ;; pulling it in as an input. Note that you need to
> >> explicitly install
> >> + ;; Samba in your Guix profile for Samba support.
> >> + (add-after 'install-info 'create-samba-wrapper
> >> + (lambda* (#:key inputs outputs #:allow-other-keys)
> >> + (let* ((out (assoc-ref %outputs "out"))
> >> + (libexec (string-append out "/libexec")))
> >> + (system* "touch" "samba-wrapper")
> >> + (call-with-output-file "samba-wrapper"
> >> + (lambda (port)
> >> + (format port "#!/bin/sh
> >> + exec smbd $@")))
> >> + (chmod "samba-wrapper" #o755)
> >> + (install-file "samba-wrapper" libexec))
> >> + #t))
>
> Why not patch qemu to use exec*p instead of exec* so that ‘smbd’ is
> searched for in $PATH?
>
> The wrapper does the job, but it looks more complex to me than this
> initial suggestion.
>
> Ludo’.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2017-12-29 14:02 ` Rutger Helling
@ 2018-01-07 10:44 ` Ludovic Courtès
2018-01-07 11:46 ` Rutger Helling
0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2018-01-07 10:44 UTC (permalink / raw)
To: Rutger Helling; +Cc: 29875
Hi Rutger,
Rutger Helling <rhelling@mykolab.com> skribis:
> I'm not sure it's as simple as that. AFAIK "/usr/sbin/smbd" only
> appears in the configure file. You can modify it by specifying
> smbd=/location/of/binary, which it then builds into the qemu* binaries.
> I think it has to be a single binary (full path) with no arguments at
> all or it doesn't work. That's why I chose to do it in this way.
>
> Maybe someone more familiar with the QEMU source code can do it by
> patching the source code itself, but I would have no idea how to go
> about it. Plus I'm not sure if that would end up being less complex, or
> if it's even possible at all.
Looking more carefully, ‘fork_exec’ in slirp/misc.c already uses
‘execvp’ (meaning that the executable is searched for in $PATH), so it
may be that configuring with:
--smbd=smbd
is enough to have ‘smbd’ searched for in $PATH, no?
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2018-01-07 10:44 ` Ludovic Courtès
@ 2018-01-07 11:46 ` Rutger Helling
2018-01-07 14:13 ` Ludovic Courtès
0 siblings, 1 reply; 10+ messages in thread
From: Rutger Helling @ 2018-01-07 11:46 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 29875
[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]
Hi Ludo,
I tried that at the start already actually, unfortunately it doesn't
work. It'll refuse to start with the following message:
qemu-system-x86_64: -net user,smb=~/tmp: Could not find 'smbd',
please install it.
On Sun, 07 Jan 2018 11:44:35 +0100
ludo@gnu.org (Ludovic Courtès) wrote:
> Hi Rutger,
>
> Rutger Helling <rhelling@mykolab.com> skribis:
>
> > I'm not sure it's as simple as that. AFAIK "/usr/sbin/smbd" only
> > appears in the configure file. You can modify it by specifying
> > smbd=/location/of/binary, which it then builds into the qemu*
> > binaries. I think it has to be a single binary (full path) with no
> > arguments at all or it doesn't work. That's why I chose to do it in
> > this way.
> >
> > Maybe someone more familiar with the QEMU source code can do it by
> > patching the source code itself, but I would have no idea how to go
> > about it. Plus I'm not sure if that would end up being less
> > complex, or if it's even possible at all.
>
> Looking more carefully, ‘fork_exec’ in slirp/misc.c already uses
> ‘execvp’ (meaning that the executable is searched for in $PATH), so it
> may be that configuring with:
>
> --smbd=smbd
>
> is enough to have ‘smbd’ searched for in $PATH, no?
>
> Thanks,
> Ludo’.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2018-01-07 11:46 ` Rutger Helling
@ 2018-01-07 14:13 ` Ludovic Courtès
2018-01-07 14:26 ` Rutger Helling
0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2018-01-07 14:13 UTC (permalink / raw)
To: Rutger Helling; +Cc: 29875
Rutger Helling <rhelling@mykolab.com> skribis:
> I tried that at the start already actually, unfortunately it doesn't
> work. It'll refuse to start with the following message:
>
> qemu-system-x86_64: -net user,smb=~/tmp: Could not find 'smbd',
> please install it.
Even when ‘smbd’ is in $PATH?
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2018-01-07 14:13 ` Ludovic Courtès
@ 2018-01-07 14:26 ` Rutger Helling
2018-01-07 22:44 ` Ludovic Courtès
0 siblings, 1 reply; 10+ messages in thread
From: Rutger Helling @ 2018-01-07 14:26 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 29875
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
Indeed.
On Sun, 07 Jan 2018 15:13:13 +0100
ludo@gnu.org (Ludovic Courtès) wrote:
> Rutger Helling <rhelling@mykolab.com> skribis:
>
> > I tried that at the start already actually, unfortunately it doesn't
> > work. It'll refuse to start with the following message:
> >
> > qemu-system-x86_64: -net user,smb=~/tmp: Could not find 'smbd',
> > please install it.
>
> Even when ‘smbd’ is in $PATH?
>
> Ludo’.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba.
2018-01-07 14:26 ` Rutger Helling
@ 2018-01-07 22:44 ` Ludovic Courtès
0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2018-01-07 22:44 UTC (permalink / raw)
To: Rutger Helling; +Cc: 29875
Rutger Helling <rhelling@mykolab.com> skribis:
> Indeed.
>
> On Sun, 07 Jan 2018 15:13:13 +0100
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Rutger Helling <rhelling@mykolab.com> skribis:
>>
>> > I tried that at the start already actually, unfortunately it doesn't
>> > work. It'll refuse to start with the following message:
>> >
>> > qemu-system-x86_64: -net user,smb=~/tmp: Could not find 'smbd',
>> > please install it.
>>
>> Even when ‘smbd’ is in $PATH?
Fair enough!
Thanks,
Ludo’.
PS: Please don’t cross-post. :-)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-01-07 22:45 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-28 8:32 [bug#29875] [PATCH] gnu: qemu: Add wrapper for Samba Rutger Helling
2017-12-28 17:35 ` Marius Bakke
2017-12-28 23:07 ` bug#29875: " Rutger Helling
2017-12-29 13:28 ` [bug#29875] " Ludovic Courtès
2017-12-29 14:02 ` Rutger Helling
2018-01-07 10:44 ` Ludovic Courtès
2018-01-07 11:46 ` Rutger Helling
2018-01-07 14:13 ` Ludovic Courtès
2018-01-07 14:26 ` Rutger Helling
2018-01-07 22:44 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.