public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libgcj/1237: File creation doesn't observe umask
@ 2000-12-20 12:22 jsturm
0 siblings, 0 replies; only message in thread
From: jsturm @ 2000-12-20 12:22 UTC (permalink / raw)
To: java-gnats
>Number: 1237
>Category: libgcj
>Synopsis: File creation doesn't observe umask
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bryce
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 20 12:18:06 PST 2000
>Closed-Date: Sat Apr 15 20:22:26 PDT 2000
>Last-Modified: Sat Apr 15 20:30:00 PDT 2000
>Originator: Jeff Sturm
>Release: CVS libgcj
>Organization:
>Environment:
Linux
>Description:
Classes that create OS files (i.e. java.io.FileOutputStream)
do not obey the user's current umask. Files are always
created with permissions -rw-r--r-- regardless of the user's
umask setting.
>How-To-Repeat:
gcj Touch.java --main=Touch -o touch
umask 000
rm -f x
./touch x
ls -l x
will print:
-rw-r--r-- 1 jsturm users 0 Apr 15 11:29 x
>Fix:
Change mask in natFileDescriptorPosix.cc
>Release-Note:
>Audit-Trail:
Formerly PR java.io/202
From: Bryce McKinlay <bryce@albatross.co.nz>
To: jsturm@sigma6.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: java.io/202: File creation doesn't observe umask
Date: Sun, 16 Apr 2000 14:20:20 +1200
This is a multi-part message in MIME format.
--------------D5D26A045441CB02CA8A32E2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
jsturm@sigma6.com wrote:
> Classes that create OS files (i.e. java.io.FileOutputStream)
> do not obey the user's current umask. Files are always
> created with permissions -rw-r--r-- regardless of the user's
> umask setting.
umask is being honored, but we're creating files with the wrong mode (so
changing umask from 022 to 000 appears to have no effect). The following patch
should fix that. OK to commit?
regards
[ bryce ]
--------------D5D26A045441CB02CA8A32E2
Content-Type: text/plain; charset=us-ascii;
name="filedescriptor-umask.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="filedescriptor-umask.patch"
2000-04-16 Bryce McKinlay <bryce@albatross.co.nz>
* java/io/natFileDescriptorPosix.cc (open): Use mode 0666. Fix for PR
libgcj/202.
(available): Initialize `where' to prevent bogus compiler warning.
Index: libjava/java/io/natFileDescriptorPosix.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/io/natFileDescriptorPosix.cc,v
retrieving revision 1.7
diff -u -r1.7 natFileDescriptorPosix.cc
--- natFileDescriptorPosix.cc 2000/03/07 19:55:26 1.7
+++ natFileDescriptorPosix.cc 2000/04/16 02:14:16
@@ -83,7 +83,7 @@
#endif
JvAssert ((jflags & READ) || (jflags & WRITE));
- int mode = 0644;
+ int mode = 0666;
if ((jflags & READ) && (jflags & WRITE))
flags |= O_RDWR;
else if ((jflags & READ))
@@ -281,7 +281,7 @@
if (! num_set)
{
struct stat sb;
- off_t where;
+ off_t where = 0;
if (fstat (fd, &sb) != -1
&& S_ISREG (sb.st_mode)
&& (where = lseek (fd, SEEK_CUR, 0)) != (off_t) -1)
--------------D5D26A045441CB02CA8A32E2--
From: Tom Tromey <tromey@cygnus.com>
To: Bryce McKinlay <bryce@albatross.co.nz>
Cc: tromey@cygnus.com, java-gnats@sourceware.cygnus.com
Subject: Re: java.io/202: File creation doesn't observe umask
Date: Sat, 15 Apr 2000 19:46:03 -0700 (PDT)
>> Classes that create OS files (i.e. java.io.FileOutputStream)
>> do not obey the user's current umask. Files are always
>> created with permissions -rw-r--r-- regardless of the user's
>> umask setting.
Bryce> umask is being honored, but we're creating files with the
Bryce> wrong mode (so changing umask from 022 to 000 appears to have
Bryce> no effect). The following patch should fix that. OK to commit?
When I try a simple test program with Sun's JDK (1.1.7, I think), with
my umask set to 000, it creates a file with mode 0664. Do you know
what JDK 1.2 does? I think it makes sense to be JDK compatible here.
(When I wrote this code I didn't run a test -- I just picked what I
thought would be reasonable.)
Tom
From: Bryce McKinlay <bryce@albatross.co.nz>
To: Tom Tromey <tromey@cygnus.com>, java-gnats@sourceware.cygnus.com
Cc:
Subject: Re: java.io/202: File creation doesn't observe umask
Date: Sun, 16 Apr 2000 14:51:07 +1200
With umask set to 000, Sun JDK 1.2.2 creates a 0666 file. IBM JDK 1.1.8
creates a 0664 file. I think that 1.2.2 is right here.
regards
[ bryce ]
From: Tom Tromey <tromey@cygnus.com>
To: Bryce McKinlay <bryce@albatross.co.nz>
Cc: Tom Tromey <tromey@cygnus.com>, java-gnats@sourceware.cygnus.com
Subject: Re: java.io/202: File creation doesn't observe umask
Date: Sat, 15 Apr 2000 20:01:43 -0700 (PDT)
Bryce> With umask set to 000, Sun JDK 1.2.2 creates a 0666 file. IBM
Bryce> JDK 1.1.8 creates a 0664 file. I think that 1.2.2 is right
Bryce> here.
Sounds like IBM went for JDK 1.1 compatibility.
Feel free to check your patch in.
Tom
Responsible-Changed-From-To: tromey->bryce
Responsible-Changed-By: bryce
Responsible-Changed-When: Sat Apr 15 20:22:26 2000
Responsible-Changed-Why:
I fixed it.
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Sat Apr 15 20:22:26 2000
State-Changed-Why:
Patch has been checked in.
From: bryce@albatross.co.nz
To: bryce@albatross.co.nz, java-gnats@sourceware.cygnus.com,
jsturm@sigma6.com, tromey@cygnus.com
Cc:
Subject: Re: java.io/202
Date: 16 Apr 2000 03:22:26 -0000
Synopsis: File creation doesn't observe umask
Responsible-Changed-From-To: tromey->bryce
Responsible-Changed-By: bryce
Responsible-Changed-When: Sat Apr 15 20:22:26 2000
Responsible-Changed-Why:
I fixed it.
State-Changed-From-To: open->closed
State-Changed-By: bryce
State-Changed-When: Sat Apr 15 20:22:26 2000
State-Changed-Why:
Patch has been checked in.
http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=202&database=java
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="Touch.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Touch.java"
aW1wb3J0IGphdmEuaW8uRmlsZU91dHB1dFN0cmVhbTsKCnB1YmxpYyBjbGFzcyBUb3VjaCB7Cglw
dWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CgkJZm9yIChpbnQgbiA9IDA7
IG4gPCBhcmdzLmxlbmd0aDsgbisrKSB7CgkJCXRyeSB7CgkJCQkobmV3IEZpbGVPdXRwdXRTdHJl
YW0oYXJnc1tuXSwgdHJ1ZSkpLmNsb3NlKCk7CgkJCX0gY2F0Y2ggKFRocm93YWJsZSB0KSB7CgkJ
CQlTeXN0ZW0uZXJyLnByaW50bG4odC5nZXRNZXNzYWdlKCkpOwoJCQl9CgkJfQoJfQp9Cg==
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-12-20 12:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:22 libgcj/1237: File creation doesn't observe umask jsturm
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).