At 16:16  +0800 2009/05/03, bill lam wrote:
>On Sat, 02 May 2009, Joey K Tuttle wrote:
>>  My question today is - why do the jmf routines require that I have
>>  write access to a file even though I'm opening it as read only? Some
>>  files I would like to look at in a map are not mine and while I have
>>  group or world read access, I can't map them, even explicitly saying
>>  read-only - unhappiness...
>
>That should be a bug. Can you give a procedure to reproduce the error?
>

Sure - for those who like the nity gritty, in a Darwin terminal 
session (Linux gives exactly same results) -

iMg5:~ jkt$ echo "A man a plan Panama" > palindrome

iMg5:~ jkt$ ls -l palindrome
-rw-r--r--  1 jkt  jkt  20 May  3 07:47 palindrome

iMg5:~ jkt$ chmod 444 palindrome  # make read-only even for owner

iMg5:~ jkt$ ls -l palindrome
-r--r--r--  1 jkt  jkt  20 May  3 07:47 palindrome

iMg5:~ jkt$ ja  # start j

    version ''
Installer: j602a_mac_powerpc.dmg
Engine: j602/2008-03-03/16:45
Library: 6.02.023ProductName:   Mac OS X
ProductVersion: 10.5.6
BuildVersion:   9G55
java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard 
Edition (build 1.5.0_16-b06-284) Java HotSpot(TM) Client VM (build 
1.5.0_16-133, mixed mode, sharing)

    load 'jmf'
    2 map_jmf_ 'x';'palindrome';'';1
|bad file name/access: assert
|   'bad file name/access'    assert fh~:_1
    exit 0

iMg5:~ jkt$ chmod 666 palindrome  # let everyone write - not very secure

iMg5:~ jkt$ ls -l palindrome
-rw-rw-rw-  1 jkt  jkt  20 May  3 07:47 palindrome

iMg5:~ jkt$ date  # showing that time has gone by...
Sun May  3 07:51:24 PDT 2009

iMg5:~ jkt$ ja
    load 'jmf'
    2 map_jmf_ 'x';'palindrome';'';1
    x =. |. x
|read-only data
|   x    =.|.x
    NB. Good! What I asked for.
    unmap_jmf_ 'x'
0
    2 map_jmf_ 'x';'palindrome'   NB. map it for read-write
    x =. |. x
    NB. OK - except ...
    unmap_jmf_ 'x'
0
    exit 0
   
iMg5:~ jkt$ #  Note that mod date is unchanged even though time has gone by

iMg5:~ jkt$ ls -l palindrome
-rw-rw-rw-  1 jkt  jkt  20 May  3 07:47 palindrome

iMg5:~ jkt$ cat palindrome  # but the file was, in fact, modified.

amanaP nalp a nam A


- joey

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to