From eb03584c16b7a1b99800e60e00ed43a73745b2d2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 28 Mar 2017 07:14:47 +0000 Subject: (experimental) new internal macro TCL_Z_MODIFIER, just like TCL_LL_MODIFIER but then for size_t. --- generic/tcl.h | 8 ++++++++ generic/tclAlloc.c | 10 +++++----- generic/tclCkalloc.c | 14 +++++++------- generic/tclExecute.c | 6 +++--- generic/tclStringObj.c | 12 ++++++------ 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 731724e..24dd0be 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -394,9 +394,11 @@ typedef long LONG; # if defined(_WIN32) # define TCL_WIDE_INT_TYPE __int64 # define TCL_LL_MODIFIER "I64" +# define TCL_Z_MODIFIER "I" # elif defined(__GNUC__) # define TCL_WIDE_INT_TYPE long long # define TCL_LL_MODIFIER "ll" +# define TCL_Z_MODIFIER "z" # else /* ! _WIN32 && ! __GNUC__ */ /* * Don't know what platform it is and configure hasn't discovered what is @@ -426,6 +428,9 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # ifndef TCL_LL_MODIFIER # define TCL_LL_MODIFIER "l" # endif /* !TCL_LL_MODIFIER */ +# ifndef TCL_Z_MODIFIER +# define TCL_Z_MODIFIER "l" +# endif /* !TCL_Z_MODIFIER */ #else /* TCL_WIDE_INT_IS_LONG */ /* * The next short section of defines are only done when not running on Windows @@ -434,6 +439,9 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # ifndef TCL_LL_MODIFIER # define TCL_LL_MODIFIER "ll" # endif /* !TCL_LL_MODIFIER */ +# ifndef TCL_Z_MODIFIER +# define TCL_Z_MODIFIER "" +# endif /* !TCL_Z_MODIFIER */ # define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) # define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) # define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 64df1a2..fbd8f6e 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -661,14 +661,14 @@ mstats( fprintf(stderr, "\nused:\t"); for (i = 0; i < NBUCKETS; i++) { - fprintf(stderr, " %" TCL_LL_MODIFIER "d", (Tcl_WideInt)numMallocs[i]); + fprintf(stderr, " %" TCL_Z_MODIFIER "d", numMallocs[i]); totalUsed += numMallocs[i] * (1 << (i + 3)); } - fprintf(stderr, "\n\tTotal small in use: %" TCL_LL_MODIFIER "d, total free: %" TCL_LL_MODIFIER "d\n", - (Tcl_WideInt)totalUsed, (Tcl_WideInt)totalFree); - fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %" TCL_LL_MODIFIER "d\n", - MAXMALLOC, (Tcl_WideInt)numMallocs[NBUCKETS]); + fprintf(stderr, "\n\tTotal small in use: %" TCL_Z_MODIFIER "d, total free: %" TCL_Z_MODIFIER "d\n", + totalUsed, totalFree); + fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %" TCL_Z_MODIFIER "d\n", + MAXMALLOC, numMallocs[NBUCKETS]); Tcl_MutexUnlock(allocMutexPtr); } diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index d42536e..394287a 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -254,7 +254,7 @@ ValidateMemory( fprintf(stderr, "low guard failed at %p, %s %d\n", memHeaderP->body, file, line); fflush(stderr); /* In case name pointer is bad. */ - fprintf(stderr, "%" TCL_LL_MODIFIER "d bytes allocated at (%s %d)\n", (Tcl_WideInt) memHeaderP->length, + fprintf(stderr, "%" TCL_Z_MODIFIER "d bytes allocated at (%s %d)\n", memHeaderP->length, memHeaderP->file, memHeaderP->line); Tcl_Panic("Memory validation failure"); } @@ -276,8 +276,8 @@ ValidateMemory( fprintf(stderr, "high guard failed at %p, %s %d\n", memHeaderP->body, file, line); fflush(stderr); /* In case name pointer is bad. */ - fprintf(stderr, "%" TCL_LL_MODIFIER "d bytes allocated at (%s %d)\n", - (Tcl_WideInt)memHeaderP->length, memHeaderP->file, + fprintf(stderr, "%" TCL_Z_MODIFIER "d bytes allocated at (%s %d)\n", + memHeaderP->length, memHeaderP->file, memHeaderP->line); Tcl_Panic("Memory validation failure"); } @@ -359,10 +359,10 @@ Tcl_DumpActiveMemory( Tcl_MutexLock(ckallocMutexPtr); for (memScanP = allocHead; memScanP != NULL; memScanP = memScanP->flink) { address = &memScanP->body[0]; - fprintf(fileP, "%8" TCL_LL_MODIFIER "x - %8" TCL_LL_MODIFIER "x %7" TCL_LL_MODIFIER "d @ %s %d %s", - (Tcl_WideInt)(size_t)address, - (Tcl_WideInt)((size_t)address + memScanP->length - 1), - (Tcl_WideInt)memScanP->length, memScanP->file, memScanP->line, + fprintf(fileP, "%8" TCL_Z_MODIFIER "x - %8" TCL_Z_MODIFIER "x %7" TCL_Z_MODIFIER "d @ %s %d %s", + (size_t)address, + ((size_t)address + memScanP->length - 1), + memScanP->length, memScanP->file, memScanP->line, (memScanP->tagPtr == NULL) ? "" : memScanP->tagPtr->string); (void) fputc('\n', fileP); } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ad80b28..98fe51d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -9477,9 +9477,9 @@ PrintByteCodeInfo( Proc *procPtr = codePtr->procPtr; Interp *iPtr = (Interp *) *codePtr->interpHandle; - fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_LL_MODIFIER "u, epoch %" TCL_LL_MODIFIER "u, interp 0x%p (epoch %" TCL_LL_MODIFIER "u)\n", - codePtr, (Tcl_WideInt)codePtr->refCount, (Tcl_WideInt)codePtr->compileEpoch, iPtr, - (Tcl_WideInt)iPtr->compileEpoch); + fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_Z_MODIFIER "u, epoch %" TCL_Z_MODIFIER "u, interp 0x%p (epoch %" TCL_Z_MODIFIER "u)\n", + codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, + (size_t)iPtr->compileEpoch); fprintf(stdout, " Source: "); TclPrintSource(stdout, codePtr->source, 60); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index b8b64d4..d12cc74 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2759,8 +2759,8 @@ TclStringRepeat( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "string size overflow: unable to alloc %" - TCL_LL_MODIFIER "u bytes", - (Tcl_WideUInt)STRING_SIZE(count*length))); + TCL_Z_MODIFIER "u bytes", + STRING_SIZE(count*length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } return TCL_ERROR; @@ -2983,8 +2983,8 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", - (Tcl_WideUInt)STRING_SIZE(length))); + TCL_Z_MODIFIER "u bytes", + STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } return TCL_ERROR; @@ -2999,8 +2999,8 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", - (Tcl_WideUInt)STRING_SIZE(length))); + TCL_Z_MODIFIER "u bytes", + STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } return TCL_ERROR; -- cgit v0.12 From cf3f133df1d082197bba097362768af248e334dc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Mar 2017 12:05:59 +0000 Subject: (more experimenting): Make TCL_LL_MODIFIER behave more close to intuitive expectations: If the platform has a "long long" type, use it for Tcl_WideInt, so TCL_LL_MODIFIER is really a replacement for "ll" on most platforms (Win32/Win64 as most notable exception). Will need a new TIP. --- doc/IntObj.3 | 2 +- generic/tcl.h | 15 +++++++-------- generic/tclIO.c | 2 +- unix/configure | 6 +++--- unix/tcl.m4 | 6 +++--- unix/tclConfig.h.in | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/IntObj.3 b/doc/IntObj.3 index dc62642..6d5ee69 100644 --- a/doc/IntObj.3 +++ b/doc/IntObj.3 @@ -97,7 +97,7 @@ are provided by the C language standard. The \fBTcl_WideInt\fR type is a typedef defined to be whatever signed integral type covers at least the 64-bit integer range (-9223372036854775808 to 9223372036854775807). Depending on the platform and the C compiler, the actual type might be -\fBlong int\fR, \fBlong long int\fR, \fBint64\fR, or something else. +\fBlong long int\fR, \fB__int64\fR, or something else. The \fBmp_int\fR type is a multiple-precision integer type defined by the LibTomMath multiple-precision integer library. .PP diff --git a/generic/tcl.h b/generic/tcl.h index 24dd0be..c038dce 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -412,21 +412,17 @@ typedef long LONG; # endif # endif /* _WIN32 */ #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ -#ifdef TCL_WIDE_INT_IS_LONG -# undef TCL_WIDE_INT_TYPE -# define TCL_WIDE_INT_TYPE long -#endif /* TCL_WIDE_INT_IS_LONG */ - -typedef TCL_WIDE_INT_TYPE Tcl_WideInt; -typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; #ifdef TCL_WIDE_INT_IS_LONG # define Tcl_WideAsLong(val) ((long)(val)) # define Tcl_LongAsWide(val) ((long)(val)) # define Tcl_WideAsDouble(val) ((double)((long)(val))) # define Tcl_DoubleAsWide(val) ((long)((double)(val))) +# ifndef TCL_WIDE_INT_TYPE +# define TCL_WIDE_INT_TYPE long long +# endif /* !TCL_WIDE_INT_TYPE */ # ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "l" +# define TCL_LL_MODIFIER "ll" # endif /* !TCL_LL_MODIFIER */ # ifndef TCL_Z_MODIFIER # define TCL_Z_MODIFIER "l" @@ -448,6 +444,9 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) #endif /* TCL_WIDE_INT_IS_LONG */ +typedef TCL_WIDE_INT_TYPE Tcl_WideInt; +typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; + #if defined(_WIN32) # ifdef __BORLANDC__ typedef struct stati64 Tcl_StatBuf; diff --git a/generic/tclIO.c b/generic/tclIO.c index 6bf8451..a509ebf 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -9276,7 +9276,7 @@ MBWrite( * then the calculations involving extra must be made wide too. * * Noted with Win32/MSVC debug build treating the warning (possible of - * data in int64 to int conversion) as error. + * data in __int64 to int conversion) as error. */ bufPtr = AllocChannelBuffer(extra); diff --git a/unix/configure b/unix/configure index 741ae47..ba8e19b 100755 --- a/unix/configure +++ b/unix/configure @@ -7044,7 +7044,7 @@ else tcl_type_64bit="long long" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # See if we should use long anyway Note that we substitute in the + # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7070,8 +7070,8 @@ fi $as_echo "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using long" >&5 -$as_echo "using long" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else cat >>confdefs.h <<_ACEOF diff --git a/unix/tcl.m4 b/unix/tcl.m4 index c1d7a7d..ac40e5d 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2614,15 +2614,15 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ # See if the compiler knows natively about __int64 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], tcl_type_64bit=__int64, tcl_type_64bit="long long") - # See if we should use long anyway Note that we substitute in the + # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... AC_TRY_COMPILE(,[switch (0) { case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then - AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?]) - AC_MSG_RESULT([using long]) + AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?]) + AC_MSG_RESULT([yes]) else AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}, [What type should be used to define wide integers?]) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index adbc80d..fed3872 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -400,7 +400,7 @@ /* Does this platform have wide high-resolution clicks? */ #undef TCL_WIDE_CLICKS -/* Are wide integers to be implemented with C 'long's? */ +/* Do Tcl_WideInt, 'long' and 'long long' all have the same size (64-bit) ? */ #undef TCL_WIDE_INT_IS_LONG /* What type should be used to define wide integers? */ -- cgit v0.12 From 0515becf7a31a04247d286856d70790c3ca43a2f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 31 Mar 2017 11:05:28 +0000 Subject: Fix fall-back test for TCL_WIDE_INT_IS_LONG, making it do the same as "configure": Should be 1 if sizeof(long long) == sizeof(long), 0 otherwise. --- generic/tcl.h | 49 ++++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index c038dce..bacd73c 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -396,8 +396,6 @@ typedef long LONG; # define TCL_LL_MODIFIER "I64" # define TCL_Z_MODIFIER "I" # elif defined(__GNUC__) -# define TCL_WIDE_INT_TYPE long long -# define TCL_LL_MODIFIER "ll" # define TCL_Z_MODIFIER "z" # else /* ! _WIN32 && ! __GNUC__ */ /* @@ -405,44 +403,25 @@ typedef long LONG; * going on for us. Try to guess... */ # include -# if (INT_MAX < LONG_MAX) +# if defined(LLONG_MAX) && (LLONG_MAX == LONG_MAX) # define TCL_WIDE_INT_IS_LONG 1 -# else -# define TCL_WIDE_INT_TYPE long long # endif # endif /* _WIN32 */ #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ -#ifdef TCL_WIDE_INT_IS_LONG -# define Tcl_WideAsLong(val) ((long)(val)) -# define Tcl_LongAsWide(val) ((long)(val)) -# define Tcl_WideAsDouble(val) ((double)((long)(val))) -# define Tcl_DoubleAsWide(val) ((long)((double)(val))) -# ifndef TCL_WIDE_INT_TYPE -# define TCL_WIDE_INT_TYPE long long -# endif /* !TCL_WIDE_INT_TYPE */ -# ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "ll" -# endif /* !TCL_LL_MODIFIER */ -# ifndef TCL_Z_MODIFIER -# define TCL_Z_MODIFIER "l" -# endif /* !TCL_Z_MODIFIER */ -#else /* TCL_WIDE_INT_IS_LONG */ -/* - * The next short section of defines are only done when not running on Windows - * or some other strange platform. - */ -# ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "ll" -# endif /* !TCL_LL_MODIFIER */ -# ifndef TCL_Z_MODIFIER -# define TCL_Z_MODIFIER "" -# endif /* !TCL_Z_MODIFIER */ -# define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) -# define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) -# define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) -# define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) -#endif /* TCL_WIDE_INT_IS_LONG */ +#ifndef TCL_WIDE_INT_TYPE +# define TCL_WIDE_INT_TYPE long long +#endif /* !TCL_WIDE_INT_TYPE */ +#ifndef TCL_LL_MODIFIER +# define TCL_LL_MODIFIER "ll" +#endif /* !TCL_LL_MODIFIER */ +#ifndef TCL_Z_MODIFIER +# define TCL_Z_MODIFIER "l" +#endif /* !TCL_Z_MODIFIER */ +#define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) +#define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) +#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) +#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) typedef TCL_WIDE_INT_TYPE Tcl_WideInt; typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; -- cgit v0.12 From de59a00a303f0acfad8f990f62e5095d0e327298 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 7 Apr 2017 14:48:49 +0000 Subject: Use "0o" in stead of "0" as octal prefix in more places. --- generic/tclStringObj.c | 21 +++++---------------- tests/chanio.test | 8 ++++---- tests/format.test | 4 ++-- tests/io.test | 4 ++-- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c574003..239f88f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1880,20 +1880,10 @@ Tcl_AppendFormatToObj( format += step; step = Tcl_UtfToUniChar(format, &ch); } - } else if ((ch == 't') || (ch == 'z')) { + } else if ((ch == 't') || (ch == 'z') || (ch == 'q') || (ch == 'j') || (ch == 'L')) { format += step; step = Tcl_UtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG - if (sizeof(size_t) > sizeof(int)) { - useWide = 1; - } -#endif - } else if ((ch == 'q') ||(ch == 'j')) { - format += step; - step = Tcl_UtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG - useWide = 1; -#endif + useBig = 1; } format += step; @@ -2035,9 +2025,8 @@ Tcl_AppendFormatToObj( if (gotHash || (ch == 'p')) { switch (ch) { case 'o': - Tcl_AppendToObj(segment, "0", 1); - segmentLimit -= 1; - precision--; + Tcl_AppendToObj(segment, "0o", 2); + segmentLimit -= 2; break; case 'p': case 'x': @@ -2186,7 +2175,7 @@ Tcl_AppendFormatToObj( * Need to be sure zero becomes "0", not "". */ - if ((numDigits == 0) && !((ch == 'o') && gotHash)) { + if (numDigits == 0) { numDigits = 1; } pure = Tcl_NewObj(); diff --git a/tests/chanio.test b/tests/chanio.test index 8e27af9..2d900d0 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -5338,22 +5338,22 @@ test chan-io-40.2 {POSIX open access modes: CREAT} -setup { } -constraints {unix} -body { set f [open $path(test3) {WRONLY CREAT} 0600] file stat $path(test3) stats - set x [format "0%o" [expr $stats(mode)&0o777]] + set x [format "%#o" [expr $stats(mode)&0o777]] chan puts $f "line 1" chan close $f set f [open $path(test3) r] lappend x [chan gets $f] } -cleanup { chan close $f -} -result {0600 {line 1}} +} -result {0o600 {line 1}} test chan-io-40.3 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -constraints {unix umask} -body { # This test only works if your umask is 2, like ouster's. chan close [open $path(test3) {WRONLY CREAT}] file stat $path(test3) stats - format "0%o" [expr $stats(mode)&0o777] -} -result [format %04o [expr {0o666 & ~ $umaskValue}]] + format "%#o" [expr $stats(mode)&0o777] +} -result [format %#5o [expr {0o666 & ~ $umaskValue}]] test chan-io-40.4 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -body { diff --git a/tests/format.test b/tests/format.test index ad127a4..801a735 100644 --- a/tests/format.test +++ b/tests/format.test @@ -72,10 +72,10 @@ test format-1.10.1 {integer formatting} longIs64bit { } {0 0x6 0x22 0x421b 0xfffffffffffffff4 } test format-1.11 {integer formatting} longIs32bit { format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 -} {0 06 042 041033 037777777764 } +} {0 0o6 0o42 0o41033 0o37777777764 } test format-1.11.1 {integer formatting} longIs64bit { format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 -} {0 06 042 041033 01777777777777777777764} +} {0 0o6 0o42 0o41033 0o1777777777777777777764} test format-1.12 {integer formatting} { format "%b %#b %llb" 5 5 [expr {2**100}] } {101 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} diff --git a/tests/io.test b/tests/io.test index 6e7420d..aaceec5 100644 --- a/tests/io.test +++ b/tests/io.test @@ -5652,8 +5652,8 @@ test io-40.3 {POSIX open access modes: CREAT} {unix umask} { set f [open $path(test3) {WRONLY CREAT}] close $f file stat $path(test3) stats - format "0%o" [expr $stats(mode)&0o777] -} [format %04o [expr {0o666 & ~ $umaskValue}]] + format "%#o" [expr $stats(mode)&0o777] +} [format %#5o [expr {0o666 & ~ $umaskValue}]] test io-40.4 {POSIX open access modes: CREAT} { file delete $path(test3) set f [open $path(test3) w] -- cgit v0.12