Util-Linux Archive on lore.kernel.org
 help / Atom feed
* [PATCH 0/2] Fixes for v2.33 on musl-based systems
@ 2018-09-26  6:23 Patrick Steinhardt
  2018-09-26  6:23 ` [PATCH 1/2] lsblk: fix unknown type `stat` caused by missing header Patrick Steinhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Patrick Steinhardt @ 2018-09-26  6:23 UTC (permalink / raw)
  To: util-linux; +Cc: Patrick Steinhardt

Hi,

there are two small issues I discovered in v2.33-rc1 on
musl-based systems. The first patch fixes a compile error, the
second patch fixes a warning.

Regards
Patrick

Patrick Steinhardt (2):
  lsblk: fix unknown type `stat` caused by missing header
  rename: avoid undefined function prototype for `fpurge`

 misc-utils/lsblk.h  | 1 +
 misc-utils/rename.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

-- 
2.19.0

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

* [PATCH 1/2] lsblk: fix unknown type `stat` caused by missing header
  2018-09-26  6:23 [PATCH 0/2] Fixes for v2.33 on musl-based systems Patrick Steinhardt
@ 2018-09-26  6:23 ` Patrick Steinhardt
  2018-09-26  6:23 ` [PATCH 2/2] rename: avoid undefined function prototype for `fpurge` Patrick Steinhardt
  2018-10-04  9:58 ` [PATCH 0/2] Fixes for v2.33 on musl-based systems Karel Zak
  2 siblings, 0 replies; 4+ messages in thread
From: Patrick Steinhardt @ 2018-09-26  6:23 UTC (permalink / raw)
  To: util-linux; +Cc: Patrick Steinhardt

The structure `blkdev_cxt` has a `struct stat` member embedded, whose
size may not be known on some systems because of a missing include for
"sys/stat.h". On glibc-based systems, this header is included
transitively via "sys/statvfs.h", but on musl-based systems it is not.

Fix the resulting compile error due to unknown size of the struct by
including "sys/stat.h".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 misc-utils/lsblk.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/misc-utils/lsblk.h b/misc-utils/lsblk.h
index 6e0186576..baad3aa9b 100644
--- a/misc-utils/lsblk.h
+++ b/misc-utils/lsblk.h
@@ -8,6 +8,7 @@
 
 #include <stdint.h>
 #include <inttypes.h>
+#include <sys/stat.h>
 #include <sys/statvfs.h>
 
 #include <libsmartcols.h>
-- 
2.19.0

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

* [PATCH 2/2] rename: avoid undefined function prototype for `fpurge`
  2018-09-26  6:23 [PATCH 0/2] Fixes for v2.33 on musl-based systems Patrick Steinhardt
  2018-09-26  6:23 ` [PATCH 1/2] lsblk: fix unknown type `stat` caused by missing header Patrick Steinhardt
@ 2018-09-26  6:23 ` Patrick Steinhardt
  2018-10-04  9:58 ` [PATCH 0/2] Fixes for v2.33 on musl-based systems Karel Zak
  2 siblings, 0 replies; 4+ messages in thread
From: Patrick Steinhardt @ 2018-09-26  6:23 UTC (permalink / raw)
  To: util-linux; +Cc: Patrick Steinhardt

In case where the non-standard `fpurge` function is available, we
redefine `__fpurge` to `fpurge`. We can do so because the only
difference between both functions is that one returns an error code
while the other does not. But as we do not check the error code either
way, we do not care about which one of them we use.

The above redefinition happens unconditionally if we know that `fpurge`
exists. Most notably, we also redefine it if we already do have an
`__fpurge` function available that could be used. This causes problems
on musl-based platforms, where we detect availability of `fpurge` in
libc, but where no function declaration for it exists in "stdio_ext.h".
The compiler thus prints a warning due to an unknown function, even
though it will link just fine.

Avoid this warning by only redefining `__fpurge` to `fpurge` when
HAVE___FPURGE is not defined.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 misc-utils/rename.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index 0e3e1b9e1..1d9315793 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -17,9 +17,11 @@ for i in $@; do N=`echo "$i" | sed "s/$FROM/$TO/g"`; mv "$i" "$N"; done
 #ifdef HAVE_STDIO_EXT_H
 #	include <stdio_ext.h>
 #endif
-#ifdef HAVE_FPURGE
+#ifndef HAVE___FPURGE
+# ifdef HAVE_FPURGE
 #	define HAVE___FPURGE 1
 #	define __fpurge fpurge
+# endif
 #endif
 #include <string.h>
 #include <stdlib.h>
-- 
2.19.0

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

* Re: [PATCH 0/2] Fixes for v2.33 on musl-based systems
  2018-09-26  6:23 [PATCH 0/2] Fixes for v2.33 on musl-based systems Patrick Steinhardt
  2018-09-26  6:23 ` [PATCH 1/2] lsblk: fix unknown type `stat` caused by missing header Patrick Steinhardt
  2018-09-26  6:23 ` [PATCH 2/2] rename: avoid undefined function prototype for `fpurge` Patrick Steinhardt
@ 2018-10-04  9:58 ` Karel Zak
  2 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2018-10-04  9:58 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: util-linux

On Wed, Sep 26, 2018 at 08:23:07AM +0200, Patrick Steinhardt wrote:
> Patrick Steinhardt (2):
>   lsblk: fix unknown type `stat` caused by missing header
>   rename: avoid undefined function prototype for `fpurge`

Applied, thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  6:23 [PATCH 0/2] Fixes for v2.33 on musl-based systems Patrick Steinhardt
2018-09-26  6:23 ` [PATCH 1/2] lsblk: fix unknown type `stat` caused by missing header Patrick Steinhardt
2018-09-26  6:23 ` [PATCH 2/2] rename: avoid undefined function prototype for `fpurge` Patrick Steinhardt
2018-10-04  9:58 ` [PATCH 0/2] Fixes for v2.33 on musl-based systems Karel Zak

Util-Linux Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox