Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Windows interop #195

Merged
merged 20 commits into from
Nov 10, 2017
Merged

Windows interop #195

merged 20 commits into from
Nov 10, 2017

Conversation

richardschneider
Copy link
Contributor

No description provided.

It is still failing, because it uses IPFS for testing and IPFS is not yet windows ready.
@ghost ghost assigned richardschneider Nov 8, 2017
@ghost ghost added the status/in-progress In progress label Nov 8, 2017
@richardschneider
Copy link
Contributor Author

richardschneider commented Nov 8, 2017

The with-dag-api tests are still failing, because it uses IPFS for testing and IPFS is not yet windows ready. Issue #196

start: false
})

node.on('ready', done)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this not already log the error if there is one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, it was just debug code. I'll revert to original.

@@ -10,7 +9,7 @@ module.exports = (node, name, pathRest, ipldResolver, resolve) => {
if (pathRest.length) {
const pathElem = pathRest.shift()
newNode = node[pathElem]
const newName = path.join(name, pathElem)
const newName = name + '/' + pathElem
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems slightly correct but not 100%. What if name ends with a slash or pathElem starts with a slash? In that case, we'll have double-slash, while path.join would handle it correctly (but not correctly on windows)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally agree with you. Ideally I should be using be path.posix.join which works just fine on Node. However, in the Browser it fails with TypeError: Cannot read property 'join' of undefined] . Must be a babel/webpack issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make sure to not let this one pass. Please add a test for @victorbjelkholm's case and ensure it works both in browser and node.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test case (guard) you want can never happen. name is really a hash, so it can not have shash. pathElem comes from pathRest which is an array that is path separated.

@richardschneider
Copy link
Contributor Author

@diasdavid I've spent the day trying to get the tests to work. But the tests, especially in the Browser, just keep failing non-deterministically.

Playing with test timeouts is non-productive. My gut feel is that some evil exists between aysnc and pull. I see that others are looking into this.

There are a few os-specific issues that I've addressed. Could we just get them into master.

@daviddias
Copy link
Contributor

daviddias commented Nov 9, 2017

@pgte can we have you reviewing this one?

@daviddias daviddias requested a review from pgte November 9, 2017 10:49
Copy link
Contributor

@pgte pgte left a comment

Choose a reason for hiding this comment

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

Generally speaking, given that this package does not touch the material host file-system, and that it's named unixfs, and that UNIX exposes a file system where paths are separated by the / character, I think that the path separators should not be changed.

I think that it should be the responsibility of package that accesses the filesystem (js-ipfs) to translate these paths into native FS paths. Wouldn't you agree?

@richardschneider
Copy link
Contributor Author

richardschneider commented Nov 9, 2017

@pgte I agree.

This package's purpose is to return a path in POSIX format (forward slashes). It fails when running on Windows, by returning back slashes. This is because it uses path.join which is os specific.

The essential change is here

@ghost ghost removed the status/in-progress In progress label Nov 9, 2017
@pgte
Copy link
Contributor

pgte commented Nov 9, 2017

@richardschneider OK, sorry, misunderstood your intent, it's clear now for me, Thanks!

@pgte pgte reopened this Nov 9, 2017
@ghost ghost assigned pgte Nov 9, 2017
@ghost ghost added the status/in-progress In progress label Nov 9, 2017
@pgte pgte removed their assignment Nov 9, 2017
pgte
pgte previously approved these changes Nov 9, 2017
Copy link
Contributor

@pgte pgte left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@richardschneider
Copy link
Contributor Author

@pgte Not sure of the protocol. Do I merge the PR now, and wait for @diasdavid to then release it NPM?

@pgte
Copy link
Contributor

pgte commented Nov 9, 2017

not sure, usually it's @diasdavid that merges..

package.json Outdated
@@ -11,7 +11,7 @@
"build": "aegir build",
"test": "aegir test",
"test:node": "aegir test --target node",
"test:browser": "aegir test --target browser",
"test:browser": "aegir test --target browser --timeout 30000",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not use global timeouts. We want to have timeouts per test.

@@ -10,7 +9,7 @@ module.exports = (node, name, pathRest, ipldResolver, resolve) => {
if (pathRest.length) {
const pathElem = pathRest.shift()
newNode = node[pathElem]
const newName = path.join(name, pathElem)
const newName = name + '/' + pathElem
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make sure to not let this one pass. Please add a test for @victorbjelkholm's case and ensure it works both in browser and node.js

test/browser.js Outdated
// require('./exporter')(repo)
// require('./exporter-subtree')(repo)
require('./exporter')(repo)
require('./exporter-subtree')(repo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why enable these?

@@ -36,7 +36,7 @@ module.exports = (repo) => {
fileEql(files[0], smallFile, done)
})
)
})
}).timeout(10 * 1000)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a small nitpick but a useful one. We prefer to have the timeouts at the top of the test so that it is easy to find it.

@@ -105,7 +107,8 @@ const strategyOverrides = {

}

describe('with dag-api', () => {
// TODO: waiting for IPFS support on windows, https://github.com/ipfs/js-ipfs-unixfs-engine/issues/196
describe.skip('with dag-api', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not skip tests. I understand that you need js-ipfs support on windows but enabling this test will only make Appveyor fail, which is fine while Windows Support is a work in progress

@daviddias
Copy link
Contributor

All CI is red, something must have gone wrong.

@richardschneider
Copy link
Contributor Author

As usual, the Browser tests are failing.

@richardschneider
Copy link
Contributor Author

@diasdavid LGTM could you please review again

@ghost ghost assigned daviddias Nov 10, 2017
daviddias
daviddias previously approved these changes Nov 10, 2017
@daviddias daviddias merged commit aa21ff3 into master Nov 10, 2017
@daviddias daviddias deleted the windows-interop branch November 10, 2017 10:40
@ghost ghost removed the status/in-progress In progress label Nov 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants