[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: built-in printf returns success when integer is out of range
From: |
Dennis Williamson |
Subject: |
Re: built-in printf returns success when integer is out of range |
Date: |
Wed, 26 Jul 2023 15:52:32 -0500 |
On Wed, Jul 26, 2023, 3:40 PM <thomas@habets.se> wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat
> -Werror=format-security -Wall
> uname output: Linux fnord42 6.1.25-1rodete1-amd64 #1 SMP
> PREEMPT_DYNAMIC Debian 6.1.25-1rodete1 (2023-05-11) x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 5.2
> Patch Level: 15
> Release Status: release
>
> Description:
> printf '%d\n' 111111111111111111111111111 && echo success
> prints "success"
> /usr/bin/printf does not, but instead returns EXIT_FAILURE (1).
>
> Repeat-By:
> Run:
> printf '%d\n' 111111111111111111111111111 && echo success
>
>
You didn't include all the output. It's treated as a warning rather than an
error. That's why an error status isn't set.