libretro / libretro/RetroArch

libretrodb_tool wrong return value on no result

Open
#11,378 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

Description

I wrote a little shell-script to rename my gamefles to the actual title of the game. As crc32 returns the checkum in lowercase, as I started, the checksum was only matched when in uppercase, so search for both combining them with ||. This now results in doubled results in the var, and after jq I had filenames with newline in them.

Expected behavior

A return value not null should be returned if no matching entry was found and 0 should be returned when the query was succesfull.

Actual behavior

1 is returned, no matter if the query was succesfull or not.

Steps to reproduce the bug
  1. ./libretrodb_tool Nintendo\ -\ Nintendo\ DS.rdb find "{'crc':b'3877d3d3'}"; echo $?
    Gives the game-data and 1, but on success it should be 0.
  2. ./libretrodb_tool Nintendo\ -\ Nintendo\ DS.rdb find "{'crc':b'3877d3d2'}"; echo $?
    Gives just 1, which is correct.
Version/Commit

You can find this information under Information/System Information

  • RetroArch: current master (bc43db178958d501700dbd2ee0c567c7649de316)

Contributor guide

Open the contributing guide

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.

Research direction

Start with the libretrodb_tool find command and reproduce both CRC queries from the issue, checking their printed output and shell exit status. Trace how a matching result and no-result case are reported, then verify that success returns 0 while no match returns a nonzero value.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.