All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Pavel Reichl <preichl@redhat.com>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
	Carlos Maiolino <cem@kernel.org>,
	Andrey Albershteyn <aalbersh@redhat.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfsprogs: Fix mismatched return type of filesize()
Date: Tue, 1 Apr 2025 20:22:33 -0400	[thread overview]
Message-ID: <20250402002233.GA2299061@mit.edu> (raw)

On Fri, Feb 21, 2025 at 07:57:57PM +0100, Pavel Reichl wrote:
> The function filesize() was declared with a return type of 'long' but
> defined with 'off_t'. This mismatch caused build issues due to type
> incompatibility.
> 
> This commit updates the declaration to match the definition, ensuring
> consistency and preventing potential compilation errors.
> 
> Fixes: 73fb78e5ee8 ("mkfs: support copying in large or sparse files")

I had run into this issue when building xfsprogs on i386, and had
investigated the compilation failure before finding this commit in
origin/for-next.  But in my fix, I also found that there was a missing
long -> off_t conversion in setup_proto():

diff --git a/mkfs/proto.c b/mkfs/proto.c
index 7f56a3d8..52ef64ff 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -61,7 +61,7 @@ setup_proto(
 	char		*buf = NULL;
 	static char	dflt[] = "d--755 0 0 $";
 	int		fd;
-	long		size;
+	off_t		size;
 
 	if (!fname)
 		return dflt;

... since setup_proto() also calls filesize():

	if ((fd = open(fname, O_RDONLY)) < 0 || (size = filesize(fd)) < 0) {

How important is it fix this up?  I can send a formal patch if that
would be helpful, but commit a5466cee9874 is certainly enough to fix
the build failure so maybe it's enough.

Cheers,

					- Ted

             reply	other threads:[~2025-04-02  0:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <rVcV0bUochTHYCUeMeo8VPv0LODkI0DQY8oB8J3Pf1--Zp8jG4weSLdbo-ME7csTl1V_Cdw3SXvCzwH-8jBFNQ==@protonmail.internalid>
2025-04-02  0:22 ` Theodore Ts'o [this message]
2025-04-02  5:50   ` [PATCH] xfsprogs: Fix mismatched return type of filesize() Carlos Maiolino
2025-04-02 14:31   ` Darrick J. Wong
     [not found] <-uT7HOcTG_xe8v8U0_5OQg6ll9vJyYEFQeSs_2FwUHujx116vYRcX2iovzoJvkN8K9zDDmQxQWB6H1CDLiOVdw==@protonmail.internalid>
2025-02-17 15:50 ` Pavel Reichl
2025-02-18  8:18   ` Carlos Maiolino
2025-02-18 18:15     ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250402002233.GA2299061@mit.edu \
    --to=tytso@mit.edu \
    --cc=aalbersh@redhat.com \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=preichl@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.