Stange behaviour with files permissions on a windows mounted share

Discussion in 'Ruby' started by F. Senault, Nov 18, 2010.

  1. F. Senault

    F. Senault Guest

    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 :/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 `<main>'

    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)
     
    F. Senault, Nov 18, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JL
    Replies:
    6
    Views:
    625
    Sid Ismail
    Dec 28, 2003
  2. KimHoon
    Replies:
    4
    Views:
    560
    Jack Klein
    Sep 20, 2003
  3. Replies:
    3
    Views:
    356
    perchef
    Aug 16, 2005
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,350
    Saraswati lakki
    Jan 6, 2012
  5. Dirk Lüsebrink
    Replies:
    4
    Views:
    181
    Dirk Lüsebrink
    Jan 1, 2007
Loading...

Share This Page