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

Loui Chang louipc.ist at gmail.com
Sun Apr 12 23:56:42 EDT 2009


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:

@@ -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