Bug#665757: FTBFS on kfreebsd (IUTF8 termio is not POSIX) patch attached

March 25th, 2012 - 02:10 pm ET by Christoph Egger | Report spam
This is a multi-part MIME message sent by reportbug.


MIME-Version: 1.0

Package: mosh
Version: 1.1-1
Severity: important
Tags: patch
User: debian-bsd@lists.debian.org
Usertags: kfreebsd

the IUTF8 termio constant isn't POSIX and isn't used on freebsd. We
still have UTF-8 enabled terminals though. Find below a patch I used
to make it build&work on Debian GNU/kFreeBSD

Regards

Christoph

Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 9.0-1-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mosh depends on:
ii libc0.1 2.13-27
ii libgcc1 1:4.7.0-1
ii libio-pty-perl 1:1.08-1+b2
ii libncurses5 5.9-4
ii libprotobuf7 2.4.1-1
ii libstdc++6 4.7.0-1
ii libtinfo5 5.9-4
ii libutempter0 1.1.5-4
ii openssh-client 1:5.9p1-4
ii zlib1g 1:1.2.6.dfsg-2

mosh recommends no packages.

mosh suggests no packages.


MIME-Version: 1.0

Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
mosh (1.1-1) unstable; urgency=low
.
* Version 1.1 released
Author: Keith Winstein <keithw@mit.edu>


The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

mosh-1.1.orig/src/examples/parse.cc
+++ mosh-1.1/src/examples/parse.cc
@@ -72,10 +72,12 @@ int main( int argc __attribute__((unused

child_termios = saved_termios;

+#ifdef __linux__
if ( !(child_termios.c_iflag & IUTF8) ) {
fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag." );
child_termios.c_iflag |= IUTF8;
}
+#endif

pid_t child = forkpty( &master, NULL, &child_termios, NULL );

mosh-1.1.orig/src/examples/termemu.cc
+++ mosh-1.1/src/examples/termemu.cc
@@ -81,10 +81,12 @@ int main( void )

child_termios = saved_termios;

+#ifdef __linux__
if ( !(child_termios.c_iflag & IUTF8) ) {
fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag." );
child_termios.c_iflag |= IUTF8;
}
+#endif

pid_t child = forkpty( &master, NULL, &child_termios, NULL );

mosh-1.1.orig/src/frontend/mosh-server.cc
+++ mosh-1.1/src/frontend/mosh-server.cc
@@ -273,11 +273,13 @@ int run_server( const char *desired_ip,

int master;

+#ifdef __linux__
if ( !(child_termios.c_iflag & IUTF8) ) {
/* SSH should also convey IUTF8 across connection. */
// fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag." );
child_termios.c_iflag |= IUTF8;
}
+#endif

/* Fork child process */
pid_t child = forkpty( &master, NULL, &child_termios, &window_size );
mosh-1.1.orig/src/frontend/stmclient.cc
+++ mosh-1.1/src/frontend/stmclient.cc
@@ -66,11 +66,13 @@ void STMClient::init( void )

/* Put terminal driver in raw mode */
raw_termios = saved_termios;
+#ifdef __linux__
if ( !(raw_termios.c_iflag & IUTF8) ) {
/* SSH should also convey IUTF8 across connection. */
// fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag." );
raw_termios.c_iflag |= IUTF8;
}
+#endif

cfmakeraw( &raw_termios );





To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
email Follow the discussionReplies 2 repliesReplies Make a reply

Replies

#1 Keith Winstein
March 26th, 2012 - 07:10 pm ET | Report spam
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

1257051904-454157253-1332802568=:11597

Hello,

Thanks for filing this. I can't take this patch as written, but I am very
interested in getting mosh working on FreeBSD.

(1) We need and use IUTF8 on Mac OS X (XNU), so #ifdef __linux__ is not
quite the right test.

(2) On platforms without IUTF8, we still need _some_ solution to the
"deletion of multibyte characters" problem.

If you can tell me what mechanism FreeBSD uses to avoid this problem so
that backspace works correctly in non-canonical mode with non-US-ASCII
characters, I'm happy to make mosh enable it.

Here's how to demonstrate the problem:

(1) Open a UTF-8 terminal emulator.

(2) Run "cat > /tmp/test.txt"

(3) Type (or paste): "The problem¢s not obvious.", including the curly
Unicode apostrophe (U+2019) after "problem". Do not type a carriage return
at the end of the line.

(4) Hit the backspace key 15 times to back up to "The problem".

(5) Type " is not obvious." and hit carriage return and then ^D.

(5a) You should see "The problem is not obvious." on the screen.

(6) Run "cat /tmp/test.txt"

(7) With IUTF8, the apostrophe will have been correctly deleted, and you
should see "The problem is not obvious." (just as you saw when typing it)

(8) Without IUTF8, the kernel will not have correctly deleted the
(three-byte) apostrophe, and you should see "The problem<?> is not
obvious." (with the Unicode replacement character in place of <?>)

(8a) If you run "od -c /tmp/test.txt", you'll see it has garbage after the
word "problem".



On the other hand, if FreeBSD really just has this bug and there is no way
to fix it yet, I guess we can disable the use of IUTF8 on FreeBSD if
that's what it takes to get mosh running... :-/ Perhaps the right approach
is an autoconf test to see whether the platform has IUTF8.

Best regards, and thanks for using/testing mosh,
Keith

On Sun, 25 Mar 2012, Christoph Egger wrote:

Package: mosh
Version: 1.1-1
Severity: important
Tags: patch
User:
Usertags: kfreebsd

the IUTF8 termio constant isn't POSIX and isn't used on freebsd. We
still have UTF-8 enabled terminals though. Find below a patch I used
to make it build&work on Debian GNU/kFreeBSD

Regards

Christoph

Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 9.0-1-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mosh depends on:
ii libc0.1 2.13-27
ii libgcc1 1:4.7.0-1
ii libio-pty-perl 1:1.08-1+b2
ii libncurses5 5.9-4
ii libprotobuf7 2.4.1-1
ii libstdc++6 4.7.0-1
ii libtinfo5 5.9-4
ii libutempter0 1.1.5-4
ii openssh-client 1:5.9p1-4
ii zlib1g 1:1.2.6.dfsg-2

mosh recommends no packages.

mosh suggests no packages.




1257051904-454157253-1332802568=:11597--



To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact

Similar topics