Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4c82125adb446681c7a51865b06b724f24d7d871
Ticket: 3390073fffffffffffffffffffffffffffffffff
Bug in zlib command in 8.6b2
User & Date: rich123 on 2011-08-12 08:25:59
Changes

  1. icomment:
    Following up on the posting to comp.lang.tcl "zlib push creates corrupt file gz file when source size is equal or greater than 8092" this test script:
    
    puts "Tcl[ info patchlevel ]"
    
    set zeros [ open /dev/zero {RDONLY BINARY} ]
    
    foreach size {8191 8192} {
      set data [ read $zeros $size ] 
    
      set fout [ open $size {WRONLY CREAT BINARY} ]
      puts -nonewline $fout $data
      close $fout
    
      set fin [open $size rb]
      set header [dict create filename $size time [file mtime $size] comment "Created by Tcl[info patchlevel]"]
      set fout [zlib push gzip [open $size.gz wb] -header $header]
      fcopy $fin $fout
      close $fin
      close $fout
    
    }
    
    close $zeros
    
    Produces this result on 64-bit Linux - GCC 4.4.4:
    
    rellis@d820:~/downloads/tcl86b2/inst/usr/local/bin$ ./tclsh8.6 testgzip.tcl 
    Tcl8.6b2
    rellis@d820:~/downloads/tcl86b2/inst/usr/local/bin$ gunzip -tv *gz
    8191.gz:         OK
    8192.gz:
    gzip: 8192.gz: invalid compressed data--format violated
    
    And produces these resulting files:
     8 -rw-r--r-- 1 rellis 8191 2011-08-11 21:22 8191
     4 -rw-r--r-- 1 rellis     72 2011-08-11 21:22 8191.gz
     8 -rw-r--r-- 1 rellis 8192 2011-08-11 21:22 8192
     8 -rw-r--r-- 1 rellis 4159 2011-08-11 21:22 8192.gz
    
    
    
  2. login: "rich123"
  3. mimetype: "text/plain"
  4. username: "rich123"