all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs-24.2.93 build problems
@ 2013-03-02 23:00 Nelson H. F. Beebe
  2013-03-03  0:09 ` Paul Eggert
  0 siblings, 1 reply; 10+ messages in thread
From: Nelson H. F. Beebe @ 2013-03-02 23:00 UTC (permalink / raw)
  To: emacs-devel; +Cc: beebe

I have spent much of today in build attempts for emacs-24.2.93 on
about 25 flavors of Unix in our lab.  After a lot of restarts, I have
mostly succeeded, except for two platforms: OpenBSD 4.9 on x86, and
MirOS 10 on x86.  On those two systems, compilation of src/sysdep.c
fails like this:

    sysdep.c: In function 'list_system_processes':
    sysdep.c:2656: error: 'KERN_PROC' undeclared (first use in this function)
    sysdep.c:2656: error: (Each undeclared identifier is reported only once
    sysdep.c:2656: error: for each function it appears in.)
    sysdep.c:2684: error: 'struct kinfo_proc' has no member named 'p_pid'

Both systems previously had emacs-24.1 installed.  A similar build of
emacs-24.2.93 on OpenBSD 5.1 was successful.

Examination of the source code reveals the problem: function
list_system_processes() is delving into kernel data structures defined
in <kvm.h> which in turn includes <sys/sysctl.h>, and that header file
defines kernel data structures that list_system_processes() attempts
to reference. 

In OpenBSD 5.1, p_pid is in struct kinfo_proc, but on the other two
systems, p_pid is instead in struct kinfo_proc2.  There is no support
code in list_system_processes() for that alternative, and no test for
it in configure either.

By contrast, the emacs-24.1 version of list_system_processes() has no
reference to the kinfo_proc* structs.

On request, I can provide off-list pointers to copies of sysctl.h for
the two failing systems.

Although some might argue that because OpenBSD 5.x is available,
OpenBSD 4.x is no longer of interest, I do not hold that view.  Emacs
has been around now for almost 40 years, and for the last 30 or so,
its portability has been held in high regard.  As a result, it is
available on, or has been ported to, all common desktop and mobile
platforms, even non-Unix ones.  I prefer to see that portability
continue.  Emacs is what makes computers usable in much the same way,
no matter what the underlying O/S platform is.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe@math.utah.edu  -
- 155 S 1400 E RM 233                       beebe@acm.org  beebe@computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------



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

* Re: emacs-24.2.93 build problems
  2013-03-02 23:00 Nelson H. F. Beebe
@ 2013-03-03  0:09 ` Paul Eggert
  2013-03-04 20:34   ` Glenn Morris
  2013-03-04 23:51   ` Glenn Morris
  0 siblings, 2 replies; 10+ messages in thread
From: Paul Eggert @ 2013-03-03  0:09 UTC (permalink / raw)
  To: Nelson H. F. Beebe; +Cc: emacs-devel

On 03/02/2013 03:00 PM, Nelson H. F. Beebe wrote:
>     sysdep.c:2656: error: 'KERN_PROC' undeclared (first use in this function)

Thanks for the heads-up.  Yes, we should fix the problem.
Does the following little patch fix the bug?  (I don't have
any OpenBSD hosts to play with, unfortunately.)

=== modified file 'src/sysdep.c'
--- src/sysdep.c	2013-01-11 07:47:57 +0000
+++ src/sysdep.c	2013-03-03 00:04:08 +0000
@@ -2649,6 +2649,13 @@ list_system_processes (void)
 
 #elif defined BSD_SYSTEM
 
+/* OpenBSD 4.9 and earlier do not have KERN_PROC.  Approximate it with
+   KERN_PROC2.  */
+# ifndef KERN_PROC
+#  define KERN_PROC KERN_PROC2
+#  define kinfo_proc kinfo_proc2
+# endif
+
 Lisp_Object
 list_system_processes (void)
 {





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

* Re: emacs-24.2.93 build problems
  2013-03-03  0:09 ` Paul Eggert
@ 2013-03-04 20:34   ` Glenn Morris
  2013-03-04 23:44     ` Jérémie Courrèges-Anglas
  2013-03-04 23:51   ` Glenn Morris
  1 sibling, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2013-03-04 20:34 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel


If we don't get a response soon, it seems to me that we can just restore
the 24.2 behaviour for this platform with the following. Is that correct?
(Assuming of course that there is no other build problem that we have
not heard about yet.)


*** src/sysdep.c	2013-01-11 07:47:57 +0000
--- src/sysdep.c	2013-03-04 20:31:27 +0000
***************
*** 2647,2653 ****
    return proclist;
  }
  
! #elif defined BSD_SYSTEM
  
  Lisp_Object
  list_system_processes (void)
--- 2647,2653 ----
    return proclist;
  }
  
! #elif defined (BSD_SYSTEM) && defined (KERN_PROC)
  
  Lisp_Object
  list_system_processes (void)




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

* Re: emacs-24.2.93 build problems
  2013-03-04 20:34   ` Glenn Morris
@ 2013-03-04 23:44     ` Jérémie Courrèges-Anglas
  2013-03-05  3:47       ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Jérémie Courrèges-Anglas @ 2013-03-04 23:44 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Paul Eggert, emacs-devel

Glenn Morris <rgm@gnu.org> writes:

> If we don't get a response soon, it seems to me that we can just restore
> the 24.2 behaviour for this platform with the following. Is that correct?
> (Assuming of course that there is no other build problem that we have
> not heard about yet.)

I have no idea whether it is correct, but M-: (list-system-processes)
returns nil here on OpenBSD-current (5.3).  So you might as well disable
all support for this function on OpenBSD, unless someone starts whining...

I'll try to take a look at it and at the compat bits, even though I find
it funny to try support all ABIs of all versions of all OSes ever made
on earth.

-- 
Jérémie Courrèges-Anglas (OpenBSD Emacs port maintainer)
GPG Key fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494



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

* Re: emacs-24.2.93 build problems
  2013-03-03  0:09 ` Paul Eggert
  2013-03-04 20:34   ` Glenn Morris
@ 2013-03-04 23:51   ` Glenn Morris
  2013-03-05  2:06     ` Paul Eggert
  1 sibling, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2013-03-04 23:51 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel


I tested this on a virtual OpenBSD 4.9, and it fixes the problem for me.
Please install (otherwise I will in a few hours).

list-system-processes still returns nil, so it does't do anything
useful, but it doesn't crash or do anything obviously bad.

Paul Eggert wrote:

> === modified file 'src/sysdep.c'
> --- src/sysdep.c	2013-01-11 07:47:57 +0000
> +++ src/sysdep.c	2013-03-03 00:04:08 +0000
> @@ -2649,6 +2649,13 @@ list_system_processes (void)
>  
>  #elif defined BSD_SYSTEM
>  
> +/* OpenBSD 4.9 and earlier do not have KERN_PROC.  Approximate it with
> +   KERN_PROC2.  */
> +# ifndef KERN_PROC
> +#  define KERN_PROC KERN_PROC2
> +#  define kinfo_proc kinfo_proc2
> +# endif
> +
>  Lisp_Object
>  list_system_processes (void)
>  {



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

* Re: emacs-24.2.93 build problems
  2013-03-04 23:51   ` Glenn Morris
@ 2013-03-05  2:06     ` Paul Eggert
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Eggert @ 2013-03-05  2:06 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Nelson H. F. Beebe, emacs-devel

On 03/04/2013 03:51 PM, Glenn Morris wrote:
> I tested this on a virtual OpenBSD 4.9, and it fixes the problem for me.
> Please install (otherwise I will in a few hours).

Done, as emacs-24 bzr 111316.  Thanks for testing it.

http://bzr.savannah.gnu.org/lh/emacs/emacs-24/revision/111316



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

* Re: emacs-24.2.93 build problems
       [not found] <CMM.0.94.0.1362444120.beebe@psi.math.utah.edu>
@ 2013-03-05  2:17 ` Paul Eggert
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Eggert @ 2013-03-05  2:17 UTC (permalink / raw)
  To: Nelson H. F. Beebe; +Cc: Emacs Development

On 03/04/2013 04:42 PM, Nelson H. F. Beebe wrote:
> MirBSD is a derivative of NetBSD and OpenBSD, and often causes porting
> issues.
> 
> I then made this one-line tweak to your patch:
> 
> 	%  diff sysdep.c.~1~ sysdep.c
> 	2654c2654
> 	< # ifndef KERN_PROC
> 	---
> 	> # if !defined(KERN_PROC) || defined(__MirBSD__)

Thanks, I pushed this into emacs-24 as well, as bzr 111317.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2013-03-05 02:03:05 +0000
+++ src/ChangeLog	2013-03-05 02:15:35 +0000
@@ -1,8 +1,9 @@
 2013-03-05  Paul Eggert  <eggert@cs.ucla.edu>
 
-	Fix a build failure on OpenBSD 4.x.
-	* sysdep.c (KERN_PROC, kinfo_proc) [BSD_SYSTEM && !KERN_PROC]:
-	Define to KERN_PROC2 and kinfo_proc2, for OpenBSD 4.9.
+	Fix a build failure on OpenBSD 4.x and MirBSD.
+	* sysdep.c (KERN_PROC, kinfo_proc)
+	[BSD_SYSTEM && (!KERN_PROC || __MirBSD__)]:
+	Define to KERN_PROC2 and kinfo_proc2, for OpenBSD 4.9 and MirBSD.
 	list-system-processes still returns nil, but at least it doesn't crash.
 	Problem reported by Nelson H. F. Beebe in
 	<http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00021.html>.

=== modified file 'src/sysdep.c'
--- src/sysdep.c	2013-03-05 02:03:05 +0000
+++ src/sysdep.c	2013-03-05 02:15:35 +0000
@@ -2650,8 +2650,9 @@
 #elif defined BSD_SYSTEM
 
 /* OpenBSD 4.9 and earlier do not have KERN_PROC.  Approximate it with
-   KERN_PROC2.  */
-# ifndef KERN_PROC
+   KERN_PROC2.  MirBSD's KERN_PROC seems to be busted.  */
+# if !defined KERN_PROC || defined __MirBSD__
+#  undef KERN_PROC
 #  define KERN_PROC KERN_PROC2
 #  define kinfo_proc kinfo_proc2
 # endif





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

* Re: emacs-24.2.93 build problems
  2013-03-04 23:44     ` Jérémie Courrèges-Anglas
@ 2013-03-05  3:47       ` Glenn Morris
  2013-03-05 14:00         ` Jérémie Courrèges-Anglas
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2013-03-05  3:47 UTC (permalink / raw)
  To: emacs-devel

Jérémie Courrèges-Anglas wrote:

> I have no idea whether it is correct, but M-: (list-system-processes)
> returns nil here on OpenBSD-current (5.3). 

Too late to make it work for 24.3, but could you make a bug report about
this please?



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

* Re: emacs-24.2.93 build problems
  2013-03-05  3:47       ` Glenn Morris
@ 2013-03-05 14:00         ` Jérémie Courrèges-Anglas
  2013-03-05 17:06           ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Jérémie Courrèges-Anglas @ 2013-03-05 14:00 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2162 bytes --]

Glenn Morris <rgm@gnu.org> writes:

> Jérémie Courrèges-Anglas wrote:
>
>> I have no idea whether it is correct, but M-: (list-system-processes)
>> returns nil here on OpenBSD-current (5.3).
>
> Too late to make it work for 24.3, but could you make a bug report about
> this please?

Fine, I think I have a diff to make it work on all OpenBSD systems, that
could be included in the trunk, I just need to test it.

But as far as 24.3 is concerned, I *really* suggest making this
function a stub on OpenBSD (just returning Qnil).

Here's why:

There are two different APIs involved:
- old KERN_PROC, similar to NetBSD
- new KERN_PROC, completely different

Here's how they have evolved:

1. old KERN_PROC API present and visible (usable)
   sysctl.h rev 1.1.1.1 (1995/10/18) -> rev 1.67 (2003/12/23)

2. new KERN_PROC API added as KERN_PROC2, old KERN_PROC still available
   sysctl.h rev 1.68 (2004/01/07) -> rev 1.100 (2009/06/15)

3. old KERN_PROC becomes hidden behind #ifdef's
   sysctl rev 1.101 (2010/01/10) -> rev 1.108 (2011/03/07)

4. old KERN_PROC is removed, the new KERN_PROC replaces it, KERN_PROC2
   aliases still present for backward compat
   sysctl.h rev 1.109 (2011/03/12) -> rev 1.119 (2011/12/14)

5. KERN_PROC2 aliases removed, only the new API remains
   sysctl.h rev 1.120 (2012/01/07) -> now


I've done some _light_ testing and here are the results:

- with or without the patch adding fallback to KERN_PROC2, build fails
  for cases 1 and 2. (This is because p_pid field wasn't present in
  struct kinfo_proc at that time.)

- with the patch, build doesn't fail for case 3

- with the patch, cases 3, 4 and 5 will have list-system-processes
  returning nil, since sysctl() is called with a wrong mib.

So supporting list-system-processes (as-is) on OpenBSD for 24.3 leads to
build failing with 1995/10/18 < OpenBSD < 2010/01/10 and to a useless
(and potentially harmful) function with OpenBSD >= 2010/01/10.

PS: I did not and I will not investigate the case of MirOS.
-- 
Jérémie Courrèges-Anglas
GPG Key fingerprint: 61DB D9A0 00A4 67CF 2A90  8961 6191 8FBF 06A1 1494

[-- Attachment #2: Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: emacs-24.2.93 build problems
  2013-03-05 14:00         ` Jérémie Courrèges-Anglas
@ 2013-03-05 17:06           ` Glenn Morris
  0 siblings, 0 replies; 10+ messages in thread
From: Glenn Morris @ 2013-03-05 17:06 UTC (permalink / raw)
  To: emacs-devel

Jérémie Courrèges-Anglas wrote:

> So supporting list-system-processes (as-is) on OpenBSD for 24.3 leads to
> build failing with 1995/10/18 < OpenBSD < 2010/01/10 and to a useless
> (and potentially harmful) function with OpenBSD >= 2010/01/10.

I get the feeling you are probably right, but since no-one reported any
build problems in the year since since this was introduced, or through
several months of pretest (until just now), we can only conclude that
(almost) no-one is using latest Emacs on older OpenBSD, so it doesn't
matter that much in practice.



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

end of thread, other threads:[~2013-03-05 17:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CMM.0.94.0.1362444120.beebe@psi.math.utah.edu>
2013-03-05  2:17 ` emacs-24.2.93 build problems Paul Eggert
2013-03-02 23:00 Nelson H. F. Beebe
2013-03-03  0:09 ` Paul Eggert
2013-03-04 20:34   ` Glenn Morris
2013-03-04 23:44     ` Jérémie Courrèges-Anglas
2013-03-05  3:47       ` Glenn Morris
2013-03-05 14:00         ` Jérémie Courrèges-Anglas
2013-03-05 17:06           ` Glenn Morris
2013-03-04 23:51   ` Glenn Morris
2013-03-05  2:06     ` Paul Eggert

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.