public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: pedro@vis.ethz.ch
To: gcc-gnats@gcc.gnu.org
Subject: libgcj/2338: RandomAccessFile does not create the file if not found
Date: Wed, 21 Mar 2001 06:06:00 -0000	[thread overview]
Message-ID: <20010321135707.20613.qmail@sourceware.cygnus.com> (raw)

>Number:         2338
>Category:       libgcj
>Synopsis:       RandomAccessFile does not create the file if not found
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 21 06:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     pedro@vis.ethz.ch
>Release:        gcc 3.0 latest snapshot
>Organization:
>Environment:
redhat linux 6.2 for i686
>Description:
java.io.RandomAccessFile creates/opens a file for reading 
and/or writing. 

it calls java.io.FileDescriptor(<filename>,<mode>) - where
mode is either FileDescriptor.READ or FileDescriptor.READ.

FileDescriptor passes these args to natFileDesciptorPosix.cc
who translates them for the posix "open" function, yet does
not add O_CREAT for the "rw" case as would be required by 
java.io.FileDeescriptor

open returns an error value which is translated to an 
IOException.
>How-To-Repeat:
compile and run the attached program it opens a 
java.io.RandomAccessFile (first arg) and tries to write to 
it. with gcj this crashes, with any other java it works.
>Fix:
added

   static final int CREATE = 16;

to java.io.Filedescriptor and or'ed it to the 
java.io.RandomAccessFile constructor for "rw". also added

     if (jflags & CREATE)
  	flags |= O_CREAT;

to natFileDescriptor.cc for the whole thing to actualy do 
something.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="RAFTest.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="RAFTest.java"

aW1wb3J0IGphdmEuaW8uRmlsZTsKaW1wb3J0IGphdmEuaW8uUmFuZG9tQWNjZXNzRmlsZTsKaW1w
b3J0IGphdmEuaW8uSU9FeGNlcHRpb247CgpjbGFzcyBSQUZUZXN0IHsKCglwdWJsaWMgc3RhdGlj
IHZvaWQgbWFpbiAoIFN0cmluZyBhcmdzW10gKSB7CgkKCQlSYW5kb21BY2Nlc3NGaWxlIHJhZiA9
IG51bGw7CgkJCgkJdHJ5IHsKCQkJcmFmID0gbmV3IFJhbmRvbUFjY2Vzc0ZpbGUoYXJnc1swXSwi
cnciKTsKCQkJfQoJCWNhdGNoICggSU9FeGNlcHRpb24gZSApIHsKCQkJU3lzdGVtLm91dC5wcmlu
dGxuKCJSQUZUZXN0Lk1haW46IGdvdCBJT0V4Y2VwdGlvbiBvbiBSQUYgaW5pdDoiKTsKCQkJU3lz
dGVtLm91dC5wcmludGxuKGUuZ2V0TWVzc2FnZSgpKTsKCQkJcmV0dXJuOwoJCQl9CgoJCXRyeSB7
CgkJCXJhZi53cml0ZUNoYXJzKCJyYWYtdGVzdC4uLlxuIik7CgkJCXJhZi5jbG9zZSgpOwoJCQl9
CgkJY2F0Y2ggKCBJT0V4Y2VwdGlvbiBlICkgewoJCQlTeXN0ZW0ub3V0LnByaW50bG4oIlJBRlRl
c3QuTWFpbjogZ290IElPRXhjZXB0aW9uIG9uIFJBRiBhY2Nlc3M6Iik7CgkJCVN5c3RlbS5vdXQu
cHJpbnRsbihlLmdldE1lc3NhZ2UoKSk7CgkJCXJldHVybjsKCQkJfQoKCQl9CgoJfQo=


             reply	other threads:[~2001-03-21  6:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-21  6:06 pedro [this message]
2001-12-02 19:34 rodrigc
2001-12-02 19:36 rodrigc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010321135707.20613.qmail@sourceware.cygnus.com \
    --to=pedro@vis.ethz.ch \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).