Bug 8348 - [PATCH] zforce(1) is broken: fix
Summary: [PATCH] zforce(1) is broken: fix
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 2.2.7-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: ru
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-10-17 00:00 UTC by wefa
Modified: 1999-08-16 22:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wefa 1998-10-17 00:00:00 UTC
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.

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
How-To-Repeat: use it
Comment 1 ru freebsd_committer freebsd_triage 1999-08-11 11:35:11 UTC
State Changed
From-To: open->feedback

Patch applied in -CURRENT, thanks! 


Comment 2 ru freebsd_committer freebsd_triage 1999-08-11 11:35:11 UTC
Responsible Changed
From-To: freebsd-bugs->ru

So I remember to MFC. 
Comment 3 ru freebsd_committer freebsd_triage 1999-08-16 21:58:58 UTC
State Changed
From-To: feedback->closed

Fixed in RELENG_3.