zerovm / zpm

ZeroVM Package Manager
Apache License 2.0
6 stars 11 forks source link

zpm bundle doesn't raise errors if files in the bundling list don't exist #119

Closed larsbutler closed 10 years ago

larsbutler commented 10 years ago

I discovered this issue when I made a typo in a bundling list file name (in the zapp.yaml). Bundling silently proceeds if the file doesn't exist.

I don't think it should do this.

larsbutler commented 10 years ago

The issue seems to be here: https://github.com/zerovm/zpm/blob/2cfa9390ba6d7f6dab068f8d13ca5429fe2cc7af/zpmlib/zpm.py#L275

The usage of glob here expects a valid pattern (a single file, a wildcard, etc.). If no files match the pattern, we never enter the inner loop to add files to the tar file.

I suggest two things to fix this:

  1. Log a WARNING message if a glob pattern has no matches.
  2. If none of the patterns in the outer loop match any files, this means that nothing will get added to to the zapp tar file. Raise an exception.
mgeisler commented 10 years ago

I agree with your analysis. Warning when the glob pattern doesn't match anything seems like a nice idea. Raising an exception is nothing matched at all is probably also okay.