[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pkg_info bug
"Denis A. Doroshenko" writes:
>
> i checked the patch to /cvs/src/usr.sbin/pkg_install/info/show.c applied
> by Marco S Hyman that absolutely matches one advised in the message pasted
> below. well, i may be misuderstand something, but i think there should be
> test for line_length is not equal to zero, if it is the next reference to
> line[-1] will cause problems. ok, it should be rare case when this may
> happen, but i guess, resolving old problems we shouldn't create newer
> ones, should we? btw, fgets/strlen are not the best "twix", since their
> result not always corresponds to reality.
Correct, and thanks for double checking things. The more people
looking over my shoulder the better :-)
> weird, in same file (show.c) different functions use differnt subrotines
> for file reading: show_file() (line 64) uses fread() and show_index()
> (line 85) uses fgets() ... to do the same (display content of file)?
In general, the pkg_* utilities are terrible. You are probably seeing
the result of several different people mucking with the code, trying
to fix various things. Several people (including me) have proposed
doing a re-write, but no-one (including me) has gotton off their butt
and actually done anything.
// marc