Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.

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

Description

@andrewlow

os.release(); will return '1' on AIX 6.1

On Linux systems we get back the same answer as uname -r

The documentation http://nodejs.org/api/os.html#os_os_release claims to run the operating system release. (it appears to be open to interpretation)

Activity

  1. andrewlow commented on May 30, 2014

    @andrewlow
    CollaboratorAuthor

    On AIX - uname -rv returns "1 6"
    This is interpreted as release 1, version 6 -> humans would call this 6.1

    The following patch causes os.release() on AIX to return just that

    diff --git a/src/node_os.cc b/src/node_os.cc
    index 07f73f4..571cc91 100644
    --- a/src/node_os.cc
    +++ b/src/node_os.cc
    @@ -94,7 +94,19 @@ static Handle<Value> GetOSRelease(const Arguments& args) {
       if (uname(&info) < 0) {
         return ThrowException(ErrnoException(errno, "uname"));
       }
    +#ifdef _AIX
    +  /*
    +   * On AIX info.release is only a part of OS release version.
    +   * We need to combine info.version and info.release
    +   */
    +  char versionInfo[2*SYS_NMLN+1] = {0};
    +  strcpy(versionInfo, info.version);
    +  versionInfo[strlen(info.version)] = '.';
    +  strcpy(versionInfo + strlen(info.version) + 1, info.release);
    +  return scope.Close(String::New(versionInfo));
    +#else
       return scope.Close(String::New(info.release));
    +#endif
     #else // __MINGW32__
       char release[256];
       OSVERSIONINFO info;
    
  2. jBarz commented on Dec 13, 2016

    @jBarz
  3. self-assigned this
    on Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions