From: Arjen Markus on
On 20 jan, 16:23, keithv <kvet...(a)gmail.com> wrote:
> On Jan 20, 4:28 am, APN <palm...(a)yahoo.com> wrote:
>
>
>
>
>
> > On Jan 20, 4:47 am, keithv <kvet...(a)gmail.com> wrote:
>
> > > Is the mode value from file stat meaningful on Windows.
> > > Under tcl 8.5, it always seems to return 0644
> > > even if you have permission write to the file.
>
> > > (This problem came up when I was trying to figure
> > > out why tcllib's ftpd package wouldn't let me delete
> > > a file.)
>
> > > Thanks,
> > > Keith
>
> > This is a itsy-bitsy bug caused by hex-octal typos. Also verified for
> > 8.6b1.
>
> > I've entered the bug and patch as bug  2935503 in sourceforge.
>
> From your patch it looks like a script level fix would be
>   file stat $fname stat
>   set stat(mode) [expr {($stat(mode) & ~0077) | (($stat(mode) & 0700)
>
> >> 3) | (($stat(mode) & 0700) >> 6)}]
>
> Keith- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Hm, that way octals get another chance to survive!

Regards,

Arjen
From: Joe English on
keithv wrote:
> On Jan 20, 4:28�am, APN wrote:
>> This is a itsy-bitsy bug caused by hex-octal typos. Also verified for
>> 8.6b1.
>>
>> I've entered the bug and patch as bug �2935503 in sourceforge.
>
> From your patch it looks like a script level fix would be
> file stat $fname stat
> set stat(mode) [expr {($stat(mode) & ~0077) | (($stat(mode) & 0700)
>>> 3) | (($stat(mode) & 0700) >> 6)}]


Please note that, unless you need to support Tcl 8.4 or earlier,
it's better to write this as e.g., "0o077" instead of "077".

This will future-proof your code against that happy day
when Tcl finally fixes the octal bug.


--Joe English
First  |  Prev  | 
Pages: 1 2
Prev: weird behavior of lsort
Next: for loop variable scope