On Tue, Feb 10, 2009 at 03:05:35PM -0600, Shawn Walker wrote:

>>>>   - line 122: why is this a problem?
>>> It causes the process to hang if pkg.size isn't provided.  Call this 
>>> "slap the hand of people trying to break my stuff on purpose."
>>
>> How does it hang?  Reading from /dev/null should return EOF immediately.
>> I've used this quite a bit to put dummy test files into dummy packages.
>
> It hangs when attempting to calculate the hash in chunks.  That's because 
> the length of the read data from /dev/null is always 0:
>
>         fhash = sha.new()
>         while length > 0:
>                 data = f.read(min(bufsz, length))
>                 fhash.update(data)
>                 length -= len(data)
>         f.close()
>
> I can't just read until EOF as that will fail if the underlying file object 
> is a request rfile (socket).

Why not just set pkg.size to 0 for /dev/null, then?  Or let it do the
seek/tell dance, which appears to work fine on Solaris?

>> <shrug> What's there is fine.  If we run into more memory issues, we
>> could always write the data to a temporary file in chunks.
>
> Given my responses above; does a temporary file seem appropriate now?

I think it's appropriate, but likely not necessary.

Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to