From f719b5268e82e58f47383dc3de12ede8858baed4 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 1 Feb 2010 15:12:49 +0000 Subject: [PATCH] * qemu-kvm: honour $TMPDIR for the qemu-smb temporary directory. This ensures that Nix cleans up the qemu-smb directory after a VM test run (which prevents failures like this one: http://hydra.nixos.org/build/275355/nixlog/31/raw). svn path=/nixpkgs/trunk/; revision=19747 --- pkgs/os-specific/linux/qemu-kvm/default.nix | 2 +- .../linux/qemu-kvm/smb-tmpdir.patch | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/linux/qemu-kvm/smb-tmpdir.patch diff --git a/pkgs/os-specific/linux/qemu-kvm/default.nix b/pkgs/os-specific/linux/qemu-kvm/default.nix index 1334bbd2e36e..945fb05ca62d 100644 --- a/pkgs/os-specific/linux/qemu-kvm/default.nix +++ b/pkgs/os-specific/linux/qemu-kvm/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { sha256 = "0nmg9dp3h040dkxq5vv4i7ip76v98rnhzqwy4pd88zznawc2k9l2"; }; - patches = [ ./unix-domain.patch ]; + patches = [ ./unix-domain.patch ./smb-tmpdir.patch ]; buildInputs = [zlib SDL alsaLib pkgconfig pciutils]; diff --git a/pkgs/os-specific/linux/qemu-kvm/smb-tmpdir.patch b/pkgs/os-specific/linux/qemu-kvm/smb-tmpdir.patch new file mode 100644 index 000000000000..c30ba9429dd9 --- /dev/null +++ b/pkgs/os-specific/linux/qemu-kvm/smb-tmpdir.patch @@ -0,0 +1,25 @@ +Honour $TMPDIR for the qemu-smb temporary directory. + +diff -rc -x '*~' qemu-kvm-0.12.2-orig/net/slirp.c qemu-kvm-0.12.2/net/slirp.c +*** qemu-kvm-0.12.2-orig/net/slirp.c 2010-01-18 19:48:25.000000000 +0100 +--- qemu-kvm-0.12.2/net/slirp.c 2010-02-01 15:56:43.000000000 +0100 +*************** +*** 480,486 **** + char smb_cmdline[128]; + FILE *f; + +! snprintf(s->smb_dir, sizeof(s->smb_dir), "/tmp/qemu-smb.%ld-%d", + (long)getpid(), instance++); + if (mkdir(s->smb_dir, 0700) < 0) { + qemu_error("could not create samba server dir '%s'\n", s->smb_dir); +--- 480,489 ---- + char smb_cmdline[128]; + FILE *f; + +! char *tmpdir = getenv("TMPDIR"); +! +! snprintf(s->smb_dir, sizeof(s->smb_dir), "%s/qemu-smb.%ld-%d", +! tmpdir ? tmpdir : "/tmp", + (long)getpid(), instance++); + if (mkdir(s->smb_dir, 0700) < 0) { + qemu_error("could not create samba server dir '%s'\n", s->smb_dir);