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

test: add env undefined regression test #18529

Closed
wants to merge 1 commit into from
Closed

Conversation

payload
Copy link

@payload payload commented Feb 2, 2018

This test is intended to trigger a bug in process.env on Windows.
process.env may return the string 'undefined' for not existing or empty environment variables in some corner cases.

Please run this test in CI on Windows x86.

Original issue: #14593 (comment)

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. v6.x labels Feb 2, 2018
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright/license header should not be included here

// USE OR OTHER DEALINGS IN THE SOFTWARE.

var exec = require('child_process').exec
var readFileSync = require('fs').readFileSync
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be const

// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to include the require('../common'); before other requires

var readFileSync = require('fs').readFileSync

process.env.test = ''
try { readFileSync('file-does-not-exist') } catch (e) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use either assert.fails() or common.expectsError()

@MylesBorins
Copy link
Contributor

is there a reason this is targetting v6.x rather than master?

@BridgeAR
Copy link
Member

BridgeAR commented Feb 6, 2018

Ping @payload

@payload
Copy link
Author

payload commented Feb 12, 2018

In the original issue (the linked comment) it was not manually tested for node 6. It failed on node 4, but not on 8. So I wanted to pin this down and thats the reason why it is targetted vor v6.x.
I recently heard from somebody with a Win x86 machine, that this test neither triggered an error, so I think I close this PR unmerged.

@payload
Copy link
Author

payload commented Feb 12, 2018

There is a better snippet here to test a bug where empty string environment variables get treated as undefined: #14593 (comment)

@BridgeAR
Copy link
Member

@nodejs/lts I guess it is your call what should be done here?

@gibfahn
Copy link
Member

gibfahn commented Feb 18, 2018

@nodejs/lts I guess it is your call what should be done here?

If the test is useful on 6.x it should be useful on master as well (I think?) So the PR should be retargeted at master and backported to 6.x as part of the normal process.

I recently heard from somebody with a Win x86 machine, that this test neither triggered an error, so I think I close this PR unmerged.

I think you're suggesting that this PR should be closed?

@addaleax
Copy link
Member

If the test is useful on 6.x it should be useful on master as well (I think?) So the PR should be retargeted at master and backported to 6.x as part of the normal process.

#18463 contained a regression test that is on master.

@gibfahn
Copy link
Member

gibfahn commented Feb 18, 2018

In that case I think this can be closed. @payload let me know if you disagree and I'll reopen.

Thanks for the PR!

@gibfahn gibfahn closed this Feb 18, 2018
@addaleax
Copy link
Member

@gibfahn I don’t think the bugfix PR itself would apply to v6.x, so it definitely makes sense to have either a separate backport of the test part, or a custom PR like this. I’d be fine with merging this

@gibfahn
Copy link
Member

gibfahn commented Feb 19, 2018

so it definitely makes sense to have either a separate backport of the test part, or a custom PR like this.

I'd rather we do the backport of the test part for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants