任务单 #40242

sprintf2

开放日期: 2020-03-10 01:05 最后更新: 2020-03-10 01:58

报告人:
(匿名)
属主:
(无)
类型:
状态:
开启
组件:
里程碑:
(无)
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
文件:
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

The sprintf2 command, when duplicated arguments are used, is seen to occasionally use 1 instead of 0 for the first argument value. An example:

foo = 0
sprintf2 bar '00 %s 00 00 %s 00' foo foo
bar becomes '00 01 00 00 00 00'

Below a workaround. I've gone for Medium for Priority and Milestone as can be worked around as below.

foo = 0
foo2 = foo
sprintf2 bar '00 %s 00 00 %s 00'  foo foo2
bar becomes '00 00 00 00 00 00'

Unknown, is whether the observed issue is more general. For example, affecting multiple arguments, with problem seen with first argument, or perhaps all bar last argument. And/or affecting different intended and/or seen values, as well as just respective 0 and 1. And perhaps affecting sprintf command too.

任务单历史 (3/5 Histories)

2020-03-10 01:05 Updated by: None
  • New Ticket "sprintf2" created
2020-03-10 01:09 Updated by: None
评论

Corrected formatting:

The sprintf2 command, when duplicated arguments are used, is seen to occasionally use 1 instead of 0 for the first argument value. An example:

foo = 0

sprintf2 bar '00 %s 00 00 %s 00' foo foo

bar becomes '00 01 00 00 00 00'

Below a workaround. I've gone for Medium for Priority and Milestone as can be worked around as below.

foo = 0

foo2 = foo

sprintf2 bar '00 %s 00 00 %s 00' foo foo2

bar becomes '00 00 00 00 00 00'

Unknown, is whether the observed issue is more general. For example, affecting multiple arguments, with problem seen with first argument, or perhaps all bar last argument. And/or affecting different intended and/or seen values, as well as just respective 0 and 1. And perhaps affecting sprintf command too.

2020-03-10 01:13 Updated by: None
评论

Corrected formatting, and code:

The sprintf2 command, when duplicated arguments are used, is seen to occasionally use other value for first argument. An example:

foo = '00'

sprintf2 bar '00 %s 00 00 %s 00' foo foo

bar becomes '00 01 00 00 00 00'

Below a workaround. I've gone for Medium for Priority and Milestone as can be worked around as below.

foo = '00'

foo2 = foo

sprintf2 bar '00 %s 00 00 %s 00' foo foo2

bar becomes '00 00 00 00 00 00'

Unknown, is whether the observed issue is more general. For example, affecting multiple arguments, with problem seen with first argument, or perhaps all bar last argument. And/or affecting different intended and/or seen values, as well as just those above. And perhaps affecting sprintf command too.

2020-03-10 01:56 Updated by: doda
  • Details Updated
评论

'%s' accepts a string value, not a integer value.

use '%d' instead.

e.g.

foo = 0
sprintf2 bar '00 %02d 00 00 %02d 00' foo foo
messagebox bar "bar"

2020-03-10 01:58 Updated by: doda
评论

(匿名) への返信

foo = '00'
sprintf2 bar '00 %s 00 00 %s 00' foo foo
bar becomes '00 01 00 00 00 00'

Not reproduced.

Which version are you using?

Attachment File List

No attachments

编辑

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » 登录名