[pacman-dev] [PATCH] makepkg: Fix integrity check when files are missing.

Dan McGee dpmcgee at gmail.com
Mon Apr 13 00:04:55 EDT 2009


On Sun, Apr 12, 2009 at 10:56 PM, Loui Chang <louipc.ist at gmail.com> wrote:
> On Sat, Apr 11, 2009 at 01:08:15PM -0500, Dan McGee wrote:
>> On Mon, Apr 6, 2009 at 11:15 PM, Loui Chang <louipc.ist at gmail.com> wrote:
>> > The index in the for loop wasn't being incremented, so
>> > if the first file wasn't found, the second file would be compared to the
>> > first checksum, rather than the second.
>> >
>> > Signed-off-by: Loui Chang <louipc.ist at gmail.com>
>>
>> This seems fine, but what the hell is going on around line 580? Is it
>> just me that thinks a double check on "$file" is odd?
>
> Yeah it did seem odd to me.
>
>> Originally when this came in it looked like the following (commit 142225fd):
>> +
>> +                       if [ ! -f "$file" ] ; then
>> +                               if [ ! -f "$SRCDEST/$file" ] ; then
>> +                                       error "$(gettext "Unable to
>> find source file %s to generate checksum.")" "$file"
>> +                                       plain "$(gettext "Aborting...")"
>> +                                       exit 1
>> +                               else
>> +                                       file=$SRCDEST/$file
>> +                               fi
>> +                       fi
>> +
>>
>> git-blame is lying to me here and I can't find when this was changed.
>> Anyone else know what the heck happened here?
>
> Hmm. I'm not sure what's going on there.
> The relevant section for 142225fd looks like this for me:

Yeah, Xavier and I figured it out over IM the other day. You'll see
this commit which resolves the issue that has been outstanding for
quite some time.

http://projects.archlinux.org/?p=pacman.git;a=commitdiff;h=101c16b3eb8048dffd1c6c4438e84b759d2e2aff

> @@ -541,14 +551,22 @@ check_checksums() {
>                                file="$(strip_url "$file")"
>                                echo -n "    $file ... " >&2
>
> +                               if [ ! -f "$file" ] ; then
> +                                       if [ ! -f "$file" ] ; then
> +                                               echo "$(gettext "NOT FOUND")" >&2
> +                                               errors=1
> +                                               continue
> +                                       else
> +                                               file=$SRCDEST/$file
> +                                       fi
> +                               fi
> +
>                                if echo "${integrity_sums[$idx]}  $file" | ${integ}sum --status -c - &>/dev/null; then
>                                        echo "$(gettext "Passed")" >&2
>                                else
>                                        echo "$(gettext "FAILED")" >&2
>                                        errors=1
>                                fi
> -
> -                               idx=$(($idx+1))
>                        done
>
>                        if [ $errors -gt 0 ]; then


More information about the pacman-dev mailing list