Ticket #40242

sprintf2

Open Date: 2020-03-10 01:05 Last Update: 2020-10-06 19:50

Reporter:
(Anonymous)
Owner:
(None)
Type:
Status:
Closed
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Works For Me
File:
None
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.

Ticket History (3/6 Histories)

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

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
Comment

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
Comment

'%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
Comment

(匿名) への返信

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?

2020-10-06 19:50 Updated by: nmaya
  • Status Update from Open to Closed
  • Resolution Update from None to Works For Me

Attachment File List

No attachments

Edit

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