Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid printf format in iolatency/cachestat #30

Closed
evgkrsk opened this issue Jul 11, 2015 · 5 comments
Closed

Invalid printf format in iolatency/cachestat #30

evgkrsk opened this issue Jul 11, 2015 · 5 comments

Comments

@evgkrsk
Copy link

evgkrsk commented Jul 11, 2015

[root@thinkpad ~]# iolatency 1 2
Tracing block I/O. Output every 1 seconds.

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

Ending tracing...
[root@thinkpad ~]# iolatency -T 1 2
Tracing block I/O. Output every 1 seconds.
/usr/bin/iolatency: line 204: printf: `(': invalid format character
/usr/bin/iolatency: line 204: printf: `(': invalid format character

Ending tracing...
[root@thinkpad ~]# which printf
/usr/bin/printf
@scotte
Copy link
Contributor

scotte commented Dec 19, 2017

You don't have, for example, /bin/bash linked to /bin/zsh (which has a printf built-in that doesn't know about %()T expressions), do you? The "invalid format character" message is exactly what zsh displays (and different than, say, the dash built-in which is "invalid conversion specification"). Otherwise I'd guess your /usr/bin/printf, for whatever reason, doesn't support those expressions, perhaps it's too old?

@evgkrsk
Copy link
Author

evgkrsk commented Dec 20, 2017

I have zsh as root shell, but it is not linked to /bin/bash.

/usr/bin/printf is from coreutils-8.27.0.23.f4570

@scotte
Copy link
Contributor

scotte commented Dec 20, 2017

Ah, so the "%()T" expression requires using a bash built-in, not /usr/bin/printf (which only supports whatever the C printf() function does). So - I'm going to guess either your bash doesn't support this expression (looks like this has been in bash since 4.2 - circa 2011) or somehow another printf implementation is being used here (zsh shows the same error message you have, /usr/bin/printf does not). Does your "bash" manpage show a section about %(datefmt)T ? Does printf "%(%H)T\n" (run from bash) display the current hour?

@evgkrsk
Copy link
Author

evgkrsk commented Dec 21, 2017

You are right:

evg@thinkpad ~ $exec bash
bash-3.2$ printf "%(%H)T\n"
bash: printf: `(': invalid format character
bash-3.2$ 

but:

root@thinkpad ~ #bash4 /usr/bin/iolatency -T 1 2
Tracing block I/O. Output every 1 seconds.

09:39:41:
  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

09:39:42:
  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 5        |######################################|

Ending tracing...
root@thinkpad ~ #

seems like I need to migrate /bin/bash from 3.2 to 4.2+

Thanks for support!

@evgkrsk evgkrsk closed this as completed Dec 21, 2017
@scotte
Copy link
Contributor

scotte commented Dec 21, 2017

Excellent! Glad that's is solved for you and thanks for following up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants