summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-06-23 10:21:15 (GMT)
committervincentdarley <vincentdarley>2003-06-23 10:21:15 (GMT)
commit413f218a68dc50e3fc9d85fe2a67501baf2e7b5c (patch)
tree10ccde0a31ac8fea50b2ab3d79facaaeb9a90025
parent97af27dfed36a48c534a0e1414a74b7cea47c6a4 (diff)
downloadtcl-413f218a68dc50e3fc9d85fe2a67501baf2e7b5c.zip
tcl-413f218a68dc50e3fc9d85fe2a67501baf2e7b5c.tar.gz
tcl-413f218a68dc50e3fc9d85fe2a67501baf2e7b5c.tar.bz2
file copy empty filename bug fix
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclFCmd.c10
-rw-r--r--tests/fCmd.test12
3 files changed, 26 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e99622..afa497f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-23 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tclFCmd.c: fix to bad error message when trying to
+ do 'file copy foo ""'. [Bug 756951]
+ * tests/fCmd.test: added two new tests for the bug.
+
2003-06-18 Miguel Sofer <msofer@users.sf.net>
* generic/tclNamesp.c (Tcl_Export): removed erroneous comments
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index 50bea95..a105f6e 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclFCmd.c,v 1.20 2002/08/08 10:41:22 hobbs Exp $
+ * RCS: @(#) $Id: tclFCmd.c,v 1.20.2.1 2003/06/23 10:21:16 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -658,6 +658,14 @@ CopyRenameOneFile(interp, source, target, copyFlag, force)
* so it should be quite clear
*/
errfile = target;
+ /*
+ * We now need to reset the result, because the above call,
+ * if it failed, may have put an error message in place.
+ * (Ideally we would prefer not to pass an interpreter in
+ * above, but the channel IO code used by
+ * TclCrossFilesystemCopy currently requires one)
+ */
+ Tcl_ResetResult(interp);
}
}
if ((copyFlag == 0) && (result == TCL_OK)) {
diff --git a/tests/fCmd.test b/tests/fCmd.test
index c704032..8e4d265 100644
--- a/tests/fCmd.test
+++ b/tests/fCmd.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: fCmd.test,v 1.26.2.1 2003/04/14 15:45:54 vincentdarley Exp $
+# RCS: @(#) $Id: fCmd.test,v 1.26.2.2 2003/06/23 10:21:16 vincentdarley Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -1001,6 +1001,16 @@ test fCmd-10.10 {file copy: comprehensive: source and target incompatible} \
createfile tf1
list [catch {file copy -force tf1 td1} msg] $msg
} [subst {1 {can't overwrite directory "[file join td1 tf1]" with file "tf1"}}]
+test fCmd-10.11 {file copy: copy to empty file name} {
+ cleanup
+ createfile tf1
+ list [catch {file copy tf1 ""} msg] $msg
+} {1 {error copying "tf1" to "": no such file or directory}}
+test fCmd-10.12 {file rename: rename to empty file name} {
+ cleanup
+ createfile tf1
+ list [catch {file rename tf1 ""} msg] $msg
+} {1 {error renaming "tf1" to "": no such file or directory}}
cleanup
# old tests