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

save sequence with patterns crashes #492

Closed
ldeniau opened this issue Oct 25, 2017 · 2 comments · Fixed by #493
Closed

save sequence with patterns crashes #492

ldeniau opened this issue Oct 25, 2017 · 2 comments · Fixed by #493

Comments

@ldeniau
Copy link
Contributor

ldeniau commented Oct 25, 2017

Reported by Androula:

Saving a sequence with SELECTed pattern leads to a segfault in pass_select_el
I found the missing guard in the new function pass_select_el

    if (el != NULL) {
      if(myregex(pattern, strip(el->name)) == 0) in = 1;
    }

But in fact this function should never work on NULL element... Some check and redirection is missing in pass_select when the element is not found.

BUT once the guard was added, I discovered that SELECT flag=save is not anymore saving variables! The changes from Thomas are significant so it is difficult to follow the intent of all the changes. Another concern is the selection of columns and rows in tables, and the mechanism of FILL and SETVARSs that use variables.

Laurent.

@ldeniau
Copy link
Contributor Author

ldeniau commented Oct 25, 2017

added files from Androula.
androula.zip

@ldeniau
Copy link
Contributor Author

ldeniau commented Oct 25, 2017

here is what we should save in file newsps_thinstr.str with patterns (from 5.03.06)

kqd = -0.01395887281;
kqda := kqd*9.0/11.0;
kqf1 = 0.01395627532;
kqf1a := kqf1*9.0/11.0;
kqf2 := kqf1;
kqf2a := kqf2*9.0/11.0;
kqe11402 = 0;
kqms = 0;
kqe30202 = 0;
kqecd30602 = 0;
kqecd31402 = 0;
kqe50202 = 0;
kqe51402 = 0;
kqecd53402 = 0;
kqe60302 = 0;
kqe60402 = 0;
kqe60502 = 0;
kqe60602 = 0;
kmkqh11653 = 0;
kmkqv11679 = 0;
mkqh: hkicker,l:= 0,lrad:= 0;
mkqh.11653: mkqh,lrad:= 0,kick:=kmkqh11653 ,slot_id:= 2362089;
mkqv: vkicker,l:= 0,lrad:= 0;
mkqv.11679: mkqv,lrad:= 0,kick:=kmkqv11679 ,slot_id:= 2362096;

and here is what is actually saved (from 5.03.07)

mkqh: hkicker,l:= 0,lrad:= 0;
mkqh.11653: mkqh,lrad:= 0,kick:=kmkqh11653 ,slot_id:= 2362089;
mkqv: vkicker,l:= 0,lrad:= 0;
mkqv.11679: mkqv,lrad:= 0,kick:=kmkqv11679 ,slot_id:= 2362096;

So all the variables that fulfil the pattern are not saved.

coldfix added a commit to coldfix/MAD-X that referenced this issue Oct 26, 2017
e.g. variable name or sequence name

Resolves MethodicalAcceleratorDesign#492 and restores the pass_select behaviour before
674555f.
@coldfix coldfix mentioned this issue Oct 26, 2017
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 a pull request may close this issue.

1 participant