Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When executing ZAP mapper ./lib/data/cwe-nist-mapping.csv can not be found #17

Closed
SamirBou opened this issue Jan 17, 2020 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@SamirBou
Copy link

SamirBou commented Jan 17, 2020

I was not able to execute the zap mapper to convert to HDF without getting an error message saying ./lib/data/cwe-nist-mapping.csv can not be found. I was able to to successfully run the zap mapper but only by being in the lib directory of the gem itself. There might be an error with the gem load path.

@aaronlippold
Copy link
Member

Hi, odd bug at the moement - where the relative path for the data is not being set correct after the gem install. It works if I clone it and run it locally but I will have our guys look at it and see if we can resolve the bug which I think is in the .gemspec file or in the 'requires' for the data loading

@Bialogs
Copy link
Contributor

Bialogs commented Apr 10, 2020

We should take a look at the way we are loading our files from lib/

Statements like this: RESOURCE_DIR = Pathname.new(__FILE__).join('../../data') using relative paths can be dangerous and may not always grab the correct file since they have to do with invocation location.

@Bialogs Bialogs added the bug Something isn't working label Apr 10, 2020
@aaronlippold aaronlippold added this to In progress in Heimdall Tools Apr 15, 2020
@rx294
Copy link
Collaborator

rx294 commented Apr 16, 2020

Fixed in #42

@rx294 rx294 closed this as completed Apr 16, 2020
Heimdall Tools automation moved this from In progress to Done Apr 16, 2020
@rx294 rx294 reopened this Apr 16, 2020
Heimdall Tools automation moved this from Done to In progress Apr 16, 2020
@rx294
Copy link
Collaborator

rx294 commented Apr 16, 2020

Hey @Bialogs if am not mistaken RESOURCE_DIR = Pathname.new(__FILE__).join('../../data') goes by relative location of the source code ...not the invocation location... and the gem does run from any location with this code...

if you still think it should be changed what do you think about
RESOURCE_DIR = "#{File.dirname __dir__}/data" ?

@Bialogs
Copy link
Contributor

Bialogs commented Apr 16, 2020

__FILE__ should be the relative location to the particular file from the invocation location so you'd need to do a File.expand_path(__FILE__) to get the absolute location to where the gem is installed and then use that for the RESOURCE_DIR.

Not sure if converting to a Pathname object will do the same behavior as File#expand_path.

Since we are setting a RESOURCE_DIR it might make sense to include that as a constant in the same pattern as version.rb.

@rx294
Copy link
Collaborator

rx294 commented Jul 16, 2020

this issue fixed by #42;
Pathname.new method revolves the absolute path and hence works as a gem

@rx294 rx294 closed this as completed Jul 16, 2020
Heimdall Tools automation moved this from In progress to Done Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

6 participants