Project

General

Profile

Bug #1991

CkScanf broken with charmrun

Added by Venkatasubrahmanian Narayanan 2 months ago. Updated about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
10/10/2018
Due date:
% Done:

0%


Description

CkScanf fails with an error message "fscanf() failed!" when used in a program run with charmrun. Some debugging suggests that it originates from util/charmrun-src/charmrun.C, from the method input_scanf_chars.

When the code using CkScanf is changed to use scanf or cin, the program appears to not wait for the user to give input(some tests suggest that this might actually be due to the scanf/cin call failing), but just goes ahead with execution.

Reproducible example:
particle.ci:

mainmodule particle {
mainchare main {
entry main(CkArgMsg*);
};
};

particle.C:
#include "particle.decl.h"
class main : public CBase_main {
public:
main(CkArgMsg*) {
int temp;
CkScanf("%d",&temp);
CkPrintf("%d",temp);
CkExit();
}
};
#include "particle.def.h"

History

#1 Updated by Sam White 2 months ago

Note that you don't want to use scanf directly because you'll get charmrun and its arguments in the input string. CkScanf is supposed to filter those out.

#2 Updated by Eric Bohm about 2 months ago

  • Assignee set to Evan Ramos

#3 Updated by Evan Ramos about 2 months ago

/*FIXME: I am terrified by this routine. OSL 9/8/00*/
static char *input_scanf_chars(char *fmt)
{

I agree with this comment.

Also available in: Atom PDF