From nobody  Fri Oct 16 15:56:29 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id PAA06547;
          Fri, 16 Oct 1998 15:56:29 -0700 (PDT)
          (envelope-from nobody)
Message-Id: <199810162256.PAA06547@hub.freebsd.org>
Date: Fri, 16 Oct 1998 15:56:29 -0700 (PDT)
From: wefa@callcenter.systemhaus.net
To: freebsd-gnats-submit@freebsd.org
Subject: zforce(1) is broken: fix
X-Send-Pr-Version: www-1.0

>Number:         8348
>Category:       bin
>Synopsis:       [PATCH] zforce(1) is broken: fix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 16 16:00:00 PDT 1998
>Closed-Date:    Mon Aug 16 13:58:58 PDT 1999
>Last-Modified:  Mon Aug 16 14:01:15 PDT 1999
>Originator:     Christoph Weber-Fahr
>Release:        2.2.7-RELEASE
>Organization:
O.tel.o Caommunications
>Environment:
FreeBSD paris.otelo-call.de 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Tue Oct 13 02:08:22 CEST 1998     wefa@newproxy.otelo-call.de:/usr/src/sys/compile/WEB  i386
>Description:
1) zforce does nothing. (it fails to identify gzip files and 
   therefore doesn't 'force' anything)
2) if you fix 1) it behaves nonsensical - it tries to truncate
   filenames to 14 chars, even though there is no such limit
   in the FreeBSD filesystem
3) the code doing 2) is broken as well - it actually only 
   squeezes '.gz' into the last 3 chars of files of any 
   length > 12, but doesn't shorten them. Oh, and this 
   doesn't work in MSDOS file systems either, because it 
   _loves_ to produce files ending in ..gz, which are illegal
   in 8.3 filesystems.
>How-To-Repeat:
use it
>Fix:
I suggest the appended fix:

paris# [bin] diff zforce.org zforce
6c6,13
< # 12345678901234 is renamed to 12345678901.gz
---
> #
> # Fixed gzip call (added -v option)
> # Removed trunking code. Code
> #  - is unnecessary on FreeBSD
> #  - was used in FreeBSD despite of that
> #  - was buggy anyway (it didn't work as advertized)
> #  19981010   CWF
>
27c34,36
<   if gzip -l < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
---
>   if gzip -vl < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
>
>     new="$i.gz"
29,33d37
<     if test `expr "$i" : '^............'` -eq 12; then
<       new=`expr "$i" : '\(.*\)...$`.gz
<     else
<       new="$i.gz"
<     fi
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: ru 
State-Changed-When: Wed Aug 11 03:35:11 PDT 1999 
State-Changed-Why:  
Patch applied in -CURRENT, thanks! 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Wed Aug 11 03:35:11 PDT 1999 
Responsible-Changed-Why:  
So I remember to MFC. 
State-Changed-From-To: feedback->closed 
State-Changed-By: ru 
State-Changed-When: Mon Aug 16 13:58:58 PDT 1999 
State-Changed-Why:  
Fixed in RELENG_3. 
>Unformatted:
