Skip to content

Fixes for #95 and #96 (caused by accident in #81) and other bugs#99

Merged
jwerle merged 6 commits intobpkg:masterfrom
potherca-contrib:bug/95/bpkg-install
Feb 2, 2018
Merged

Fixes for #95 and #96 (caused by accident in #81) and other bugs#99
jwerle merged 6 commits intobpkg:masterfrom
potherca-contrib:bug/95/bpkg-install

Conversation

@Potherca
Copy link
Member

@Potherca Potherca commented Jan 19, 2018

This PR fixes #95 and #96, which were unfortunately caused by changes from the cleanup in #81.

Other bug-fixes

I also encountered other bugs, fixes are included:

  • Fixes bug in save_remote_file function in bpkg-install that occurred if a save-path did not exists. The function now attempts to create the directory before trying to save a file to it. This fix allows for nested files and script entries from package.json to be properly downloaded.
  • Fixes bug in bpkg-install global check. Even before my accidental breakage in Issues 78 - Makes install.sh more shellcheck compliant. #81, the check was broken. The bug occurred when a "global" section was present in a packages.json file but had a value other than true. Due to the logic of the check, such a package would then be marked for global install.
  • Fixes bug in bpkg-install scripts download that occurred when scripts were not in the root of the package. The Github '404' text file was then downloaded.

Other changes

  • Changes logic to create array from JSON sections in bpkg-install. The was code that claimed to make ## comma to space but the output of the JSON does not contain any commas.
  • Add message in bpkg-install clarifying sub-dependencies are being installed.

Final points of concern

When reviewing the changes from #81, I came across an edit that changes IFS="|" to IFS="'|'". This looks like a mistake which could also spell trouble...

As I feel horrible for introducing these bugs, I think it might be wise to redirect any effort purely into creating tests for bpkg before any other efforts are made.

The validation logic I used to check the working of each version of the code (pre-breakage, post-breakage, fixed) can be found here: https://gist.github.com/Potherca/d9b5817de94a45fff6ed698c799b08f3

The bug occurred if a save-path did not exists. The function now attempts to create the directory before trying to save a file to it.
Bug was caused by incorrect placement of quoute character, causing the result of a check to be incorrect.
The bug occurred when scripts were not in the root of the package.
Also cleans up the download logic for the files section.
The bug occurred when a "global" section was present in a `packages.json` file but had a value other than "true".
Due to the logic of the check, such a package would then be marked for global install.
This was referenced Jan 19, 2018
@jwerle jwerle merged commit d843146 into bpkg:master Feb 2, 2018
@jwerle
Copy link
Member

jwerle commented Feb 2, 2018

👍

@Potherca Potherca deleted the bug/95/bpkg-install branch March 2, 2018 11:16
@Potherca Potherca added the bug label Jan 1, 2021
@Potherca Potherca added this to the Release v0.3.0 milestone Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Unable to find package.json

2 participants