A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1041 
====================================================================== 
Reported By:                dannyniu
Assigned To:                
====================================================================== 
Project:                    1003.1(2013)/Issue7+TC1
Issue ID:                   1041
Category:                   Shell and Utilities
Type:                       Enhancement Request
Severity:                   Comment
Priority:                   normal
Status:                     New
Name:                       DannyNiu/NJF 
Organization:                
User Reference:              
Section:                    XCU.4. cksum, compress, uncompress, zcat 
Page Number:                Too many pages 
Line Number:                Too many lines 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2016-04-03 09:56 UTC
Last Modified:              2017-08-03 16:18 UTC
====================================================================== 
Summary:                    Encourage implementations to include better
integrity checksum, compression and decompression utilities if possible.
====================================================================== 

---------------------------------------------------------------------- 
 (0003813) rhansen (manager) - 2017-08-03 16:18
 http://austingroupbugs.net/view.php?id=1041#c3813 
---------------------------------------------------------------------- 
On Page xlvi add the following in proper alphabetical
order:<blockquote>IETF RFC 1951<blockquote>DEFLATE Compressed Data Format
Specification version 1.3
P. Deutsch, May 1996 ( available at www.ietf.org/rfc/rfc1951.txt
)</blockquote>

IETF RFC 1952<blockquote>GZIP file format specification version 4.3
P. Deutsch, May 1996 ( available at www.ietf.org/rfc/rfc1952.txt
)</blockquote></blockquote>
On Page 2602 replace the entire page (lines 88476-84515) with the
following:<blockquote>NAME<blockquote>compress, uncompress, zcat - compress
and decompress data</blockquote>

SYNOPSIS<blockquote><XSI><tt>compress [-fv] [-b <i>value</i>] [-g | -m
<i>algo</i>] [<i>file</i>...]
compress -c [-fv] [-b <i>value</i>] [-g | -m <i>algo</i>] [<i>file</i>]
compress -d [-cfv] [<i>file</i>...]
uncompress [-cfv] [<i>file</i>...]
zcat [<i>file</i>...]</tt></XSI></blockquote>

DESCRIPTION<blockquote>The <i>compress</i> utility, when the <b>-d</b>
option is not specified, shall apply the compression algorithm identified
by the <b>-g</b> option or the <b>-m</b> <i>algo</i> option to the named
files to attempt to reduce their size without loss of information.  The
<i>compress</i> utility with the <b>-d</b> option shall apply the
appropriate decompression algorithm to the named files to restore the data
to their original state.

The <i>uncompress</i> utility shall be equivalent to <tt>compress -d</tt>. 
The <i>zcat</i> utility shall be equivalent to <tt>compress -c -d</tt>.  If
multiple <i>file</i> operands are specified, the decompressed data from
each input file shall be concatenated to standard output.

When compressing data, unless the <b>-c</b> option is specified, after an
input file other than standard input has been compressed, the compressed
data from the input file shall be stored in a file with the same pathname
as the input file but with an added suffix.  The added suffix shall be the
suffix associated with the algorithm (see the algorithms in Table 4-X (on
page xxx)).  If appending the suffix would make the size of the last
component of the output file's pathname exceed {NAME_MAX} bytes, the
command shall fail. If appending the suffix would make the size of the
pathname exceed {PATH_MAX} bytes, the command may fail.

When decompressing data, unless the <b>-c</b> option is specified, after an
input file other than standard input has been decompressed, the
decompressed data from the input file shall be stored in a file with the
same pathname as the input file but with the suffix associated with the
algorithm removed. [OB]If <i>file</i> has no suffix associated with a known
compression algorithm or <i>file</i> does not exist and does not have a
<tt>.Z</tt> suffix, <i>file</i> shall be used as the name of the output
file, and the default suffix <tt>.Z</tt> shall be appended to <i>file</i>
to form the input pathname.[/OB] The behavior is unspecified if the input
pathname ends with a suffix other than the suffix associated with the
algorithm used to compress the data. When the <b>-c</b> option is
specified, <i>file</i> can have any suffix, or no suffix, and the utility
shall use <i>file</i> as the input file and examine the file's contents to
determine which algorithm to use to decompress the data (it is not an error
if <i>file</i> does not have a suffix that matches the suffix associated
with the compression algorithm).

When compressing or decompressing a file other than standard input and the
<b>-c</b> option is not specified, if the invoking process has sufficient
privilege, the ownership, modes, access time, and modification time of the
output file shall match the ownership, modes, access time, and modification
time of the input file.  After the output file has been succesfully
created, the input file shall be removed if the invoking process has
sufficient privileges. If the invoking process does not have sufficient
privileges to remove the input file (for example, if the directory has the
S_ISVTX bit set) the behavior depends on whether the <b>-f</b> option is
specified: if <b>-f</b> is not specified, the output file shall be removed,
a diagnostic message shall be written and the utility shall continue
processing other files but the final exit status shall be non-zero; if
<b>-f</b> is specified, the output file shall not be removed and it is
unspecified whether the inability to remove the input file is treated as an
error. If it is not treated as an error, a warning message may be written
to standard error.

If no <i>file</i> operands are specified, standard input shall be
compressed or decompressed to standard output.

[OB]If an input file that is to be removed after processing has multiple
hard links, the <i>compress</i> and <i>uncompress</i> utilities may write a
diagnostic message to standard error and do nothing with the file; this
behavior may depend on whether the <b>-f</b> option is specified. If a
diagnostic message is written, the final exit status shall be
non-zero.[/OB]</blockquote>

OPTIONS<blockquote>The <i>compress</i>, <i>uncompress</i>, and <i>zcat</i>
utilities shall conform to XBD Section 12.2 (on page 216), except that
Guideline 1 does not apply to <i>uncompress</i> since the utility name has
ten letters.

The following options shall be supported:

<b>-b</b> <i>value</i><blockquote>If the compression algorithm is LZW,
<i>value</i> specifies the maximum number of bits to use in a code. For a
conforming application, the value argument shall be:
<tt>9 <= <i>value</i> <= 16</tt>
The implementation may allow values of greater than 16. The default shall
be 14, 15, or 16.

If the compression algorithm is DEFLATE, <i>value</i> specifies the
compression level. For a conforming application, the <i>value</i> argument
shall be:
<tt>1 <= <i>value</i> <= 9</tt>
The default shall be 6.

For other algorithms, <i>value</i> specifies implementation-defined
tuning.</blockquote>

<b>-c</b><blockquote>Write to standard output; the input files shall not be
changed, and no output files shall be created.</blockquote>

<b>-d</b><blockquote>Decompress files. When invoked with the <b>-d</b>
option, the <i>compress</i> utility shall restore previously compressed
files to their original state.</blockquote>

<b>-f</b><blockquote>Force compression or decompression of <i>file</i>,
even if it does not (for compression) actually reduce the size of the file,
or if the corresponding output file already exists. If the <b>-f</b> option
is not given and the standard input is a terminal, the user shall be
prompted as to whether an existing output file should be overwritten. If
the response is affirmative, the existing file shall be overwritten.  If
the standard input is not a terminal and <b>-f</b> is not given,
<i>compress</i> or <i>uncompress</i> shall write a diagnostic message to
standard error, the existing file shall not be overwritten, and the utility
shall exit with a status greater than zero.  If the <b>-f</b> option is
specified and an input file other than standard input has multiple hard
links, it is implementation-defined whether the input file is unlinked
after the corresponding output file is successfully written, or if
processing of that file is skipped and a diagnostic message is written to
standard error.</blockquote>

<b>-g</b><blockquote>Equivalent to <b>-m</b> <i>gzip</i></blockquote>

<b>-m</b> <i>algo</i><blockquote>Use the algorithm defined by <i>algo</i>
to compress the files. The following algorithms shall be supported:

Table 4-X Compression algorithms, <b>-m</b> option-argument values, and
suffixes
     Algorithm                       <i>algo</i>    Filename Suffix
     adaptive LZW                lzw                .Z
     RFC1951 DEFLATE       deflate          .gz
     Synonym for DEFLATE  gzip              .gz

Other implementation-defined algorithms may be supported. 

If neither of the <b>-m</b> <i>algo</i> and <b>-g</b> options is specified,
<tt>lzw</tt> shall be used as a default <i>algo</i> value.  Specifying more
than one of the mutually exclusive <b>-g</b> and <b>-m</b> <i>algo</i>
options, or multiple <b>-m</b> <i>algo</i> options, shall not be considered
an error. The last option specified shall determine the behavior of the
utility.

On systems not supporting the selected algorithm, the input files shall not
be changed and an exit status greater than two shall be returned.
<b>Note:</b>
<blockquote>The Lempel-Ziv compression algorithm is described in the
now-expired US Patent 4464650, which was issued to William Eastman, Abraham
Lempel, Jacob Ziv, and Martin Cohn on August 7th, 1984 and assigned to
Sperry Corporation.

The Lempel-Ziv-Welch compression algorithm is described in the now-expired
US Patent 4558302, which was issued to Terry A. Welch on December 10th,
1985 and assigned to Sperry Corporation.</blockquote>
</blockquote>

<b>-v</b><blockquote>For <i>compress</i>, write the percentage reduction of
each file to standard error. For <i>uncompress</i>, write messages to
standard error concerning the expansion of each
file.</blockquote></blockquote>

OPERANDS
<blockquote>The following operand shall be supported:

<i>file</i><blockquote>A pathname of a file to be compressed or
decompressed. If a <i>file</i> is '-', the utility shall read from standard
input at that point in the sequence and write to standard output. If more
than one <i>file</i> operand is '-', the behavior is
unspecified.</blockquote></blockquote>

STDIN<blockquote>Standard input shall be used only if no <i>file</i>
operands are specified or if a <i>file</i> operand is
'-'.</blockquote></blockquote>

On page 2603, L84516-84517 replace the INPUT FILES section
with:<blockquote>INPUT FILES<blockquote>If <i>file</i> operands are
specified, the corresponding input files contain the data to be compressed
or decompressed.</blockquote></blockquote>

On page 2603 lines 84540-84549, replace the STDOUT, STDERR, and OUTPUT
FILES sections with:<blockquote>STDOUT<blockquote>For the <i>compress</i>
and <i>uncompress</i> utilities, standard output shall be used if no
<i>file</i> operands are specified, if a <i>file</i> operand is '−', or
if the <b>-c</b> option is specified.  Otherwise, standard output shall not
be used.

The <i>zcat</i> utility shall write the decompressed data to standard
output.</blockquote>
 
STDERR
<blockquote>Standard error shall be used only for diagnostic and prompt
messages, the optional warning message described in DESCRIPTION, and the
output from <b>−v</b>.</blockquote>

OUTPUT FILES
<blockquote>When decompressing input files other than standard input, the
corresponding output files shall contain the decompressed input data.  When
compressing input files other than standard input, the corresponding output
files shall contain the compressed input data. If the selected <i>algo</i>
is <i>deflate</i> or <i>gzip</i>, the compressed output shall be in the
GZIP format described in RFC 1952.  For other algorithms, the compressed
output file format is implementation-defined and interchange of such files
between implementations (including access via unspecified file sharing
mechanisms) is not required by POSIX.1-20xx.</blockquote></blockquote>

On page 2603 line 84553 (compress EXIT STATUS section), change:
<blockquote>The following exit values shall be returned</blockquote>
to:
<blockquote>The following exit values shall be returned for
<i>compress</i></blockquote>

On page 2603 line 84558 (compress EXIT STATUS section), add:
<blockquote>The following exit values shall be returned for
<i>uncompress</i> and <i>zcat</i>:<blockquote>

0   Successful completion.

>0 An error occurred.</blockquote></blockquote>

On page 2604 L84559-L84560 replace the CONSEQUENCES OF ERRORS section
with:
<blockquote>CONSEQUENCES OF ERRORS
<blockquote>If an error occurs while compressing or decompressing an input
file other than standard input, the input file shall remain
unmodified.</blockquote></blockquote>

On page 2604 L84572-84574, replace the last paragraph of APPLICATION USAGE
with:
<blockquote>In addition to trying <i>file</i> and <i>file</i><tt>.Z</tt>
when looking for a file to decompress, some implementations of
<i>uncompress</i> and <i>zcat</i> also try suffixes for other known
compression algorithms if neither <i>file</i> nor <i>file</i><tt>.Z</tt> is
found.  This version of the standard allows, but does not require this
behavior.  Portable applications should always specify the full pathname
(including the suffix) of files to be decompressed.</blockquote>

On page 2604 lines 84577-84583 replace the RATIONALE, FUTURE DIRECTIONS,
and SEE ALSO sections with:
<blockquote>RATIONALE
<blockquote>Earlier versions of this standard limited the value of
<i>bits</i> used by conforming applications for the lzw algorithm to 14 due
to address space limitations on 16-bit architectures.  Using 15 or 16 is a
much more common default when using current hardware.

Earlier versions of this standard only supported LZW compression. The
standard developers noted that existing implementations added other
compression utilities, such as <i>gzip</i>, and found it desirable to
support this widespread usage. Some implementations had extended the
<i>compress</i> utility to support such other schemes. The standard
developers generalized this practice by the addition of the <b>-m</b>
option, even though this was not previous practice.

The <i>uncompress</i> <b>-d</b> option is added to match undocumented
existing practice of tested implementations.</blockquote>

FUTURE DIRECTIONS
<blockquote>When decompressing a file, the requirement to add <tt>.Z</tt>
to a <i>file</i> operand if the given pathname does not include a suffix
associated with a known compression algorithm or if <i>file</i> does not
exist and does not already have a <tt>.Z</tt> extension is an obsolescent
feature and may be removed in a future version.</blockquote>

SEE ALSO
<blockquote>XBD Chapter 8 (on page 173), Section 12.2 (on page
216)</blockquote></blockquote>

Replace the entire <i>uncompress</i> page (P3337-3339) with a pointer page
to <i>compress</i>.

Replace the entire <i>zcat</i> page (P3471-3472) with a pointer page to
<i>compress</i>. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-04-03 09:56 dannyniu       New Issue                                    
2016-04-03 09:56 dannyniu       Name                      => DannyNiu/NJF    
2016-04-03 09:56 dannyniu       Section                   => XCU.4. cksum,
compress, uncompress, zcat
2016-04-03 09:56 dannyniu       Page Number               => Too many pages  
2016-04-03 09:56 dannyniu       Line Number               => Too many lines  
2017-03-23 16:02 geoffclare     Note Added: 0003648                          
2017-04-06 15:07 agadmin        Interp Status             => ---             
2017-04-06 15:07 agadmin        Summary                  Encourage
implementations to include better integerty checksum, compression and
decompression utilities if possible. => Encourage implementations to include
better integrity checksum, compression and decompression utilities if possible.
2017-07-30 01:12 Antonio Diaz   Issue Monitored: Antonio Diaz                   

2017-08-03 16:17 geoffclare     Note Edited: 0003648                         
2017-08-03 16:18 rhansen        Note Added: 0003813                          
======================================================================


Reply via email to