mdsplus icon indicating copy to clipboard operation
mdsplus copied to clipboard

Mdstcl segfaults for a tree that doesn't carry a shot number

Open sflanagan opened this issue 1 year ago • 2 comments

Affiliation GA / DIII-D

Version(s) Affected Observed in: alpha 7.139.59 +

Platform RHEL

Describe the bug A mdstcl show current segfaults when there is no shotid for the specified tree, e.g.

[flanagan]$ mdstcl show version
MDSplus version: 7.139.59
----------------------
  Release:  HEAD_release_7.139.59
  Browse:   https://github.com/MDSplus/mdsplus/tree/HEAD_release_7.139.59
  Download: https://github.com/MDSplus/mdsplus/archive/HEAD_release_7.139.59.tar.gz

[flanagan]$ mdstcl show current bogus_tree
Segmentation fault (core dumped)

Expected behavior I found an older server that produces a "Failed to get shotid." message (which I presume is still the intended response?).

[flanagan]$ mdstcl show version
MDSplus version: 7.96.9
----------------------
  Release:  stable_release-7-96-9
  Browse:   https://github.com/MDSplus/mdsplus/tree/stable_release-7-96-9
  Download: https://github.com/MDSplus/mdsplus/archive/stable_release-7-96-9.tar.gz
  Build date: Tue Feb 11 17:40:00 UTC 2020

[flanagan]$ mdstcl show current bogus_tree
Failed to get shotid.

Note I only discovered this via "fat-fingering" the name of a tree that does carry a shot number. I don't expect d3d users to encounter this bug, so it's good to get fixed but of low priority.

sflanagan avatar Apr 26 '24 23:04 sflanagan

Hi @sflanagan -- I'll investigate this issue later today.

mwinkel-dev avatar Apr 26 '24 23:04 mwinkel-dev

Hi @sflanagan,

Experiments revealed two results . . .

  • The segfault only occurs when the tree path is undefined.
  • However, when the tree path is defined and points to a directory that doesn't have the shotid.sys file, then it does produce the Failed to get shotid message.

The issue is probably in the TreeGetCurrentShotId() function. I will fix it in the coming days.

The behavior might also depend on the access method: local, thin-client, thick-client, or distributed.

mwinkel-dev avatar Apr 27 '24 02:04 mwinkel-dev