aix: fix os.release() #10245

Closed
wants to merge 3 commits into
from

Projects

None yet

9 participants

@jBarz
Contributor
jBarz commented Dec 13, 2016 edited
Checklist
  • make -j4 test (UNIX)
Affected core subsystem(s)

os.release() on aix

Description of change

On AIX info.release is only a part of OS release version.
We need to combine info.version and info.release

@jBarz jBarz referenced this pull request in ibmruntimes/node Dec 13, 2016
Closed

AIX - os.release() returns only minor version of OS #34

src/node_os.cc
@@ -85,7 +85,13 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {
if (uname(&info) < 0) {
return env->ThrowErrnoException(errno, "uname");
}
+# ifdef _AIX
+ char release[256];
+ sprintf(release, "%s.%s", info.version, info.release);
@richardlau
richardlau Dec 13, 2016 Member

Maybe use snprintf for consistency with the rest of this file?

@mscdex mscdex added aix os labels Dec 13, 2016
@Trott
Member
Trott commented Dec 13, 2016

Should we add a test for this? Currently in test/parallel/test-os.js, there's this:

const release = os.release();
console.log('release = ', release);
is.string(release);
assert.ok(release.length > 0);

Maybe add something like this right below it?

//TODO: Check format on more than just AIX
if (common.isAix)
  assert.ok(/^\d+\.\d+\.\d+$/.test(release)); // <-- substitute whatever regexp makes sense for AIX
@Trott
Member
Trott commented Dec 13, 2016 edited

The docs for os.release() say this:

On POSIX systems, the operating system release is determined by calling uname(3).

With this change, is that still accurate for AIX? (If so, then great. If not, then perhaps a doc update should be included.)

@richardlau
Member

The docs for os.release() say this:

On POSIX systems, the operating system release is determined by calling uname(3).

With this change, is that still accurate for AIX? (If so, then great. If not, then perhaps a doc update should be included.)

Yes, the change is still accurate -- The code is still calling uname but is now combining two fields instead of just returning one. On AIX it looks like uname splits the OS version over two struct utsname fields, e.g. AIX 7.1 returns 7 in the version field and 1 in the release field.

@jBarz jBarz add test for os.release() on aix
4eba54c
@mhdawson

LGTM. Would be nice to fill in additional test for other platforms, but since this is broken on AIX, don't want to hold up landing this for that.

@mhdawson
Contributor

@Trott look ok to you now ?

@Trott
Member
Trott commented Dec 14, 2016

@mhdawson Test looks good to me. (The C++ change seems good to me too but I'm a beginner-at-best C++ coder so that probably doesn't mean much.)

@jasnell jasnell self-assigned this Dec 23, 2016
@jasnell jasnell added a commit that referenced this pull request Dec 27, 2016
@jBarz @jasnell jBarz + jasnell os: fix os.release() for aix and add test
PR-URL: #10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
1c3c75d
@jasnell
Member
jasnell commented Dec 27, 2016

Landed in 1c3c75d

@jasnell jasnell closed this Dec 27, 2016
@joyeecheung joyeecheung added a commit to joyeecheung/node that referenced this pull request Jan 2, 2017
@jBarz @joyeecheung jBarz + joyeecheung os: fix os.release() for aix and add test
PR-URL: nodejs#10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
5cd387e
@evanlucas evanlucas added a commit that referenced this pull request Jan 3, 2017
@jBarz @evanlucas jBarz + evanlucas os: fix os.release() for aix and add test
PR-URL: #10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
eb54845
@evanlucas evanlucas referenced this pull request Jan 3, 2017
Merged

v7.4.0 release proposal #10589

@evanlucas evanlucas added a commit that referenced this pull request Jan 3, 2017
@jBarz @evanlucas jBarz + evanlucas os: fix os.release() for aix and add test
PR-URL: #10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
899496a
@evanlucas evanlucas added a commit that referenced this pull request Jan 4, 2017
@jBarz @evanlucas jBarz + evanlucas os: fix os.release() for aix and add test
PR-URL: #10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
75efdeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment