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


Groups > linux.debian.bugs.dist > #1011758

Bug#961739: printf attempts to parse options and fails to print -h or similar

From Melvin Vermeeren <vermeeren@vermwa.re>
Newsgroups linux.debian.bugs.dist
Subject Bug#961739: printf attempts to parse options and fails to print -h or similar
Date 2020-05-28 17:30 +0200
Message-ID <AbsDM-5yg-7@gated-at.bofh.it> (permalink)
Organization vermware

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Package: dash
Version: 0.5.10.2-5

Hi,

POSIX specifies printf has no options, meaning these should print "-h" and "--
help" respectively. Arguments parsing must simply not be attempted at all in 
order to be compliant as far as I know.

$ printf -h
sh: 1: printf: Illegal option -h
$ printf --help
sh: 2: printf: Illegal option --

From https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html:
> SYNOPSIS
>
>    printf format [argument...]
>
> ...
>
> OPTIONS
>
>    None.

Bash also does not handle this correctly. However bash is not POSIX sh, hence 
it is not a bug. (It appears bash some some "printf -v var" extension.) I also 
tested zsh, which appears to be fully compliant.

Thanks

-- 
Melvin Vermeeren

Back to linux.debian.bugs.dist | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Bug#961739: printf attempts to parse options and fails to print -h or similar Melvin Vermeeren <vermeeren@vermwa.re> - 2020-05-28 17:30 +0200
  Bug#961739: printf attempts to parse options and fails to print -h or similar Jakub Wilk <jwilk@jwilk.net> - 2020-05-29 20:00 +0200

csiph-web