Properly clean up temporary files on importer error
- Dominant language
- Go
- Stars
- 131
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
```
Apr 03 13:30:00 hashr2 bash[1362]: I0403 13:30:00.043981 1362 hashr.go:200] Preprocessing linux-tools-4.15.0-106-generic_4.15.0-106.107_amd64.deb
Apr 03 13:30:00 hashr2 bash[1362]: I0403 13:30:00.044380 1362 common.go:142] Copying linux-tools-4.15.0-106-generic_4.15.0-106.107_amd64.deb to /tmp/hashr-linux-tools-4.15.0-106-generic_4.15.0-106.107_amd64.deb-309297636/linux-tools-4.15.0-106-generic_4.15.0-106.107_amd64.deb
Apr 03 13:30:00 hashr2 bash[1362]: E0403 13:30:00.045723 1362 hashr.go:308] deb: skipping source linux-tools-4.15.0-101-generic_4.15.0-101.102_amd64.deb: error while preprocessing: error while opening tar archive in deb package: xz: data is truncated or corrupt
Apr 03 13:30:00 hashr2 bash[1362]: I0403 13:30:00.046763 1362 hashr.go:233] Deleting
```
The "Deleting" log line is missing a path https://github.com/google/hashr/blob/8c20ba5d128879cf5e317b43ecc3212bf572fb74/core/hashr/hashr.go#L233 which is probably also why the removal never happens. This could have been dangerous as well considering the command below is "sudo rm -rf ".
Contributor guide
Assessment
This issue has not been assessed yet.