From: "F. Senault" Date: 2010-11-18T20:56:38+09:00 Subject: Stange behaviour with files permissions on a windows mounted share Hi. I have a windows share mounted on a FreeBSD box, and I see the following : | 12:39 fred@ardbeg:~/glenmorangie/misc/temp% uname -a | FreeBSD ardbeg.lacave.local 8.1-STABLE FreeBSD 8.1-STABLE #1: Wed Oct 20 18:56:00 CEST 2010 root@ardbeg.lacave.net:/usr/obj/usr/src/sys/ARDBEG amd64 | 12:39 fred@ardbeg:~/glenmorangie/misc/temp% mount ... | //FRED@GLENMORANGIE/E$ on /data/glenmorangie/misc (smbfs) | 12:39 fred@ardbeg:~/glenmorangie/misc/temp% touch test.txt | 12:40 fred@ardbeg:~/glenmorangie/misc/temp% ls -la | total 32 | drwxr-xr-x 1 fred wheel 16384 18 nov 12:40 . | drwxr-xr-x 1 fred wheel 16384 1 jan 1970 .. | -rwxr-xr-x 1 fred wheel 0 18 nov 12:40 test.txt | 12:40 fred@ardbeg:~/glenmorangie/misc/temp% chmod a-w test.txt | 12:40 fred@ardbeg:~/glenmorangie/misc/temp% ls -la | total 32 | drwxr-xr-x 1 fred wheel 16384 18 nov 12:40 . | drwxr-xr-x 1 fred wheel 16384 1 jan 1970 .. | -r-xr-xr-x 1 fred wheel 0 18 nov 12:40 test.txt | 12:40 fred@ardbeg:~/glenmorangie/misc/temp% echo "abc" > test.txt | zsh: permission denied: test.txt All set. (And Windows shows the file as read-only too, FWIW.) | 12:40 fred@ardbeg:~/glenmorangie/misc/temp% ruby -v | ruby 1.9.2p0 (2010-08-18 revision 29036) [amd64-freebsd8] | 12:40 fred@ardbeg:~/glenmorangie/misc/temp% irb | >> File.writable? "./test.txt" | => true Uh ? | >> File.stat("./test.txt").writable? | => false Better. | >> File.open("./test.txt", "w") {} | Errno::EACCES: Permission denied - ./test.txt | from (irb):3:in `initialize' | from (irb):3:in `open' | from (irb):3 | from /usr/local/bin/irb:12:in `
' Ok. And, from the Windows box itself : | E:\temp>ruby -v | ruby 1.9.1p429 (2010-07-02 revision 28523) [i386-mingw32] | E:\temp>irb | irb(main):001:0> File.writable?("./test.txt") | => false Good. Is this to be expected ? Is it a bug from FreeBSD or from Ruby ? TIA, Fred -- I never really understood how there could be things that would drive you insane just because you knew them until I ran into Windows. (Peter da Silva in the SDM)