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

Fix ExecPty parsing on some Alpine linux (fixes #1091) #1093

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static int doGetInt(String name, String cfg) throws IOException {
return Integer.parseInt(matcher.group(1));
}
}
throw new IOException("Unable to parse " + name);
return 0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ public class ExecPtyTest {
+ "-echoctl -echoprt -echoke -flusho -pendin\n"
+ "opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop";

private final String alpineSample = "speed 38400 baud;stty: standard input\n" + " line = 0;\n"
+ "intr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;\n"
+ "eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;\n"
+ "werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;\n"
+ "-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts\n"
+ "-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff\n"
+ "-iuclc -ixany -imaxbel -iutf8\n"
+ "opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\n"
+ "isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt\n"
+ "echoctl echoke -flusho -extproc";

@Test
public void testParseSize() throws IOException {
assertEquals(new Size(244, 85), ExecPty.doGetSize(linuxSttySample));
Expand All @@ -121,6 +132,7 @@ public void testParseSize() throws IOException {
assertEquals(new Size(244, 85), ExecPty.doGetSize(netBsdSttySample));
assertEquals(new Size(244, 85), ExecPty.doGetSize(freeBsdSttySample));
assertEquals(new Size(244, 85), ExecPty.doGetSize(hpuxSttySample));
assertEquals(new Size(0, 0), ExecPty.doGetSize(alpineSample));
}

@Test
Expand Down