Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix name ordering when names only differ in length #926

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jan 17, 2024

  1. Fixed name ordering when names only differ in length

    Wild this hasn't been caught until now.
    
    Because the exact ordering of the comparison in lfs_bd_cmp is a bit
    ambiguous, lfs_dir_find_match returned the wrong result when filenames
    were equal, and only differed in length.
    
    For example:
    
      - cmp("a", "aa") should be LFS_CMP_LT
      - cmp("aaa", "aa") should be LFS_CMP_GT
    
    We're quite lucky that none of the littlefs internals currently depend
    on the sorted order, otherwise we'd probably be stuck with this weird
    ordering for backwards compatibility reasons...
    
    Fixed, and added some test cases over directory ordering to prevent
    regression in the future.
    
    Found by andriyndev
    geky committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    52df70c View commit details
    Browse the repository at this point in the history