[comp.sources.bugs] Problems with "." in filenames with Unix 'lharc'

jjsc@inf.rl.ac.uk (John Cullen) (03/13/90)

Has anyone else used the 'lharc' program recently submitted to c.s.misc?
I successfully compiled the code and was quite happy with the program (nice
compression ratio :-) however there seems to be a bug (or maybe I've missed
something obvious). When a file with any kind of extension (or in fact any
character in the name *other* than the basic alphanumeric set) is added to
the archive the "." (or whatever else) is (apparently) removed. Unfortunately
I have been unable to then retrieve the file from the archive. Kind of
annoying if you know what I mean :-)

Has anyone else noticed this problem, and better still, got a solution?!
The program works fine for straight filenames without extensions etc, but
that's all. I know one solution would be to rename all files that are
archived to remove the "."'s but that would be a pain...

Any help from anyone out there would be appreciated (oh, an English version of
the doc file would be nice too, if anyone should happen to have translated it!)

Thanks in advance,

John
-- 
===============================================================================
John Cullen                     || JANET : jjsc@uk.ac.rl.inf
System Support Group            || ARPA  : jjsc%inf.rl.ac.uk@nsfnet-relay.ac.uk
Informatics Department          || BITNET: jjsc%uk.ac.rl.inf@ukacrl
Rutherford Appleton Laboratory  || UUCP  : {...!mcvax}!ukc!rlinf!jjsc
Chilton, Didcot, Oxon. OX11 0QX || VOICE : +44 (0)235 821900 ext 6555  
===============================================================================

mj@myrias.com (Michal Jaegermann) (03/15/90)

From article <8795@nfs4.rl.ac.uk>, by jjsc@inf.rl.ac.uk (John Cullen):
> When a file with any kind of extension (or in fact any
> character in the name *other* than the basic alphanumeric set) is added to
> the archive the "." (or whatever else) is (apparently) removed. Unfortunately
> I have been unable to then retrieve the file from the archive. Kind of
> annoying if you know what I mean :-)
> 
In a function which writes header (write_header ?) there is a call to
toupper() which is not guarded by "if (islower(c)) {...".  This may or
may not make your life hard depending on how your toupper behaves.

If you are using 'lharc' only for storing and retirieving files on Un*x,
and not for exchanging with other, non-case-sensitive operating systems,
you want probably undefine macro STRICT. Otherwise names of all unpacked
files will come in lowercase only.  As a side effect this will solve
also the problem above as an offending 'toupper()' call will be not
executed.


	Michal Jaegermann
	Myrias Research Corporation
	Edmonton, Alberta, CANADA
	mj@myrias.COM
	...{uunet,alberta}!myrias!mj

harry@neuron1.Jpl.Nasa.Gov (Harry Langenbacher) (03/17/90)

In article <637445274.6082@myrias.com> mj@myrias.com (Michal Jaegermann) writes:
>From article <8795@nfs4.rl.ac.uk>, by jjsc@inf.rl.ac.uk (John Cullen):
>>   stuff about filename problems with lharc, deleted
>In a function which writes header (write_header ?) there is a call ... deleted
>you want probably undefine macro STRICT. ...
>
>	Michal Jaegermann

so I made these changes to lharc.c :
---------------------------
< #define STRICT
---
> /* #define STRICT */

< void userbreak(void)
---
> void userbreak()

<   printf("\nC-LHarc for %s Version 1.00   (C) 1989-1990 Y.Tagawa, Kai Uwe Rommel\n"
<          "\nUsage: %s {axevlufdmctp}[qnftv] archive_file [files or directories...]\n",
---
>   printf("\nC-LHarc for %s Version 1.00   (C) 1989-1990 Y.Tagawa, Kai Uwe Rommel\n\
> \nUsage: %s {axevlufdmctp}[qnftv] archive_file [files or directories...]\n",

several more changes like that deleted, and finally:

< copy_archive(src, dst)char *src; char *dst;
---
> copy_archive(char *src, char *dst)
---------------------------

It compiles and runs ok on my sun 3/160 OS 4.0.3 . I could compile lharc.c with -O
and use -O4 on lzhuf.c lhio.c . Using -O2,3,4 on lharc.c always gets a core dump from
executing lharc.

 I love the compression ratio, but - I get core dumps when I do

lharc c arcname directoryname

what I have to do is:

lharc c arcname directoryname/*

which works just fine, except in one caes where directoryname/* was all directories,
which also dumped core, forcing me to do:

> foreach direct (installed/*)
? lharc a installed.lzh $direct/*
? end

which also worked fine.

Does anyone know how to get lharc to handle directory names without barfing ?

thanx


- Harry Langenbacher 818-354-9513
harry%neuron1@jpl-mil.jpl.nasa.gov
harry@neuron1.jpl.nasa.gov 128.149.12.7