[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#49524: 28.0.50; make-serial-process is not portable
From: |
Eli Zaretskii |
Subject: |
bug#49524: 28.0.50; make-serial-process is not portable |
Date: |
Sun, 11 Jul 2021 19:24:50 +0300 |
> From: Ken Brown <kbrown@cornell.edu>
> Date: Sun, 11 Jul 2021 11:24:58 -0400
>
> Fmake_serial_process calls Fserial_process_configure, which calls
> serial_configure, which calls cfsetspeed with the speed argument equal to the
> numerical baud rate (e.g., 9600). But the documentation of cfsetspeed says
> that
> the speed argument must be one of the Bnnn constants defined in termios.h
> (e.g.,
> B9600). See, for example,
>
> https://man7.org/linux/man-pages/man3/termios.3.html
>
> This incorrect call of cfsetspeed happens to succeed on GNU/Linux because
> glibc's cfsetspeed allows the argument to be the numerical baud rate, which
> it
> converts to the appropriate Bnnn constant. But I don't think emacs should be
> relying on this undocumented behavior. In particular, this doesn't work on
> Cygwin. And it wouldn't even work on GNU/Linux if emacs used the cfsetspeed
> replacement defined in sysdep.c instead of glibc's cfsetspeed.
>
> I think the way to fix this is to imitate the glibc code that converts the
> baud
> rate to a Bnnn constant, but maybe someone has a better idea.
Converting in sysdep.c:serial_configure sounds TRT to me.