From: matz@... Date: 2017-05-19T09:29:24+00:00 Subject: [ruby-core:81275] [Ruby trunk Bug#13315] Single "%" at the end of `printf` format string appears in the result Issue #13315 has been updated by matz (Yukihiro Matsumoto). When I wrote the original code, it was intentional, but without any specific reason. It's OK for me to raise an error for this case. Matz. ---------------------------------------- Bug #13315: Single "%" at the end of `printf` format string appears in the result https://bugs.ruby-lang.org/issues/13315#change-64942 * Author: nobu (Nobuyoshi Nakada) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Is this intentional? ```ruby printf("%") #=> "%" ``` `printf` in glibc does print nothing, gcc warns though. ```c #include int main(void) { printf("%"); return 0; } ``` ```sh $ gcc fmt.c && ./a.out fmt.c: In function ���main���: fmt.c:5:10: warning: spurious trailing ���%��� in format [-Wformat=] printf("%"); ^ ``` `printf` command of bash errs. ```sh $ printf "%" -bash: printf: `%': missing format character ``` -- https://bugs.ruby-lang.org/ Unsubscribe: