GNU bug report logs - #49524
28.0.50; make-serial-process is not portable

Previous Next

Package: emacs;

Reported by: Ken Brown <kbrown <at> cornell.edu>

Date: Sun, 11 Jul 2021 15:31:01 UTC

Severity: normal

Found in version 28.0.50

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ken Brown <kbrown <at> cornell.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#49524: closed (28.0.50; make-serial-process is not portable)
Date: Tue, 13 Jul 2021 13:13:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 13 Jul 2021 09:11:12 -0400
with message-id <25a83b24-fa7a-f0f7-a105-2596e48ca9a7 <at> cornell.edu>
and subject line Re: bug#49524: 28.0.50; make-serial-process is not portable
has caused the debbugs.gnu.org bug report #49524,
regarding 28.0.50; make-serial-process is not portable
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
49524: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=49524
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ken Brown <kbrown <at> cornell.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; make-serial-process is not portable
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.

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





[Message part 3 (message/rfc822, inline)]
From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49524-done <at> debbugs.gnu.org
Subject: Re: bug#49524: 28.0.50; make-serial-process is not portable
Date: Tue, 13 Jul 2021 09:11:12 -0400
On 7/13/2021 7:19 AM, Eli Zaretskii wrote:
>> From: Ken Brown <kbrown <at> cornell.edu>
>> Cc: 49524 <at> debbugs.gnu.org
>> Date: Mon, 12 Jul 2021 17:35:40 -0400
>>
>> So I should probably remove the reference to non-glibc platforms in my commit
>> message.
> 
> Yes, something to the effect of compliance with advertised APIs would
> probably be better.

Done.  Closing.


This bug report was last modified 3 years and 316 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.