Bug 1448289 - variables declared in gROOT->Macro lost from scope
Summary: variables declared in gROOT->Macro lost from scope
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: root
Version: 25
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Mattias Ellert
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-05 05:52 UTC by nvwarr
Modified: 2017-06-11 16:15 UTC (History)
2 users (show)

Fixed In Version: root-6.08.06-7.fc24 root-6.08.06-7.fc25 root-6.08.06-7.el7 root-6.08.06-7.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-27 02:51:43 UTC


Attachments (Terms of Use)
Patch to fix the bug (1.30 KB, patch)
2017-05-05 05:52 UTC, nvwarr
no flags Details | Diff

Description nvwarr 2017-05-05 05:52:03 UTC
Created attachment 1276488 [details]
Patch to fix the bug

Description of problem:

When a script calls gROOT->Macro to read another script and that script defines a global variable, this variable is only accessible in the same scope of the calling script, not lower scopes (e.g. inside a loop).

Version-Release number of selected component (if applicable):

root-6.08

How reproducible:

always

Steps to Reproduce:
1. Using a script test.C which looks like:

{
   gROOT->Macro("setcolours.C");
   
     { cout << setgreen << "OK" << setblack << endl; }
}

and a macro setcolours.C which looks like:

{
   const char setgreen[] = "\033[32m";
   const char setblack[] = "\033[39;49m";
}

2. root -q test.C

Actual results:

The setgreen and setblack variables, which are defined via gROOT->Macro("setcolours.C") should be visible, but they are not. Removing the curly brackets around the cout line makes the script work, but, of course, you still can't use these variables in a loop.

This is a regression compared to root-6.06 and definitely a bug.

Expected results:

It should just write "OK" in green.

Additional info:

I have reported this upstream

https://sft.its.cern.ch/jira/browse/ROOT-8773

and Axel Naumann has confirmed and fixed the bug in the git tree. I've attached a patch based on his fix. The only change is the path of the TClingCallbacks.cxx, which was changed between root-6.08 and the current git commit.

The problem seems to be in all versions of root-6.08. Fedora 25/26, RHEL 7.3, CentOS 7 etc.

Comment 1 Fedora Update System 2017-05-14 14:24:03 UTC
root-6.08.06-5.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4880048a1c

Comment 2 Fedora Update System 2017-05-14 14:24:17 UTC
root-6.08.06-5.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4880048a1c

Comment 3 Fedora Update System 2017-05-14 14:27:01 UTC
root-6.08.06-5.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c39ad1072b

Comment 4 Fedora Update System 2017-05-14 14:27:11 UTC
root-6.08.06-5.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c39ad1072b

Comment 5 Fedora Update System 2017-05-14 14:31:23 UTC
root-6.08.06-5.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1544bb535d

Comment 6 Fedora Update System 2017-05-14 14:31:32 UTC
root-6.08.06-5.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1544bb535d

Comment 7 Fedora Update System 2017-05-14 17:01:29 UTC
root-6.08.06-5.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-13bcac36bb

Comment 8 Fedora Update System 2017-05-14 17:01:40 UTC
root-6.08.06-5.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-13bcac36bb

Comment 9 Fedora Update System 2017-05-15 06:33:31 UTC
root-6.08.06-5.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-13bcac36bb

Comment 10 Fedora Update System 2017-05-15 06:34:18 UTC
root-6.08.06-5.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-c39ad1072b

Comment 11 Fedora Update System 2017-05-15 10:19:25 UTC
root-6.08.06-5.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-4880048a1c

Comment 12 Fedora Update System 2017-05-15 11:05:18 UTC
root-6.08.06-5.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1544bb535d

Comment 13 nvwarr 2017-05-16 05:12:12 UTC
I've tested it on fedora 26 and it works. Thanks for another quick response.

Comment 14 Fedora Update System 2017-05-17 06:45:43 UTC
root-6.08.06-7.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-4880048a1c

Comment 15 Fedora Update System 2017-05-17 06:47:18 UTC
root-6.08.06-7.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c39ad1072b

Comment 16 Fedora Update System 2017-05-17 06:49:01 UTC
root-6.08.06-7.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-13bcac36bb

Comment 17 Fedora Update System 2017-05-17 06:50:11 UTC
root-6.08.06-7.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1544bb535d

Comment 18 Fedora Update System 2017-05-17 19:06:53 UTC
root-6.08.06-7.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-4880048a1c

Comment 19 Fedora Update System 2017-05-17 21:30:18 UTC
root-6.08.06-7.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1544bb535d

Comment 20 Fedora Update System 2017-05-17 23:06:47 UTC
root-6.08.06-7.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-13bcac36bb

Comment 21 Fedora Update System 2017-05-17 23:11:18 UTC
root-6.08.06-7.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-c39ad1072b

Comment 22 Fedora Update System 2017-05-27 02:51:43 UTC
root-6.08.06-7.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2017-05-27 03:00:22 UTC
root-6.08.06-7.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 24 Fedora Update System 2017-06-01 15:54:30 UTC
root-6.08.06-7.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 25 Fedora Update System 2017-06-11 16:15:55 UTC
root-6.08.06-7.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.