Bumping again - I found a related bz in my backlog... On 05/29/2014 01:15 PM, Eric Blake wrote: > On 05/29/2014 05:54 AM, Peter Krempa wrote: >> Use virStrToLong_uip instead of virStrToLong_ui to reject negative >> numbers in the helper. None of the callers expects the wraparound >> "feature" for negative numbers. > > I had to audit all callers, and found the following (fortunately the > list is fairly small): > <snip> > > vol-upload, vol-download [offset, length]: Can't a negative offset be > treated as offset from the end of the file? And doesn't -1 as implying > unlimited length make sense? Here, allowing -1 might make sense > BZ - https://bugzilla.redhat.com/show_bug.cgi?id=1087104 has a different take on whether negative values should be allowed. In particular: " Additional Info: In manual page: vol-download [--pool pool-or-uuid] [--offset bytes] [--length bytes] --offset is the position in the storage volume at which to start reading the data. --length is an upper bound of the amount of data to be downloaded. It is said that offset is the position in the storage volume at which to start reading the data, so I think the value of offset should be no smaller than 0, option length as well. " So - do we "adjust" the man page to indicate that using a -1 is "OK" and what it would do? Probably similar type action for the changes made (commit id's 0e2d73051 && c62125395)? Or does a negative "really" make sense for offset? Sure -1 makes sense and works because 'lseek()' allows it, but other negative numbers I just tried get an error: virsh vol-download --pool default qcow3-vol2 /home/vm-images/raw --offset -2 --length -1000 error: cannot download from volume qcow3-vol2 error: Unable to seek /home/vm-images/qcow3-vol2 to 18446744073709551614: Invalid argument Not even sure what a negative length file is... Is that the definition of a sparse file? Is the suggestion that we'd be downloading (or uploading) from end of file backwards some number of bytes? Not quite sure that's what's happening as the negative value is turned positive and it seems means "everything". So while, yes, -1 for both makes sense as a sort of pseudonym for maximum - other values don't, but how does one go about distinguishing that? (eg, that a -1 was supplied and it's OK, although other negative values are not). John -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list