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

Support generic AIX platform (non-OS400) #5

Closed
silverwind opened this issue Sep 16, 2017 · 34 comments
Closed

Support generic AIX platform (non-OS400) #5

silverwind opened this issue Sep 16, 2017 · 34 comments

Comments

@silverwind
Copy link
Owner

silverwind commented Sep 16, 2017

PRs welcome. Implementation must be pure JS.

@silverwind silverwind changed the title Support aix, openbsd and sunos platforms Support aix and sunos platforms Sep 17, 2017
@silverwind
Copy link
Owner Author

Seems it's impossible to virtualize AIX on x86 hardware, so I have to pass on supporting it.

@patrickhrastnik
Copy link
Contributor

Hi there,
we‘re having an AIX system (ppc64 architecture) and we‘re interested in making this package available on it. Since this package is a dependency for Angular as well as React, it‘s kind of necessary for us to get it working on our machine, in order to use these frameworks.
So, if you‘re still interested on working on support, please let us know.

@silverwind
Copy link
Owner Author

Can you post the exact output of these commands on a machine that ideally has both IPv4 and IPv6 gateways?

netstat -rn -f inet
netstat -rn -f inet6

@silverwind silverwind reopened this Feb 9, 2019
@silverwind silverwind changed the title Support aix and sunos platforms Support AIXplatform Feb 9, 2019
@silverwind silverwind changed the title Support AIXplatform Support AIX platform Feb 9, 2019
@patrickhrastnik
Copy link
Contributor

I‘ll come back on Monday with the results. Thanks!

@patrickhrastnik
Copy link
Contributor

Unfortunately, the netstat command is not available in the AIX terminal.
I tried other commands as well (ifconfig, ip, net stat) but none of them is available.
There's a system command called netstat, but you cannot execute it in the bash ("Command NETSTAT invalid in this environment")
We're currently looking for some solution to access this information in node.
One option might be using IBM/nodejs-itoolkit - but I have to dig into it first.

@silverwind
Copy link
Owner Author

Would like to avoid additional dependencies if possible. Is there a /proc/net/route and /proc/net/ipv6_route file maybe?

@patrickhrastnik
Copy link
Contributor

There's a database table qsys2/netstat_route_info where I can find the default gateway. There's a command "db2" available to run sql through the shell. But the statement will throw a "permission denied" exception when I try to just run it in the shell.
It might work if I run it with the proper package. I'm working on some prototype to test this.

What I didn't mention so far: It's actually not a full AIX setup we're using - It's an integrated subsystem inside a System i (also known as AS/400). That's why not all the AIX commands will work here.

@patrickhrastnik
Copy link
Contributor

It took a few moments, but I was able to make an aix.js file that runs on our system (tested with test.js)
You can have a look on it here: https://github.com/patrickhrastnik/default-gateway
Do you want me to increase the version number in package.json before I create a PR?

@patrickhrastnik
Copy link
Contributor

Sorry to say, but I wasn't able to make the aix.js file without any of the packages IBM provides for database access in node...
I added the idb-connector as an optional dependency, thus installing default-gateway won't raise an error if you're installing it on another system but aix.

@silverwind
Copy link
Owner Author

Do you want me to increase the version number in package.json before I create a PR?

No need, I will handle that after merging.

@patrickhrastnik
Copy link
Contributor

According to this:
https://docs.npmjs.com/files/package.json#optionaldependencies

The difference is that build failures do not cause installation to fail.

@silverwind
Copy link
Owner Author

silverwind commented Feb 14, 2019

Yeah, i was reminded of ldapjs/node-ldapjs#451, but as I see now, that failure there is on require when the optional dependency failed to build, not on the actual build build.

So as long as we guard the require in try ... catch, we should be fine.

@silverwind
Copy link
Owner Author

Fixed in f32b881 ... f7903f5.

@patrickhrastnik
Copy link
Contributor

Is this current version now available in npm, or is there something left/pending? Is it still version 3.0.1, or is it gonna be another release version containing these changes?
Sorry for the dumb question, Idk how things work with npm package contribution.

@silverwind
Copy link
Owner Author

Publishing soon after I finish travis changes. Then the change will need to propagate through the dependency chain. I'll do it for https://github.com/sindresorhus/internal-ip because that one is not depending on v3 yet.

@patrickhrastnik
Copy link
Contributor

Okay, thanks :)

@silverwind
Copy link
Owner Author

3.1.0 released, sindresorhus/internal-ip#20 for downstream support.

@silverwind
Copy link
Owner Author

silverwind commented Feb 22, 2019

This is open again, see #10. I will only accept pure JS support for AIX.

@patrickhrastnik
Copy link
Contributor

I‘m sorry the idb-connector package was kinda a miss... but what about a solution with odbc?
This will involve another dependency as well, but odbc is much more available (and less prone to fail on installation) than the idb-connector.

@ThePrez
Copy link
Contributor

ThePrez commented Feb 22, 2019

I second @patrickhrastnik's question, but also curious if you would accept the current change if IBM/nodejs-idb-connector#54 gets resolved. Currently, this issue only exists for AIX, and only for the non-IBMi variants of AIX. Once that issue is resolved, we will avoid the compile failures for any AIX

@silverwind
Copy link
Owner Author

I would not accept a native dependency, sorry. What we could do is drop the os field in package.json which would prevent installation failures on AIX, so react development could still work, even without the module returning anything useful.

@ThePrez
Copy link
Contributor

ThePrez commented Feb 23, 2019

Ok. We have figured out a game plan for a pure js implementation, and should have it ready within a few days.

@silverwind
Copy link
Owner Author

Great! Generally, the current approach with unspecified os should make react and friends still work on AIX if they treat the negative result from default-gateway (and in turn internal-ip) gracefully.

@ThePrez
Copy link
Contributor

ThePrez commented Feb 23, 2019

Installs of react-scripts still fail because of the old internal-ip


npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for internal-ip@3.0.1: wanted {"os":"android,darwin,freebsd,linux,openbsd,sunos,win32","arch":"any"} (current: {"os":"aix","arch":"ppc64"})

(I think this is expected, just documenting a reminder of the upstream changes, as we will want to request version bumps).

webpack-dev-server installs fine as it pulls in internal-ip 4.1

@silverwind
Copy link
Owner Author

Yes, I assume react-scripts needs to update to webpack-dev-server 3.2.0 or higher.

@ThePrez
Copy link
Contributor

ThePrez commented Feb 25, 2019

To implement on mainline AIX, we could parse out the following command: netstat -r -f inet -n/netstat -r -f inet6 -n
I'd gladly work on this, but it may take me a while to procure a machine for development. That work can be tracked in this (or a separate) issue. In the meantime, I'd love for #11 to land as soon as the new db2util utility is available.

@silverwind
Copy link
Owner Author

Sounds like a plan. For netstat parsing, you can use the other unixes like sunos.js as a template. The only difference between them is on which column the gateway entry is.

@silverwind silverwind changed the title Support AIX platform Support generic AIX platform (non-OS400) Feb 25, 2019
@ThePrez
Copy link
Contributor

ThePrez commented Feb 25, 2019

Thanks for landing the PR! Would you like to take the task of the upstream request to webpack-dev-server? I'd happily do it if you prefer, but I suspect origination from the package maintainer gives the request more legitimacy.

@silverwind
Copy link
Owner Author

No need to update webpack-dev-server, caret version takes care of it and they updated to internal-ip@4.2.0 already.

@ThePrez
Copy link
Contributor

ThePrez commented Feb 25, 2019

Upon further inspection, it looks like the sunos implementation can be used as-is for AIX! (I will try to find somewhere to test)

@ThePrez
Copy link
Contributor

ThePrez commented Feb 25, 2019

ahh, so it's just react-scripts that needs to pull in a newer webpack-dev-server

@silverwind
Copy link
Owner Author

Yes, exactly, they to update to 3.2.1 or higher.

@ThePrez
Copy link
Contributor

ThePrez commented Feb 25, 2019

PR opened to react here: facebook/create-react-app#6483

@silverwind
Copy link
Owner Author

Fixed in eb1bce7 and released as default-gateway@4.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants