You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Platform
Found in Ubuntu 20, but surely affects all platforms
Describe the bug
In the IDL API, the mdsdisconnect routine can return an optional status value. It is not properly comparing the results from the underlying C code in mdsipshr, thus always returns zero (failure).
To Reproduce
Steps to reproduce the behavior:
At the IDL prompt, run the following procedure. Note that mystatus is always zero.
; Demonstrates that mdsdisconnect does not correctly return the optional status value
pro bug_2640
mdsip_server = 'some_server'
; socket 0
mdsconnect, mdsip_server
print, !MDS_SOCKET
; Successfully kills socket, but erroneously reports status = 0 (failure)
mystatus = -77
mdsdisconnect, socket=0, status=mystatus
print, !MDS_SOCKET, mystatus
; Socket already killed, so correctly reports status = 0
mystatus = -77
mdsdisconnect, socket=0, status=mystatus
print, !MDS_SOCKET, mystatus
end
Output of the program (with a debug print statement in mdsdisconnect.pro) follows.
IDL> bug_2640
% Compiled module: BUG_2640.
% Compiled module: MDSCONNECT.
% Compiled module: MDS_KEYWORD_SET.
% Compiled module: MDSDISCONNECT.
0
XMW mdsdisconnect - status after call_external = 65545
0 0
XMW mdsdisconnect - status after call_external = 65554
0 0
IDL>
Then examine mdsshr_messages.h and note the following:
decimal 65545 = hex 0x10009 = MDSplusSUCCESS
decimal 65554 = hex 0x110012 = MDSplusERROR
The problem is caused by these two lines of mdsdisconnect.pro and the incorrect comparison. (At the top of the routine, status is initialized to 1, which is likely intended to denote success. And thus 0 denotes failure.)
status = call_external(image,'DisconnectFromMds',sock,value=[1b], /AUTO_GLUE)
if (status eq 0) then status = 1 else status = 0
Expected behavior
When running the above program, the first mdsdisconnect should return the success status (i.e., one), and the second mdsdisconnect should return the failure status (i.e., zero).
Screenshots
n/a
Additional context
This is apparently a low risk bug. If customers used the status feature of mdsdisconnect, this bug would have been filed years ago.
Also Investigate
All call_external calls in the IDL API should be investigated for similar issues regarding the status code returned by the underlying C libraries. A cursory scan of the IDL API revealed these likely trouble spots:
mds$disconnect in mdsconnect.pro
mdslogin.pro
mdsvalue.pro
The text was updated successfully, but these errors were encountered:
Affiliation
MIT PSFC
Version(s) Affected
all
Platform
Found in Ubuntu 20, but surely affects all platforms
Describe the bug
In the IDL API, the
mdsdisconnect
routine can return an optional status value. It is not properly comparing the results from the underlying C code inmdsipshr
, thus always returns zero (failure).To Reproduce
Steps to reproduce the behavior:
At the IDL prompt, run the following procedure. Note that
mystatus
is always zero.Output of the program (with a debug print statement in
mdsdisconnect.pro
) follows.Then examine
mdsshr_messages.h
and note the following:The problem is caused by these two lines of
mdsdisconnect.pro
and the incorrect comparison. (At the top of the routine, status is initialized to 1, which is likely intended to denote success. And thus 0 denotes failure.)Expected behavior
When running the above program, the first
mdsdisconnect
should return the success status (i.e., one), and the secondmdsdisconnect
should return the failure status (i.e., zero).Screenshots
n/a
Additional context
This is apparently a low risk bug. If customers used the status feature of
mdsdisconnect
, this bug would have been filed years ago.Also Investigate
All
call_external
calls in the IDL API should be investigated for similar issues regarding the status code returned by the underlying C libraries. A cursory scan of the IDL API revealed these likely trouble spots:mds$disconnect
inmdsconnect.pro
mdslogin.pro
mdsvalue.pro
The text was updated successfully, but these errors were encountered: