Re: getloadavg is broken

2011-05-28 Thread Bruno Haible
Jim Meyering wrote:
>         getloadavg: trim unused parts and speed up 'configure'
>         ...
> 
> removed the code that used to perform an unusual compile-time test:
> using using the getloadavg.c from somewhere under $top_srcdir.
> *That* was the sole reason for the macro argument you've just removed.

Right, that was a compile-time test that used to test whether getloadavg
needed extra privileges. [1]

Bruno

[1] http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00185.html
-- 
In memoriam Thomas Ford 




Re: getloadavg is broken

2011-05-28 Thread Jim Meyering
Bruno Haible wrote:
> Eric Blake wrote:
>> Looks sane to me.
>
> Thanks for the review. Jim is silent about it for 4 days. So I'm committing 
> the
> patch now:
>
>
> 2011-05-28  Bruno Haible  
>
>   getloadavg: Remove an unreliable safety check.
>   * m4/getloadavg.m4 (gl_GETLOADAVG): Drop argument. Remove test whether
>   getloadavg.c is in place.
>   * modules/getloadavg (configure.ac): Drop argument of gl_GETLOADAVG.
>   Reported by Sam Steingold .

Thanks for applying that.

I've finally investigated it.
At first I was dubious, because it used to be required.
However, I've just found that Paul's big change:

commit 83ca5b985b375b6445d54d99e523508f075a497e
Author: Paul Eggert 
Date:   Tue Feb 15 13:18:20 2011 -0800

getloadavg: set errno

* lib/getloadavg.c: Set errno when returning -1.  If no other
error number looks appropriate, set it to ENOSYS if the getloadavg
looks like it can't possibly ever work, ENOTSUP otherwise.
Suggested by Bruno Haible in
.

getloadavg: trim unused parts and speed up 'configure'
...

removed the code that used to perform an unusual compile-time test:
using using the getloadavg.c from somewhere under $top_srcdir.
*That* was the sole reason for the macro argument you've just removed.
So your removal was correct and welcome.  Thank you.

The code that Paul removed was probably used only by coreutils,
and even that was only because I had patched the modules file
with this:

  $ cat gl/modules/getloadavg.diff
  diff --git a/modules/getloadavg b/modules/getloadavg
  index 2fbeb40..b79aaca 100644
  --- a/modules/getloadavg
  +++ b/modules/getloadavg
  @@ -16,7 +16,7 @@ stdbool
   fcntl-safer

   configure.ac:
  -gl_GETLOADAVG([$gl_source_base])
  +gl_GETLOADAVG([lib])
   gl_STDLIB_MODULE_INDICATOR([getloadavg])

   Makefile.am:

I will remove that patch file, since it's been useless since February
and would fail to apply with the latest gnulib.



Re: getloadavg is broken

2011-05-28 Thread Bruno Haible
Eric Blake wrote:
> Looks sane to me.

Thanks for the review. Jim is silent about it for 4 days. So I'm committing the
patch now:


2011-05-28  Bruno Haible  

getloadavg: Remove an unreliable safety check.
* m4/getloadavg.m4 (gl_GETLOADAVG): Drop argument. Remove test whether
getloadavg.c is in place.
* modules/getloadavg (configure.ac): Drop argument of gl_GETLOADAVG.
Reported by Sam Steingold .

-- 
In memoriam Thomas Ford 




Re: getloadavg is broken

2011-05-24 Thread Eric Blake
On 05/24/2011 03:57 PM, Bruno Haible wrote:
> Sam Steingold wrote:
>> Unless I remove the offending line (see the appended patch), configure
>> fails with "../src/src/gllib/getloadavg.c is missing" message.
>> apparently $srcdir is "../src" and $1=$gl_source_base="src/gllib" which
>> cannot be combined into anything sensible.
> 
> This code was meant to simulate what an AC_LIBSOURCES invocation does.
> But AC_LIBSOURCES from autoconf was found to be inadequate in the context
> of gnulib and therefore has gotten a gnulib specific override (see
> gnulib-tool functions func_emit_initmacro_start, func_emit_initmacro_end).
> 
> Most of the gnulib users actually don't even need the AC_LIBSOURCES invocation
> normally, because gnulib-tool and a correct module description already
> guarantee that source files will be where they are expected.
> 
>> no other module does such a check, so it is not clear why getloadavg should.
> 
> Good point. Here's a proposed patch.

Looks sane to me.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: getloadavg is broken

2011-05-24 Thread Bruno Haible
Sam Steingold wrote:
> Unless I remove the offending line (see the appended patch), configure
> fails with "../src/src/gllib/getloadavg.c is missing" message.
> apparently $srcdir is "../src" and $1=$gl_source_base="src/gllib" which
> cannot be combined into anything sensible.

This code was meant to simulate what an AC_LIBSOURCES invocation does.
But AC_LIBSOURCES from autoconf was found to be inadequate in the context
of gnulib and therefore has gotten a gnulib specific override (see
gnulib-tool functions func_emit_initmacro_start, func_emit_initmacro_end).

Most of the gnulib users actually don't even need the AC_LIBSOURCES invocation
normally, because gnulib-tool and a correct module description already
guarantee that source files will be where they are expected.

> no other module does such a check, so it is not clear why getloadavg should.

Good point. Here's a proposed patch.


2011-05-24  Bruno Haible  

getloadavg: Remove an unreliable safety check.
* m4/getloadavg.m4 (gl_GETLOADAVG): Drop argument. Remove test
whether getloadavg.c is in place.
* modules/getloadavg (configure.ac): Drop argument of gl_GETLOADAVG.
Reported by Sam Steingold .

--- m4/getloadavg.m4.orig   Tue May 24 23:49:07 2011
+++ m4/getloadavg.m4Tue May 24 23:48:41 2011
@@ -7,23 +7,19 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 2
+#serial 3
 
 # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
 # New applications should use gl_GETLOADAVG instead.
 
-# gl_GETLOADAVG(LIBOBJDIR)
-# 
+# gl_GETLOADAVG
+# -
 AC_DEFUN([gl_GETLOADAVG],
 [AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
 
 # Persuade glibc  to declare getloadavg().
 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-# Make sure getloadavg.c is where it belongs, at configure-time.
-test -f "$srcdir/$1/getloadavg.c" ||
-  AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
-
 gl_save_LIBS=$LIBS
 
 # getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
--- modules/getloadavg.orig Tue May 24 23:49:07 2011
+++ modules/getloadavg  Tue May 24 23:48:51 2011
@@ -12,7 +12,7 @@
 stdlib
 
 configure.ac:
-gl_GETLOADAVG([$gl_source_base])
+gl_GETLOADAVG
 gl_STDLIB_MODULE_INDICATOR([getloadavg])
 
 Makefile.am:
-- 
In memoriam Georges Darboy 



getloadavg is broken

2011-05-24 Thread Sam Steingold
Unless I remove the offending line (see the appended patch), configure
fails with "../src/src/gllib/getloadavg.c is missing" message.
apparently $srcdir is "../src" and $1=$gl_source_base="src/gllib" which
cannot be combined into anything sensible.
no other module does such a check, so it is not clear why getloadavg should.

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 
11.0.60900031
http://camera.org http://www.PetitionOnline.com/tap12009/
http://memri.org http://palestinefacts.org http://truepeace.org
Trespassers will be shot.  Survivors will be SHOT AGAIN!


diff -r efa3b7c4c766 src/glm4/getloadavg.m4
--- a/src/glm4/getloadavg.m4Tue May 24 16:34:36 2011 -0400
+++ b/src/glm4/getloadavg.m4Tue May 24 16:57:30 2011 -0400
@@ -20,10 +20,6 @@ AC_DEFUN([gl_GETLOADAVG],
 # Persuade glibc  to declare getloadavg().
 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-# Make sure getloadavg.c is where it belongs, at configure-time.
-test -f "$srcdir/$1/getloadavg.c" ||
-  AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
-
 gl_save_LIBS=$LIBS
 
 # getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,