MDSplus / mdsplus

The MDSplus data management system
https://mdsplus.org/
Other
70 stars 43 forks source link

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

Open sflanagan opened 3 months ago

sflanagan commented 3 months ago

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.

mwinkel-dev commented 3 months ago

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

mwinkel-dev commented 3 months ago

Hi @sflanagan,

Experiments revealed two results . . .

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.