[ruby-core:80457] [Ruby trunk Bug#13315] Single "%" at the end of `printf` format string appears in the result

From: her@...
Date: 2017-03-29 08:13:17 UTC
List: ruby-core #80457
Issue #13315 has been updated by sorah (sorah Shota Fukumori).

Assignee set to matz (Yukihiro Matsumoto)

Matz, is this intentional?

----------------------------------------
Bug #13315: Single "%" at the end of `printf` format string appears in the result
https://bugs.ruby-lang.org/issues/13315#change-63949

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* 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 <stdio.h>

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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next