In some distribution the \n character is substituted with \r character in the input stream beacause the INLCR and ICRNL are not disabled in thetoptions.c_iflag in theint serialport_init(const char* serialport, int baud) function.
The correction is to change the line 74 in arduino-serial-lib.c:
toptions.c_iflag &= ~(IXON | IXOFF | IXANY); // turn off s/w flow ctrl
whith this line
toptions.c_iflag &= ~(IXON | IXOFF | IXANY | INLCR | ICRNL); // turn off s/w flow ctrl