Add system attribute support to chmod(1) [PSARC/2007/410 FastTrack timeout 07/21/2007]
Don Cragun
don.cragun at sun.com
Fri Jul 13 23:38:17 PDT 2007
Template Version: @(#)sac_nextcase 1.64 07/13/07 SMI
This information is Copyright 2007 Sun Microsystems
1. Introduction
1.1. Project/Component Working Name:
Add system attribute support to chmod(1)
1.2. Name of Document Author/Supplier:
Author: Cynthia Eastham
1.3 Date of This Document:
13 July, 2007
4. Technical Description
The chmod utility will be updated to support setting and clearing of
the boolean read-write extended system attributes added in
PSARC case 2007/315.
4.1 Overview
The Extensible Attribute Interfaces (PSARC/2007/315) project introduced
a number of extended system file attributes. The system utilities need
to be able to display and manipulate these new attributes.
This fasttrack case adds one new option ("-@ attrname") and a new mode
("S<attribute_specification>") to the chmod utility to manipulate the
new system attributes for file operands as well as for named attribute
files of file operands.
Support for the manipulation of the createtime, a non-boolean,
read-write extended system added in 2007/315, will be addressed in
a separate case (see RFE CR 6580088 touch(1) needs to support
createtime attribute added in PSARC/2007/315).
4.2 Release Binding
The project team requests a minor release binding.
4.3 Details
4.3.1 New mode "S<attribute_specification_list>"
When the new mode operand "S<attribute_specification_list>" is given to
the chmod utility, chmod will attempt to adjust the boolean read-write
extended system attributes as specified by the attribute specification
list for each file specified by the file operand(s).
The <attribute_specification_list> is a comma-separated list of one or
more <attribute_specification>s. Each <attribute_specification> is of
the form:
[<operator>]<attribute_specifier>
An <operator> is one of the following:
+ Each attribute specified by the associated
<attribute_specifier> will be adjusted to match the
value specified by the <attribute_specifier>.
- Each attribute specified by the associated
<attribute_specifier> will be adjusted to match the
inverse of the value specified by the
<attribute_specifier>.
= Each attribute specified by the associated
<attribute_specifier> will be adjusted to match the
value specified by the <attribute_specifier>. Any
boolean read-write extended system attributes associated
with the current file that are not specified by
<attribute_specifier> will be cleared.
If an <operator> is not specified in an <attribute_specification>, chmod
will behave as if '+' had been specified.
An <attribute_specifier> takes one of the following forms:
a Set all boolean read-write extended system attributes
associated with the current file.
c[<compact_attribute_list>]
or c'{'<compact_attribute_list>'}'
Set each boolean read-write extended system attribute
identified by <compact_attribute_list>.
v[<verbose_attribute_setting>]
or v['{'<verbose_attribute_setting_list>'}']
Set or clear each boolean read-write extended system
attributes as specified by each
<verbose_attribute_setting> given.
A <compact_attribute_list> is a list of zero or more adjacent attribute
abbreviation characters from Table 1 below. An arbitrary number of
'-' characters may be included in a <compact_attribute_list>; these will
be ignored.
A <verbose_attribute_setting> is an attribute name from Table 1 below
optionally, immediately preceded by "no". If the attribute name is used
without "no", the attribute will be set; otherwise the attribute will be
cleared.
A <verbose_attribute_setting_list> is zero or more comma-separated
<verbose_attribute_setting>s.
Multiple operations specified for a file are accumulated and will all be
set for a file operand as a single attribute setting operation. If an
attribute is specified more than once in an
<attribute_specification_list>, the last specified operation will be
applied.
Table 1: Attribute Names and Abbreviation Characters
Attribute Name Attribute Abbreviation Character
-------------- --------------------------------
hidden H
system S
readonly R
archive A
nounlink u
immutable i
appendonly a
nodump d
settable t
opaque o
av_quarantined q
av_modified m
4.3.2 New '-@ named_attribute' option
When "-@ named_attribute" is specified, the attribute specification
mode is applied to the named attribute file specified of each
file operand instead of the file operand itself. If multiple
-@ options are supplied, the attribute specification mode will
be applied to each of the named attribute files specified.
A named attribute of '*' carries special meaning to chmod, and is
considered to mean all extended attribute files associated with a file
operand, and does not refer to the special files '.' and '..'.
A named attribute of '..' carries special meaning to chmod, and is
considered to mean the file operand itself. This allows chmod,
in a single call, to apply the attribute specification mode to the
specified named attribute file of the file operand and the file
operand itself.
4.3.3 Examples
For examples of setting, clearing, and replacing boolean read-write
system attributes of regular files, directories, and opaque extended
attribute files, please see the updated chmod(1) man page in this
case's materials directory.
5. Documentation
See the diff-marked, updated chmod(1) man page in this case's materials
directory for a detailed description of these changes.
6. Interfaces
6.1 Exported Interfaces
______________________________________
| Interface |Classification|
|_____________________|______________|
| /usr/bin/chmod | Committed |
|_____________________|______________|
6.2 Imported Interfaces
_________________________________________________________________
| Interface | Classification | Comments |
|================================================================|
| _PC_SATTR_ENABLED | Consolidation | [f]pathconf() variables |
| _PC_SATTR_EXISTS | Private | from PSARC/2007/315. |
|_____________________+________________+_________________________|
| fgetattr() | Consolidation | From PSARC/2007/315. |
| | Private | |
|_____________________+________________+_________________________|
| fsetattr() | Consolidation | From PSARC/2007/315. |
| | Private | |
|_____________________+________________+_________________________|
| | | From the project team |
| | | that is implementing |
| | | PSARC/2007/315. Used |
| attr_to_name() | | to get to and from |
| attr_to_option() | Consolidation | system attribute names |
| attr_to_xattr_view()| Private | and their system |
| name_to_attr() | | representations, to and |
| option_to_attr() | | from their single |
| | | character abbreviations |
| | | and their system |
| | | representations, and |
| | | to obtain the view of |
| | | an attribute. |
|_____________________+________________+_________________________|
All of these are mentioned here only to register use of these
interfaces. Note, however, that PSARC/2007/315 case materials
don't make clear the interface taxonomy for fgetattr(), fsetattr(),
and other functions listed on the fgetattr(3C) man page. (The last
specification (spec.final.txt) says that all of the functions
listed on the fgetattr(3C) man page including fgetattr() are
consolidation private; fgetattr.3c (in the same directory) says
that all of the functions described there are Evolving).
7. References
PSARC/2006/715 CIFS Service
PSARC/2007/315 Extensible Attribute Interfaces
PSARC/2007/394 ls(1) new command line options '-/' and '-%':
CIFS system attributes support
CR 6578885 chmod(1) should support file system attributes
proposed in PSARC/2007/315
8. Resources and Schedule
8.4. Steering Committee requested information
8.4.1. Consolidation C-team Name:
ON
8.5. ARC review type: FastTrack
8.6. ARC Exposure: open
More information about the opensolaris-arc
mailing list