delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/08/21:04:13

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200106090103.DAA18709@mother.ludd.luth.se>
Subject: .files on servers are perceived as readonly
To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
Date: Sat, 9 Jun 2001 03:03:53 +0200 (MEST)
X-Mailer: ELM [version 2.5 PL2]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

On my Linux server:

nietzsche:/x3/cvs/martin/djgpp/djgpp> ls -al src/libc/
total 60
drwxr-xr-x  17 martin   users        1024 Jun  8 23:10 .
drwxr-xr-x  13 martin   users        1024 Feb 22 20:56 ..
-rw-r--r--   1 martin   users          60 Jun  5 21:14 .cvsignore
drwxr-xr-x   2 martin   users        1024 Jun  8 23:10 CVS
drwxr-xr-x  14 martin   users        1024 Feb 22 20:56 ansi
drwxr-xr-x   4 martin   users        1024 Feb 22 20:56 ansif
drwxr-xr-x   3 martin   users        1024 Jun  8 23:10 bios
drwxr-xr-x  19 martin   users        1024 Feb 22 20:56 compat
drwxr-xr-x   3 martin   users        1024 Jun  8 23:11 crt0
-rw-r--r--   1 martin   users       34973 Mar  2 22:55 debug.txh
...

On my DOZE box:

total 52
drwxr-xr-x  17 dosuser  root          608 Jun  8 23:10 .
drwxr-xr-x  13 dosuser  root          800 Feb 22 20:56 ..
-r--r--r--   1 dosuser  root           60 Jun  5 21:14 .cvsignore
drwxr-xr-x  14 dosuser  root          384 Feb 22 20:56 ansi
drwxr-xr-x   4 dosuser  root           64 Feb 22 20:56 ansif
drwxr-xr-x   3 dosuser  root          800 Jun  8 23:10 bios
drwxr-xr-x  19 dosuser  root          544 Feb 22 20:56 compat
drwxr-xr-x   3 dosuser  root          672 Jun  8 23:11 crt0
drwxr-xr-x   2 dosuser  root           96 Jun  8 23:10 cvs
-rw-r--r--   1 dosuser  root        34973 Mar  2 22:55 debug.txh
...

As you can see .cvsignore has become readonly, but not debug.txh. The
share is exported readonly.


I've traced this to this part in src/libc/posix/sys/stat/lstat.c
(around line 603):

      /* File size. */
      statbuf->st_size = ff_blk.ff_fsize;

      /* Mode bits. */
      statbuf->st_mode |= READ_ACCESS;
      if ( !(ff_blk.ff_attrib & 0x07) )  /* no R, H or S bits set */
        statbuf->st_mode |= WRITE_ACCESS;

      /* Sometimes `_truename' doesn't return X:/FOO for character
         devices.  However, FindFirst returns attribute 40h for them. */
      if (ff_blk.ff_attrib == 0x40)


I don't think HIDDEN or SYSTEM attibutes should be mapped to readonly.
Thus I suggest we change "if ( !(ff_blk.ff_attrib & 0x07) )  /* no R,
H or S bits set */" to "if ( !(ff_blk.ff_attrib & 0x01) )  /* No R
bit set. */".

Comments?


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019