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


Groups > gnu.bash.bug > #14564 > unrolled thread

Re: examples/loadables/finfo.c type problems

Started byChet Ramey <chet.ramey@case.edu>
First post2018-09-09 14:33 -0400
Last post2018-09-09 14:33 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#14564 — Re: examples/loadables/finfo.c type problems

FromChet Ramey <chet.ramey@case.edu>
Date2018-09-09 14:33 -0400
SubjectRe: examples/loadables/finfo.c type problems
Message-ID<mailman.562.1536518694.1284.bug-bash@gnu.org>
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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web