[PATCH] unistd: stddef.h and sys/types.h namespace cleanup

2019-06-24 Thread Paul Eggert
* lib/unistd.in.h [__GLIBC__]:
Do not include stddef.h or sys/types.h.
[!__GLIBC__]: Always include sys/types.h, since unistd.h is
supposed to declare off_t and ssize_t.  Problem found when looking
at why @GNULIB_PWRITE@ was different from the newly-added
@GNULIB_COPY_FILE_RANGE@ with respect to ssize_t.
---
 ChangeLog   | 10 ++
 lib/unistd.in.h | 17 +++--
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8a4763aad..1ce1c16b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-06-24  Paul Eggert  
+
+   unistd: stddef.h and sys/types.h namespace cleanup
+   * lib/unistd.in.h [__GLIBC__]:
+   Do not include stddef.h or sys/types.h.
+   [!__GLIBC__]: Always include sys/types.h, since unistd.h is
+   supposed to declare off_t and ssize_t.  Problem found when looking
+   at why @GNULIB_PWRITE@ was different from the newly-added
+   @GNULIB_COPY_FILE_RANGE@ with respect to ssize_t.
+
 2019-06-22  Akim Demaille  
 
maintainer-makefile: restore portability to non-GNU awks
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 9ffb2e990..032cc933d 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -52,7 +52,10 @@
 #define _@GUARD_PREFIX@_UNISTD_H
 
 /* NetBSD 5.0 mis-defines NULL.  Also get size_t.  */
-#include 
+/* But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include 
+#endif
 
 /* mingw doesn't define the SEEK_* or *_FILENO macros in .  */
 /* MSVC declares 'unlink' in , not in .  We must include
@@ -124,15 +127,9 @@
 
 /* MSVC defines off_t in .
May also define off_t to a 64-bit type on native Windows.  */
-#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
-/* Get off_t.  */
-# include 
-#endif
-
-#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
- || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
- || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
-/* Get ssize_t.  */
+/* But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+/* Get off_t, ssize_t.  */
 # include 
 #endif
 
-- 
2.21.0




Re: maintainer-makefile: catch uses of $< in non-implicit rules

2019-06-24 Thread Akim Demaille
Hi Tim,

> Le 24 juin 2019 à 11:42, Tim Rühsen  a écrit :
> 
> Hi Akim,
> 
> Your proposal works here on Debian after I switched to mawk via
> 'update-alternatives --config awk', selecting mawk. It detects two
> occurrences of $< in our (project) Makefiles correctly.
> 
> Switching back to the old maint.mk, brings back the error message about
> '-e'. I just did this to make sure.

Perfect, thanks.  Installed.


Re: maintainer-makefile: catch uses of $< in non-implicit rules

2019-06-24 Thread Tim Rühsen
Hi Akim,

On 6/22/19 5:53 PM, Akim Demaille wrote:
> Hi Tim,
> 
>> Le 17 juin 2019 à 12:04, Tim Rühsen  a écrit :
>>
>> Hi Akim,
>>
>> On 6/17/19 11:59 AM, Akim Demaille wrote:
>>> Hi Tim,
>>>
 Le 17 juin 2019 à 11:57, Tim Rühsen  a écrit :

 Hi Akim,

 The patch uses awk -e which is understood only by GNU awk. This breaks
 all Debian CI tests here since Debian installs 'mawk' by default (I
 wasn't aware of that before).

 It's not a big deal to install package 'gawk' everywhere, but I just
 wanted to mention it. I can see no warning/hint in any of the patch's
 comments.
>>>
>>> That was not my intention.
>>>
>>> I expect that maintainers have gawk installed, so I think this check
>>> should be skipped if awk is not gawk.  WDYT?
>>
>> Thanks, sounds reasonable to me.
> 
> Here is my proposal.  Worked properly with the non GNU awk sitting on my 
> machine.

Your proposal works here on Debian after I switched to mawk via
'update-alternatives --config awk', selecting mawk. It detects two
occurrences of $< in our (project) Makefiles correctly.

Switching back to the old maint.mk, brings back the error message about
'-e'. I just did this to make sure.

Thanks for working on it !

Regards, Tim

> 
> commit b70c97f3ecf45a5c98b7f32189c1a4ae72a60788
> Author: Akim Demaille 
> Date:   Sat Jun 22 17:52:16 2019 +0200
> 
> maintainer-makefile: restore portability to non-GNU awks
> 
> Reported by Tim Rühsen.
> * top/maint.mk (AWK): New variable.  Use it.
> (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
> 
> diff --git a/ChangeLog b/ChangeLog
> index cdc2b3d7a..dc7e52c0a 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2019-06-22  Akim Demaille  
> +
> + maintainer-makefile: restore portability to non-GNU awks
> + Reported by Tim Rühsen.
> + * top/maint.mk (AWK): New variable.  Use it.
> + (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
> +
>  2019-06-22  Akim Demaille  
>  
>   argmatch: put all the docs member last.
> diff --git a/top/maint.mk b/top/maint.mk
> index 3dbe9c378..16e936022 100644
> --- a/top/maint.mk
> +++ b/top/maint.mk
> @@ -24,6 +24,7 @@ ME := maint.mk
>  # These variables ought to be defined through the configure.ac section
>  # of the module description. But some packages import this file directly,
>  # ignoring the module description.
> +AWK ?= awk
>  GREP ?= grep
>  SED ?= sed
>  
> @@ -190,7 +191,7 @@ $(sc_z_rules_): %.z: %
>   @end=$$(date +%s.%N);   \
>   start=$$(cat .sc-start-$*); \
>   rm -f .sc-start-$*; \
> - awk -v s=$$start -v e=$$end \
> + $(AWK) -v s=$$start -v e=$$end  \
> 'END {printf "%.2f $(patsubst sc_%,%,$*)\n", e - s}' < /dev/null
>  
>  # The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
> @@ -435,13 +436,15 @@ sc_prohibit_gnu_make_extensions_awk_ =  
> \
>   exit status;\
>}
>  sc_prohibit_gnu_make_extensions:
> - (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |  \
> -   tr ' ' '\n' | \
> -   $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |  \
> -   while read m; do  \
> - $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |  \
> -   awk -v file=$$m -e '$($@_awk_)' || exit 1;\
> -   done
> + @if $(AWK) --version | grep GNU >/dev/null 2>&1; then   \
> +   (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |\
> + tr ' ' '\n' |   \
> + $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |\
> + while read m; do\
> +   $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |\
> + $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1;   \
> + done;   \
> + fi
>  
>  # Using EXIT_SUCCESS as the first argument to error is misleading,
>  # since when that parameter is 0, error does not exit.  Use '0' instead.
> @@ -1383,7 +1386,7 @@ gpg_key_ID ?=   
> \
>$$(cd $(srcdir)\
>   && git cat-file tag v$(VERSION) \
>  | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null  \
> -| awk '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
> +| $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
>  
>  translation_project_ ?= coordina...@translationproject.org
>  
> 
> 




Re: Alpine: useless-if-before-free: Exec format error

2019-06-24 Thread Tim Rühsen
On 6/23/19 6:32 PM, Jim Meyering wrote:
> On Wed, Jun 19, 2019 at 3:12 AM Bruno Haible  wrote:
> ...
>> Done like this:
>>
>> 2019-06-19  Bruno Haible  
>>
>> Reorder pieces of header in perl scripts.
>> The desired order is
>> - Prologue part 1 (2 lines with #!)
>> - Program short description
>> - Copyright and license notice
>> - Written-by notice
>> - Program short description (optional)
>> - Program long description (optional)
>> - Prologue part 2
>> - Time stamp
>> - Code
>> Reported by Paul Eggert.
>> * build-aux/announce-gen: Reorder header.
>> * build-aux/gitlog-to-changelog: Likewise.
>> * build-aux/useless-if-before-free: Likewise.
>> * build-aux/prefix-gnulib-mk: Add copyright notice and short
>> description.
>> * build-aux/update-copyright: Likewise. Add short description. Bump
>> time-stamp-line-limit to 200.
> 
> Thank you all for improving those scripts!
> 

I didn't expect this to escalate so much - and can only repeat what Jim
says, thank you for doing all this work !

Regards, Tim



signature.asc
Description: OpenPGP digital signature