What is broken pipe in xboard ?

Discussion of chess software programming and technical issues.

Moderator: Ras

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: What is broken pipe in xboard ?

Post by bob »

Chan Rasjid wrote:Hello,

I have just compiled TSCP for Fedora7 and can now play engine-engine match in a crude way, just edit command to :-
xboard -fcp /usr/bin/gnuchess
-scp /home/rasjid/tscp/tscp -tc 1:0 -mps 60
and everthings fine.

My own SnailChess can run without bugs in winboard Windows XP but fails as the second program in xboard fedora7. There is a message "fail to write to second program, broken pipe ...second program exited unexpectedly"

Can someone tell what is the likely problem.

Best Regards,
Rasjid
The program is terminating right after xboard starts it. That leaves one end of the pipes xboard creates without a process connected, which is what causes the broken pipe error message. If either end (xboard or the chess engine) terminates unexpectedly, the program on the other end of that pipe gets a "broken pipe" error.
Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Re: What is broken pipe in xboard ?

Post by Chan Rasjid »

Hello,

Thanks! Linux + xboard solved!
signal(SIGINT, SIG_IGN) does it.

The gcc documentation recommended use of GNU specific getline(... ) so I used it instead of the _less_safe fgets() as below and it works :-

Code: Select all

void winboardInterface(board_t *board, searchstack_t *ss, searchinfo_t *searchinfo, incheck_t *incheck) {
char *line[1], command[256];
size_t szLine = 0;
line[1] = NULL;

while (1) {
 fflush(stdout);
 if (side == computerSide) {
  int r = callSearch(board, ss, searchinfo, incheck,   side, followPV);
  if (r != RESULT_NULL) {
   gameResult(r, side, *ss->pv);
   computerSide = NullSide;
   continue;
  }
   side ^= 1;
   continue;
}


        ftime(&searchinfo->timeb_start);

/*ssize_t getline (char **LINEPTR, size_t *N, FILE *STREAM)*/
  if (getline(line, &szLine, stdin) == - 1){
    return;/* error*/
  }
				
  if (line[0][0] == '\n'){
   continue;
  }
				
  sscanf(line[0],"%s",command);

  if (!strcmp(command, "xboard")) {
    printf("\n");
    continue;
   }

...etc
}

Best Regards,
Rasjid