fix(utils): skip repeated delimiters in parseArgs

Open
#4,393 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@baphomello is already working on this.

Since Nov 20, 2026.

  • #4394 by @baphomello — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
perl
Domain
cli

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 str is refused as a syntax error, because the rest of the line is str with a leading space.
  • quest set 5 on sends the quest state 0 (off), because the third argument is on.
  • eventMacro labp x y z gives $.param[0] empty and $.param[1] equal to x.

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
  1. Enter the game with a character that has free status points.
  2. Run st add str with two spaces between add and str. The console shows the syntax error.
  3. Run st add str with 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenKore/openkore

All issues in OpenKore/openkore

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.