fix(utils): skip repeated delimiters in parseArgs
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 42/100
Research direction
The bug is in parseArgs in src/Utils.pm: the delimiter-consuming line ($tmp, $command) =~ /^(${delimiters}*)(.*)/; matches but assigns nothing, so a run of delimiters is never skipped. Read the whole subroutine and its documented contract (leading/trailing whitespace ignored, quoted arguments preserved), then fix it so one or more delimiters are consumed and empty quoted arguments still survive. Done means parseArgs("a b") yields a and b and perl -wc src/Utils.pm is warning-free. Note the linked open pull request #4394 already targets this.
Written by the indexing model from the issue text.
Description
Openkore version git
master 3125ca761 (ctime:2026-11-19)
XKore Mode
XKore 3
RO Server Name
rAthena local (packet version 20260619, serverType kRO_RagexeRE_2021_11_03)
Link to RO server
https://github.com/rathena/rathena
Result
Two spaces between the arguments of a console command make parseArgs return an empty argument. Every argument after it moves one place.
parseArgs in src/Utils.pm has the line ($tmp, $command) =~ /^(${delimiters}*)(.*)/; after each delimiter. It only matches and does not assign, so no run of delimiters is skipped. perl -wc src/Utils.pm reports Useless use of private variable in void context for that line.
parseArgs("a b") returns [a]|[]|[b]. The commands that use it then fail or act on wrong values:
st add stris refused as a syntax error, because the rest of the line isstrwith a leading space.quest set 5 onsends the quest state0(off), because the third argument ison.eventMacro labp x y zgives$.param[0]empty and$.param[1]equal tox.
The documentation of parseArgs says that leading and trailing whitespace is ignored.
Relevant Log Output
The LABCMD lines are commands that a local debug plugin sends in game. SENDQ comes from a test hook on sendQuestState. The macro labp runs log P=[$.param[0]] [$.param[1]] [$.param[2]].
LABCMD> st add str
Syntax Error in function 'st add' (Add Status Point)
Usage: st add <str | agi | vit | int | dex | luk | pow | sta | wis | spl | con | crt>
LABCMD> st add str
(accepted, the character gets the point)
LABCMD> quest set 5 on
SENDQ id=5 state=1
LABCMD> quest set 5 on
SENDQ id=5 state=0
LABCMD> eventMacro labp x y z
P=[x] [y] [z]
LABCMD> eventMacro labp x y z
P=[] [x] []
Expected Result
Repeated spaces between arguments act as one space. st add str adds the point, quest set 5 on sends state 1, and eventMacro labp x y z gives x, y, z. Quoted arguments, including empty quoted ones, stay as they are.
How to Reproduce
- Enter the game with a character that has free status points.
- Run
st add strwith two spaces betweenaddandstr. The console shows the syntax error. - Run
st add strwith one space. The point is added.
- Dominant language
- Perl
- Stars
- 1.5k
- Forks
- 1.2k
- Avg merge
- 11h
- Merged PRs (30d)
- 110
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenKore/openkore
-
fix(char-create): show the real reason a character is refusedPossibly taken @baphomello claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
fix(manner): show the real result of manner and mute packetsPossibly taken @baphomello claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
Intermittent undefined hook removal assertion during cleanupPossibly taken @baphomello claimed this today. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
fix(talknpc): bind server-started dialogs to the packet NPCPossibly taken @baphomello claimed this 2 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 1/100
Maintainers usually reply within 1 day
-
Will WX's interface get a dark mode?Possibly taken @baphomello claimed this 7 days ago. Openfeature request
Difficulty 5/5 Over a week Newbie friendliness 15/100
OpenKore/openkore#4316 · 4 comments ·
Maintainers usually reply within 1 day
All issues in OpenKore/openkore
Similar issues
-
area:runtime bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
fglock/PerlOnJava#2164 ·
Maintainers usually reply within 1 day
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksOpenteam-cli
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
Difficulty 1/5 Under an hour Newbie friendliness 93/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
inverse-inc/packetfence#9728 ·
Maintainers usually reply within 1 day