Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14564

Re: examples/loadables/finfo.c type problems

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: examples/loadables/finfo.c type problems
Date 2018-09-09 14:33 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.562.1536518694.1284.bug-bash@gnu.org> (permalink)
References <20180907212804.GC60818@lorvorc.mips.inka.de>

Show all headers | View raw


On 9/7/18 5:28 PM, Christian Weisgerber wrote:
> Compiling examples/loadables/finfo.c (bash 4.4.23, 5.0-alpha) on
> OpenBSD produces various warnings about ill-matched types:

Yeah, it looks like OpenBSD has some unique type sizes here. Unfortunately,
there aren't portable printf format specifiers for `standard' Unix types.
The easiest fix is to add a bunch of sizeof() checks, or, equivalently,
add those checks to configure and end up with more SIZEOF_xxx defines, but
I haven't done that just for examples.

> 
> I was thinking about how to fix those, but then I noticed existing bad
> casts in the code, e.g.,
> 
>                 printf("%ld\n", (long) st->st_size);
> 
> which potentially truncate values.

Pretty much all the systems bash runs on these days have 64-bit longs.
How big a file do you have? But the fix is the same as above.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: examples/loadables/finfo.c type problems Chet Ramey <chet.ramey@case.edu> - 2018-09-09 14:33 -0400

csiph-web