[issue39389] gzip metadata fails to reflect compresslevel

2020-03-03 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> fixed
stage: backport needed -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-03-03 Thread Ned Deily


Ned Deily  added the comment:


New changeset 12c45efe828a90a2f2f58a1f95c85d792a0d9c0a by Miss Islington (bot) 
in branch '3.7':
[3.7] bpo-39389: gzip: fix compression level metadata (GH-18077) (GH-18101)
https://github.com/python/cpython/commit/12c45efe828a90a2f2f58a1f95c85d792a0d9c0a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-03-03 Thread Ned Deily


Ned Deily  added the comment:

"either"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-03-03 Thread Ned Deily


Ned Deily  added the comment:

Ping. The 3.7.x backport (PR 18101) for this issue is still open and neither 
needs to be fixed or closed.

--
nosy: +ned.deily
resolution: fixed -> 
stage: resolved -> backport needed
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-22 Thread William Chargin


William Chargin  added the comment:

My pleasure; thanks for the triage and review!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-21 Thread miss-islington


miss-islington  added the comment:


New changeset ab0d8e356ecd351d55f89519a6a97a1e69c0dfab by Miss Islington (bot) 
in branch '3.8':
bpo-39389: gzip: fix compression level metadata (GH-18077)
https://github.com/python/cpython/commit/ab0d8e356ecd351d55f89519a6a97a1e69c0dfab


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your contribution William!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17489
pull_request: https://github.com/python/cpython/pull/18100

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset eab3b3f1c60afecfb4db3c3619109684cb04bd60 by Serhiy Storchaka 
(William Chargin) in branch 'master':
bpo-39389: gzip: fix compression level metadata (GH-18077)
https://github.com/python/cpython/commit/eab3b3f1c60afecfb4db3c3619109684cb04bd60


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17490
pull_request: https://github.com/python/cpython/pull/18101

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-20 Thread William Chargin


William Chargin  added the comment:

PR URL, for reference:


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-20 Thread William Chargin


William Chargin  added the comment:

Sure, PR sent (pull_request17470).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-20 Thread William Chargin


Change by William Chargin :


--
keywords: +patch
pull_requests: +17470
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/18077

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Looks reasonable. gzip should write b'\002' for compresslevel == 
_COMPRESS_LEVEL_BEST, b'\004' for compresslevel == _COMPRESS_LEVEL_FAST, and 
b'\000' otherwise. Do you mind to create a PR William.

--
keywords: +easy
nosy: +serhiy.storchaka
stage:  -> needs patch
versions:  -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-19 Thread William Chargin


William Chargin  added the comment:

(The commit reference above was meant to be git558f07891170, not a
Mercurial reference. Pardon the churn; I'm new here. :-) )

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-19 Thread William Chargin


Change by William Chargin :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39389] gzip metadata fails to reflect compresslevel

2020-01-19 Thread William Chargin


New submission from William Chargin :

The `gzip` module properly uses the user-specified compression level to
control the underlying zlib stream compression level, but always writes
metadata that indicates that the maximum compression level was used.

Repro:

```
import gzip

blob = b"The quick brown fox jumps over the lazy dog." * 32

with gzip.GzipFile("fast.gz", mode="wb", compresslevel=1) as outfile:
outfile.write(blob)

with gzip.GzipFile("best.gz", mode="wb", compresslevel=9) as outfile:
outfile.write(blob)
```

Run this script, then run `wc -c *.gz` and `file *.gz`:

```
$ wc -c *.gz
 82 best.gz
 84 fast.gz
166 total
$ file *.gz
best.gz: gzip compressed data, was "best", last modified: Sun Jan 19 20:15:23 
2020, max compression
fast.gz: gzip compressed data, was "fast", last modified: Sun Jan 19 20:15:23 
2020, max compression
```

The file sizes correctly reflect the difference, but `file` thinks that
both archives are written at max compression.

The error is that the ninth byte of the header in the output stream is
hard-coded to `\002` at Lib/gzip.py:260 (as of 558f07891170), which
indicates maximum compression. The correct value to indicate maximum
speed is `\004`. See RFC 1952, section 2.3.1:


Using GNU `gzip(1)` with `--fast` creates the same output file as the
one emitted by the `gzip` module, except for two bytes: the metadata and
the OS (the ninth and tenth bytes).

--
components: Library (Lib)
files: repro.py
messages: 360268
nosy: wchargin
priority: normal
severity: normal
status: open
title: gzip metadata fails to reflect compresslevel
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48853/repro.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com