On 08/08/2018 12:20 AM, Luke Shumaker wrote:
> On Wed, 08 Aug 2018 00:05:25 -0400,
> Eli Schwartz wrote:
>>
>> On 08/07/2018 11:16 PM, Luke Shumaker wrote:
>>> +check_fullpkgver() {
>>> + local fullver=$1 type=$2
>>> + local ret=0
>>> +
>>> + # If there are multiple colons or multiple hyphens, there's a
>>> + # question of how we split it--it's invalid either way, but it
>>> + # will affect error messages. Let's mimic version.c:parseEVR().
>>> +
>>> + if [[ $fullver = *:* ]]; then
>>> + # split at the *first* colon
>>> + check_epoch "${fullver%%:*}" "$type" || ret=1
>>> + fullver=${fullver#*:}
>>> + fi
>>> +
>>> + if [[ $fullver = *-* ]]; then
>>> + # split at the *last* hyphen
>>> + check_pkgrel "${fullver##*-}" "$type" || ret=1
>>> + fullver=${fullver%-*}
>>> + fi
>>
>> Allan and I discussed on IRC that this does interesting things if
>> someone uses e.g. makedepends=('perl-test-fatal>=-0.003')
>> This was a real example discovered during the perl rebuild...
>>
>> The resulting error message is:
>> ERROR: pkgver in makedepends is not allowed to be empty.
>>
>> Your patch improves error reporting in several ways, but it does nothing
>> for this. So while we are at it, this would be a great time to check
>> when splitting off the epoch/pkgrel, whether there's actually a pkgver
>> on the other side.
>
> Hmm, I'll have to ponder how to best handle that. This is a problem
> of "given a malformed input, what's the most likely thing that the
> user intended?", which is a problem with no robust answer.
>
> Perhaps change the check to:
>
> if [[ $fullver = ?*-* ]]; thenThat should be fine. We're working on the assumption that - epoch is optional (and implied "0") - pkgrel is optional - most versioned *depends/provides in existence specify neither A completely leading "-" is almost certainly a typo within a pkgver (it happens), not a pkgrel with a completely missing pkgver (very unlikely). -- Eli Schwartz Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
