Commit 02042929 authored by Russ Fish's avatar Russ Fish
Browse files

Mike reported a problem with duplicating experiments. I've seen it too.

It only happens with old experiments with no archive yet.

There's a missing code path getting the ns file in CopyInArchive().
Get the old experiment nsfile from the db in that case.
parent 63c0bdc7
......@@ -1169,6 +1169,7 @@ sub CopyInArchive()
if (!defined($copyarg));
my $dstdir = "$userdir/archive/nsdata";
$tempnsfile = "$dstdir/nsfile.ns";
if ($copyfrom eq "exp") {
......@@ -1184,6 +1185,33 @@ sub CopyInArchive()
fatal("CopyInArchive: Failed to copy ${srcdir} to $dstdir");
else {
# This is a really old experiment with no archive yet.
# Get the old experiment nsfile from the db.
my $query_result =
DBQueryFatal("select nsfile from nsfiles ".
"where pid='$copypid' and eid='$copyeid'");
tbdie("No such experiment in DB for $copypid/$copyeid\n")
if (!$query_result->numrows);
my ($nsfile) = $query_result->fetchrow_array();
tbdie("No nsfile in DB for $copypid/$copyeid\n")
if (!defined($nsfile) || $nsfile eq "");
if (! -e "$dstdir") {
mkdir("$dstdir", 0775)
or fatal("Failed to mkdir $dstdir for copy");
open(NS, "> $tempnsfile")
or tbdie("Could not write ns code to $tempnsfile!\n");
$nsfile =~ s/\r//g;
print NS $nsfile;
print NS "\n";
chmod(0664, "$tempnsfile");
else {
......@@ -1198,7 +1226,6 @@ sub CopyInArchive()
== 0 or fatal("CopyInArchive: Checking out archive");
$tempnsfile = "$dstdir/nsfile.ns";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment