Attachment "globnoc.diff" to
ticket [1084705fff]
added by
vincentdarley
2006-03-20 02:16:52.
? globnoc.diff
? win/config.status.lineno
Index: generic/tclFileName.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclFileName.c,v
retrieving revision 1.73
diff -b -u -r1.73 tclFileName.c
--- generic/tclFileName.c 23 Oct 2005 18:51:31 -0000 1.73
+++ generic/tclFileName.c 19 Mar 2006 19:14:08 -0000
@@ -1610,9 +1610,7 @@
* occurred in globbing. After a normal return the result in interp (set
* by DoGlob) holds all of the file names given by the pattern and
* pathPrefix arguments. After an error the result in interp will hold
- * an error message, unless the 'TCL_GLOBMODE_NO_COMPLAIN' flag was
- * given, in which case an error results in a TCL_OK return leaving the
- * interpreter's result unmodified.
+ * an error message.
*
* Side effects:
* The 'pattern' is written to.
@@ -1681,23 +1679,11 @@
c = *tail;
*tail = '\0';
- if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) {
- /*
- * We will ignore any error message here, and we don't want to
- * mess up the interpreter's result.
- */
- head = DoTildeSubst(NULL, start+1, &buffer);
- } else {
head = DoTildeSubst(interp, start+1, &buffer);
- }
*tail = c;
if (head == NULL) {
- if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) {
- return TCL_OK;
- } else {
return TCL_ERROR;
}
- }
if (head != Tcl_DStringValue(&buffer)) {
Tcl_DStringAppend(&buffer, head, -1);
}
@@ -1773,12 +1759,8 @@
if (cwd == NULL) {
Tcl_DecrRefCount(temp);
- if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) {
- return TCL_OK;
- } else {
return TCL_ERROR;
}
- }
pathPrefix = Tcl_NewStringObj(Tcl_GetString(cwd), 3);
Tcl_DecrRefCount(cwd);
if (tail[0] == '/') {
@@ -1869,11 +1851,6 @@
if (result != TCL_OK) {
TclDecrRefCount(filenamesObj);
- if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) {
- /* Put back the old result and reset the return code */
- Tcl_SetObjResult(interp, savedResultObj);
- result = TCL_OK;
- }
TclDecrRefCount(savedResultObj);
if (pathPrefix != NULL) {
Tcl_DecrRefCount(pathPrefix);
Index: tests/fileName.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/fileName.test,v
retrieving revision 1.49
diff -b -u -r1.49 fileName.test
--- tests/fileName.test 12 Oct 2005 22:05:46 -0000 1.49
+++ tests/fileName.test 19 Mar 2006 19:14:11 -0000
@@ -689,8 +689,8 @@
list [catch {glob -nocomplain} msg] $msg
} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
test filename-11.5 {Tcl_GlobCmd} {
- list [catch {glob -nocomplain ~xyqrszzz} msg] $msg
-} {0 {}}
+ list [catch {glob -nocomplain * ~xyqrszzz} msg] $msg
+} {1 {user "xyqrszzz" doesn't exist}}
test filename-11.6 {Tcl_GlobCmd} {
list [catch {glob ~xyqrszzz} msg] $msg
} {1 {user "xyqrszzz" doesn't exist}}
@@ -707,7 +707,7 @@
test filename-11.10 {Tcl_GlobCmd} {testsetplatform} {
testsetplatform unix
list [catch {glob -nocomplain ~\\xyqrszzz/bar} msg] $msg
-} {0 {}}
+} {1 {user "\xyqrszzz" doesn't exist}}
test filename-11.11 {Tcl_GlobCmd} {testsetplatform} {
testsetplatform unix
list [catch {glob ~xyqrszzz\\/\\bar} msg] $msg
@@ -1370,11 +1370,20 @@
# outser and welch users exists
glob -nocomplain ~ouster ~foo ~welch
} {/home/ouster /home/welch}
-test filename-15.4.1 {no complain: no errors, good result} {
+test filename-15.4.1 {no complain: errors, sequencing} {
+ # test used to fail because if an error occurs, the interp's result
+ # is reset... But, the sequence means we throw a different error
+ # first.
+ concat \
+ [list [catch {glob -nocomplain ~wontexist ~blahxyz ~} res1] $res1] \
+ [list [catch {glob -nocomplain ~ ~blahxyz ~wontexist} res2] $res2]
+} {1 {user "wontexist" doesn't exist} 1 {user "blahxyz" doesn't exist}}
+test filename-15.4.2 {no complain: errors, sequencing} {
# test used to fail because if an error occurs, the interp's result
# is reset...
- string equal [glob -nocomplain ~wontexist ~blah ~] \
- [glob -nocomplain ~ ~blah ~wontexist]
+ string equal \
+ [list [catch {glob -nocomplain ~wontexist *} res1] $res1] \
+ [list [catch {glob -nocomplain * ~wontexist} res2] $res2]
} {1}
test filename-15.5 {unix specific globbing} {unix nonPortable} {
glob ~ouster/.csh*