debug-mtimes-false Set @mtimes exactly when @mtime_file exist and it is nonzero

When there are more than one invocations of `add`, the second (and
later) invocations will end up with `@mtimes = false`.

This arises because the first invocation leave an empty @mtime_file, and this leads to

File.opn(@mtime_file, 'w') # => an empty file
YAML.load_file(@mtime_file) # => false

Henceforth, we would end up with `@mtimes = false`, and this is bad
news for `#add`:

/Users/travis/.casher/bin/casherin `block in add': undefined method `[]=' for false:FalseClass (NoMethodError)
from /Users/travis/.casher/bin/casherin `map'
from /Users/travis/.casher/bin/casherin `add'
from /Users/travis/.casher/bin/casher:52:in `block in run'
from /Users/travis/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/timeout.rb:69:in `timeout'
from /Users/travis/.casher/bin/casher:52:in `run'
from /Users/travis/.casher/bin/casher:231:in `<main>'

We avoid this problem by doing two things:

1. Create @mtime_file only when md5deep is not available
2. Set @mtimes only when @mtime_file exists and it is not empty

Hiro Asari avatar Hiro Asari

Push event #227 passed

  • Ran for
  • Total time
a10networks/a10-octavia:.travis.yml@f184496
language: python
jobs:
  include:
  - name: "2.7 Unit Tests"
    python: "2.7"
    env: TOX_ENV=py27
  - name: "3.5 Unit Tests"
    python: "3.5"
    env: TOX_ENV=py35
  - name: "3.6 Unit Tests"
    python: "3.6"
    env: TOX_ENV=py36
  - name: "3.7 Unit Tests"
    python: "3.7"
    env: TOX_ENV=py37
  - name: "Pep8 tests using Flake8"
    python: "3.7"
    env: TOX_ENV=pep8
install:
  - pip install tox
script:
  - tox -e $TOX_ENV
Build Config
{
  "rvm": [
    "1.9.3",
    "2.1.5"
  ],
  "sudo": false,
  "script": [
    "bundle exec rspec spec"
  ],
  "language": "ruby"
}