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

xplatform.loadFileUTF8 returns error for wrong file #454

Merged
merged 3 commits into from
May 22, 2024

Conversation

Martin-Zeithaml
Copy link
Contributor

@Martin-Zeithaml Martin-Zeithaml commented May 17, 2024

Proposed changes

This PR addresses Issue: #453

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

PR Checklist

Please delete options that are not relevant.

  • If the changes in this PR are meant for the next release / mainline, this PR targets the "staging" branch.
  • My code follows the style guidelines of this project (see: Contributing guideline)
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • video or image is included if visual changes are made
  • Relevant update to CHANGELOG.md

Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
@Martin-Zeithaml
Copy link
Contributor Author

Fix seems to be working

JavaScript code

import * as xplatform from 'xplatform';
import * as fs from '/zowe/bin/libs/fs';
xplatform.loadFileUTF8(fs.createTmpFile(), xplatform.AUTO_DETECT);

Shell to run

#!/bin/sh
echo "*** 2.15.0 ***"
/zowe/2150/bin/utils/configmgr -script ./test_xplat.js
echo "*** Fix ***"
/zowe/fix/bin/utils/configmgr -script ./test_xplat.js

Output

*** 2.15.0 ***
CEE3204S The system detected a protection exception (System Completion Code=0C4).
         From compile unit ZZOW08:/ZOWE/tmp/pax-packaging-configmgr-1708462544869/content/build/../c/embeddedjs.c at entry point _outlineConc at statement 0 at compile unit offset +000000003B9038A0 at entry offset +0000000000000028 at address
         000000003B9038A0.
*** Fix ***
/tmp/zwe-2971: EDC5129I No such file or directory. (errno2=0x05620062)
TypeError: realpath failure

Fix seems to be working, but...

JavaScript code - simplified

import * as xplatform from 'xplatform';
xplatform.loadFileUTF8('./asdfasdfasdfasdfasdfasd', xplatform.AUTO_DETECT);

Shell to run - the same

#!/bin/sh
echo "*** 2.15.0 ***"
/zowe/2150/bin/utils/configmgr -script ./test_xplat.js
echo "*** Fix ***"
/zowe/fix/bin/utils/configmgr -script ./test_xplat.js

Output - different

*** 2.15.0 ***
*** Fix ***
./asdfasdfasdfasdf: EDC5129I No such file or directory. (errno2=0x05620062)
TypeError: realpath failure

Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
@Martin-Zeithaml Martin-Zeithaml changed the title xplatform.loadFileUTF8 returns error for wrong file [DO NOT MERGE] xplatform.loadFileUTF8 returns error for wrong file May 20, 2024
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
@Martin-Zeithaml
Copy link
Contributor Author

Martin-Zeithaml commented May 20, 2024

  1. Removed unused variables
  2. The error is the same as in xplatformAppendFileUTF8 and xplatformStoreFileUTF8
  3. Different behavior probably caused by C behavior: "If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate." It seems, that length was "accidentally" set to zero in one case (causing no abend) and in the other case some random value resulting in abend.

Output reduced to:

*** Fix ***
TypeError: realpath failure

Copy link
Contributor

@JoeNemo JoeNemo left a comment

Choose a reason for hiding this comment

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

Approved.

@JoeNemo JoeNemo merged commit 292082a into v2.x/staging May 22, 2024
9 checks passed
@Martin-Zeithaml Martin-Zeithaml deleted the v2.x/bugfix/xplatform branch May 22, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants