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

aix: fix os.release() #10245

Closed
wants to merge 3 commits into from
Closed

aix: fix os.release() #10245

wants to merge 3 commits into from

Conversation

jBarz
Copy link
Contributor

@jBarz jBarz commented Dec 13, 2016

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

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lts-watch-v4.x labels Dec 13, 2016
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

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

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

@mscdex mscdex added aix Issues and PRs related to the AIX platform. os Issues and PRs related to the os subsystem. labels Dec 13, 2016
@Trott
Copy link
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
Copy link
Member

Trott commented Dec 13, 2016

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.)

@gibfahn
Copy link
Member

gibfahn commented Dec 13, 2016

cc/ @nodejs/platform-aix

@richardlau
Copy link
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.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

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
Copy link
Member

@Trott look ok to you now ?

@Trott
Copy link
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
Copy link
Member

jasnell commented Dec 23, 2016

@jasnell jasnell self-assigned this Dec 23, 2016
jasnell pushed a commit that referenced this pull request Dec 27, 2016
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Dec 27, 2016

Landed in 1c3c75d

@jasnell jasnell closed this Dec 27, 2016
evanlucas pushed a commit that referenced this pull request Jan 3, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
This was referenced Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 1, 2017
PR-URL: #10245
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aix Issues and PRs related to the AIX platform. c++ Issues and PRs that require attention from people who are familiar with C++. os Issues and PRs related to the os subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants