New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 783945 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

autotest: client/bin/utils.py: E:148,24: Undefined variable 'hash_file' (undefined-variable)

Project Member Reported by drinkcat@chromium.org, Nov 10 2017

Issue description

While uploading a change to client/bin/utils.py, I noticed this error:

E:148,24: Undefined variable 'hash_file' (undefined-variable)

The code is quite old (it was moved recently from base_utils.py to utils.py, though):

d60882f21c client/bin/base_utils.py     (lmr                    2010-02-04 03:26:36 +0000  113) def unmap_url_cache(cachedir, url, expected_hash, method="md5"):
...
d60882f21c client/bin/base_utils.py     (lmr                    2010-02-04 03:26:36 +0000  138)     while not file_hash == expected_hash:
d60882f21c client/bin/base_utils.py     (lmr                    2010-02-04 03:26:36 +0000  139)         if os.path.isfile(file_local_path):
d60882f21c client/bin/base_utils.py     (lmr                    2010-02-04 03:26:36 +0000  140)             file_hash = hash_file(file_local_path, method)
d60882f21c client/bin/base_utils.py     (lmr                    2010-02-04 03:26:36 +0000  141)             if file_hash == expected_hash:
d60882f21c client/bin/base_utils.py     (lmr                    2010-02-04 03:26:36 +0000  142)                 # File is already at the expected position and ready to go
d60882f21c client/bin/base_utils.py     (lmr                    2010-02-04 03:26:36 +0000  143)                 src = file_from_url

It does appear hash_file function was removed by this commit:

commit c32ef4d9f8a9f659cafdfaeebfdcfcb6d3356211
Author: Richard Barnette <jrbarnette@chromium.org>
Date:   Thu Apr 21 12:31:05 2016 -0700

    [autotest] Delete client/tests/kvm and related dead code.
    
    This deletes code related to kernel tests for KVM (N.B. _not_ the
    Chrome OS tests that run inside KVM in the builders), as well as
    various client-side libraries that become dead after the deletion.
    
    BUG=None
    TEST=Run push_to_prod suite on a local instance
    
    Change-Id: I6cb49f7c0eac5da07c27112071e0effda69f2a7a
    Reviewed-on: https://chromium-review.googlesource.com/340243
    Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
    Tested-by: Richard Barnette <jrbarnette@chromium.org>
    Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
    Reviewed-by: Dan Shi <dshi@google.com>

And there are still a few users of unmap_url_cache, not sure if any of them matter:

client/tests/dacapo/dacapo.py:        dacapo_pkg = utils.unmap_url_cache(cachedir, dacapo_url, dacapo_md5)
client/tests/dacapo/dacapo.py:            jvm_pkg = utils.unmap_url_cache(cachedir, jvm_pkg_url, jvm_pkg_md5)
client/tests/dma_memtest/dma_memtest.py:        self.tarball = utils.unmap_url_cache(self.cachedir, tarball_url,
client/tests/lsb_dtk/lsb_dtk.py:                dtk_manager_pkg = utils.unmap_url_cache(self.cachedir,
client/tests/lsb_dtk/lsb_dtk.py:                lsb_pkg = utils.unmap_url_cache(self.cachedir, lsb_url, lsb_md5)
 
Components: Infra>Client>ChromeOS

Comment 2 by nxia@chromium.org, Nov 15 2017

Cc: -jrbarnette@chromium.org
Owner: jrbarnette@chromium.org
Status: Assigned (was: Untriaged)
Hunh.  I was OOO for an extended time when this was reported, and I've
only just now discovered it.  :-(

By and large, everything under client/tests and server/tests is likely
to be dead code.  So, I believe the correct fix will be to remove
everything that still indirectly depends on `hash_file()`.

Owner: akes...@chromium.org
Status: Fixed (was: Assigned)
Recently fixed with this CL:
    https://chromium-review.googlesource.com/884902

Sign in to add a comment