On Sun, Jan 3, 2021 at 4:30 PM John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> wrote: > > On 1/3/21 10:25 PM, John Paul Adrian Glaubitz wrote: > > The stuff is open source, if anyone is interested in getting this fixed, > > please > > start reading the code and help me. > > FWIW, the source code is here: > > > https://salsa.debian.org/installer-team/partman-base/-/blob/master/parted_server.c > > If anyone has any clever idea, please let me know.
Looking at iscan_line ... The function assumes a Linux end-of-line: void iscan_line(char **str, int expect_leading_newline) { int c; *str = NULL; c = fgetc(infifo); if (c == EOF) return; if (c == '\n' && expect_leading_newline) { c = fgetc(infifo); if (c == EOF) return; } while (c != EOF && c != '\n') { if (isspace((unsigned char) c)) c = fgetc(infifo); else { ungetc(c, infifo); break; } } if (c == EOF || c == '\n') *str = calloc(1, 1); else iscanf("%m[^\n]", str); } The first thing I would do is, make it robust in case an Apple tool has modified a file. Maybe something like: /* Existing */ if (c == EOF) return; /* New */ else if (c == '\r') { /* silently swallow CR */ c = fgetc(infifo); if (c != '\n') { /* CR only. Make it look like a LF */ fungetc(c, infifo); c = '\n'; } } /* Existing */ if (c == '\n' && expect_leading_newline) { c = fgetc(infifo); if (c == EOF) return; } It looks like the while loop may need a touch-up, too. Jeff