[comp.binaries.ibm.pc.d] Picnixv3 CHMOD

feg@clyde.ATT.COM (Forrest Gehrke) (05/18/88)

When using this chmod to set a file attribute to read-only
via +r the attempt seemingly is successful.  However, if
one tries to remove this attribute (-r) the message:
"CHMOD: WARNING! in DOS a file is always readable, option ignored"
is displayed.

Thus,  to set a file truly read-only (that is, an attempt 
to delete, or to write to this file, will be denied) 
is not possible.  This is not the way the msdos chmod (v3.2) 
operates, nor is it the way with Unix.  It seems to me this 
is a WRITE permission issue and that the author has mis-
interpreted the intent of the read-only attribute.

Forrest Gehrke

dick@slvblc.UUCP (Dick Flanagan) (05/22/88)

In article <26676@clyde.ATT.COM> feg@clyde.ATT.COM (Forrest Gehrke) writes:
> When using this chmod to set a file attribute to read-only
> via +r the attempt seemingly is successful.  However, if
> one tries to remove this attribute (-r) the message:
> "CHMOD: WARNING! in DOS a file is always readable, option ignored"
> is displayed.
> 
> Thus,  to set a file truly read-only (that is, an attempt 
> to delete, or to write to this file, will be denied) 
> is not possible.  This is not the way the msdos chmod (v3.2) 
> operates, nor is it the way with Unix.  It seems to me this 
> is a WRITE permission issue and that the author has mis-
> interpreted the intent of the read-only attribute.

This is indeed a write permission issue, and that's why you should
be changing the file's write permission, not it's read permission.

A file's read permission determines whether or not it can be read.
So when you tried 'chmod -r' you were trying to remove the file's
read permission and make it un-readable.  But, and as chmod told
you, MSDOS doesn't support this and forces all files to be readable.

A file's write permission, on the other hand, determines whether
or not it can be written (or deleted).  So to remove a file's
write permission and make it un-writable, you should use 'chmod -w'

On all of the PICNIX commands there is a pretty good help screen
that is triggered by the -? option.  In this case, 'chmod -?'
displays:

Name:     chmod - update attribute bits of files
Usage:    chmod <mode> file1 ...
Version:  3.4 for PCs with DOS 2.1 and higher
          [...]

    Mode is any combination of:
        {+|-|=} {w|s|h|m}
    where:

    + adds an attribute to a file
    - removes an attribute from a file
    = gives a file just the attributes specified

    w specifies whether the file should be writable or not
    s specifies whether the file should be a system file or not
    h specifies whether the file should be a hidden file or not
    m specifies whether the file should be marked modified or not

    -? displays this description of the program.

NOTE:  If the environment variable CHMOD exists, its value is used to
          establish default options.


You will note that the 'r' option, while not rejected as an error,
is not mentioned on the help screen because it essentially does
nothing within an MSDOS environment.

Dick

--
Dick Flanagan, W6OLD                         GEnie: FLANAGAN
UUCP: ...!ucbvax!ucscc!slvblc!dick           Voice: +1 408 336 3481
Internet: slvblc!dick@ucscc.UCSC.EDU         LORAN: N037 04.7 W122 04.6
USPS: PO Box 155, Ben Lomond, CA 95005