GNU bug report logs - #55153
29.0.50; Implement system_process_attributes on Cygwin

Previous Next

Package: emacs;

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

Date: Wed, 27 Apr 2022 15:06:02 UTC

Severity: normal

Found in version 29.0.50

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55153 in the body.
You can then email your comments to 55153 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55153; Package emacs. (Wed, 27 Apr 2022 15:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ken Brown <kbrown <at> cornell.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 27 Apr 2022 15:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Implement system_process_attributes on Cygwin
Date: Wed, 27 Apr 2022 11:00:05 -0400
I just noticed, as a result of the failure of 
desktop-tests--emacs-pid-running-p, that system_process_attributes was never 
implemented on Cygwin.  This turns out to be quite easy to do since most of the 
GNU/Linux code works without change on Cygwin.  I'll submit a patch in a 
follow-up email.

Ken




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55153; Package emacs. (Wed, 27 Apr 2022 15:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 55153 <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: 55153 <at> debbugs.gnu.org
Subject: Re: bug#55153: 29.0.50; Implement system_process_attributes on Cygwin
Date: Wed, 27 Apr 2022 11:16:46 -0400
[Message part 1 (text/plain, inline)]
On 4/27/2022 11:00 AM, Ken Brown wrote:
> I just noticed, as a result of the failure of 
> desktop-tests--emacs-pid-running-p, that system_process_attributes was never 
> implemented on Cygwin.  This turns out to be quite easy to do since most of the 
> GNU/Linux code works without change on Cygwin.  I'll submit a patch in a 
> follow-up email.

Patch attached.  It's written against the master branch, but it can easily be 
backported to the release branch.  It seems safe enough to me, but I don't have 
strong feelings about it.

Ken
[0001-Implement-system_process_attributes-on-Cygwin.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55153; Package emacs. (Wed, 27 Apr 2022 15:54:01 GMT) Full text and rfc822 format available.

Message #11 received at 55153 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ken Brown <kbrown <at> cornell.edu>
Cc: 55153 <at> debbugs.gnu.org
Subject: Re: bug#55153: 29.0.50; Implement system_process_attributes on Cygwin
Date: Wed, 27 Apr 2022 18:52:58 +0300
> Date: Wed, 27 Apr 2022 11:16:46 -0400
> From: Ken Brown <kbrown <at> cornell.edu>
> 
> +# ifdef CYGWIN
> +  /* ttname */
> +  strcpy (procfn_end, "/ctty");
> +  fd = emacs_open (fn, O_RDONLY, 0);
> +  if (fd < 0)
> +    nread = 0;
> +  else
> +    {
> +      record_unwind_protect_int (close_file_unwind, fd);
> +      nread = emacs_read_quit (fd, procbuf, sizeof procbuf);
> +    }
> +  /* /proc/<pid>/ctty should always end in newline. */
> +  if (0 < nread && procbuf[nread - 1] == '\n')
> +    procbuf[nread - 1] = '\0';
> +  else
> +    procbuf[0] = '\0';
> +  attrs = Fcons (Fcons (Qttname, build_string (procbuf)), attrs);

Is what you read from /proc/<pid>/ctty guaranteed to be pure-ASCII
string?  If not, build_string is not the best idea here; you need to
produce a unibyte string and decode it.

Thanks.

P.S. Doesn't this warrant a NEWS entry?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55153; Package emacs. (Wed, 27 Apr 2022 16:46:02 GMT) Full text and rfc822 format available.

Message #14 received at 55153 <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55153 <at> debbugs.gnu.org
Subject: Re: bug#55153: 29.0.50; Implement system_process_attributes on Cygwin
Date: Wed, 27 Apr 2022 12:45:45 -0400
[Message part 1 (text/plain, inline)]
On 4/27/2022 11:53 AM, Eli Zaretskii wrote:
>> Date: Wed, 27 Apr 2022 11:16:46 -0400
>> From: Ken Brown <kbrown <at> cornell.edu>
>>
>> +# ifdef CYGWIN
>> +  /* ttname */
>> +  strcpy (procfn_end, "/ctty");
>> +  fd = emacs_open (fn, O_RDONLY, 0);
>> +  if (fd < 0)
>> +    nread = 0;
>> +  else
>> +    {
>> +      record_unwind_protect_int (close_file_unwind, fd);
>> +      nread = emacs_read_quit (fd, procbuf, sizeof procbuf);
>> +    }
>> +  /* /proc/<pid>/ctty should always end in newline. */
>> +  if (0 < nread && procbuf[nread - 1] == '\n')
>> +    procbuf[nread - 1] = '\0';
>> +  else
>> +    procbuf[0] = '\0';
>> +  attrs = Fcons (Fcons (Qttname, build_string (procbuf)), attrs);
> 
> Is what you read from /proc/<pid>/ctty guaranteed to be pure-ASCII
> string?

Yes.  It's typically something like "/dev/pty0".

> P.S. Doesn't this warrant a NEWS entry?

Revised patch attached, with a NEWS entry.

Ken
[0001-Implement-system_process_attributes-on-Cygwin.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55153; Package emacs. (Wed, 27 Apr 2022 17:13:02 GMT) Full text and rfc822 format available.

Message #17 received at 55153 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ken Brown <kbrown <at> cornell.edu>
Cc: 55153 <at> debbugs.gnu.org
Subject: Re: bug#55153: 29.0.50; Implement system_process_attributes on Cygwin
Date: Wed, 27 Apr 2022 20:12:27 +0300
> Date: Wed, 27 Apr 2022 12:45:45 -0400
> Cc: 55153 <at> debbugs.gnu.org
> From: Ken Brown <kbrown <at> cornell.edu>
> 
> > Is what you read from /proc/<pid>/ctty guaranteed to be pure-ASCII
> > string?
> 
> Yes.  It's typically something like "/dev/pty0".
> 
> > P.S. Doesn't this warrant a NEWS entry?
> 
> Revised patch attached, with a NEWS entry.

Thanks, LGTM.




Reply sent to Ken Brown <kbrown <at> cornell.edu>:
You have taken responsibility. (Wed, 27 Apr 2022 17:26:02 GMT) Full text and rfc822 format available.

Notification sent to Ken Brown <kbrown <at> cornell.edu>:
bug acknowledged by developer. (Wed, 27 Apr 2022 17:26:02 GMT) Full text and rfc822 format available.

Message #22 received at 55153-done <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 55153-done <at> debbugs.gnu.org
Subject: Re: bug#55153: 29.0.50; Implement system_process_attributes on Cygwin
Date: Wed, 27 Apr 2022 13:25:38 -0400
On 4/27/2022 1:12 PM, Eli Zaretskii wrote:
> Thanks, LGTM.

Pushed to master.  Closing.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 May 2022 11:24:11 GMT) Full text and rfc822 format available.

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

Previous Next


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