unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49524: 28.0.50; make-serial-process is not portable
@ 2021-07-11 15:24 Ken Brown
  2021-07-11 16:24 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Ken Brown @ 2021-07-11 15:24 UTC (permalink / raw)
  To: 49524

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.

By the way, I came across this issue while investigating the failure of 
process-tests/fd-setsize-no-crash/make-serial-process on Cygwin.








^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-13 13:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11 15:24 bug#49524: 28.0.50; make-serial-process is not portable Ken Brown
2021-07-11 16:24 ` Eli Zaretskii
2021-07-12 13:27   ` Ken Brown
2021-07-12 21:35     ` Ken Brown
2021-07-13 11:19       ` Eli Zaretskii
2021-07-13 13:11         ` Ken Brown

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).