Project

General

Profile

Actions

Bug #15417

closed

Pathname case insensitive comparison

Added by ioquatix (Samuel Williams) over 5 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:90543]
Tags:

Description

While fixing some issues with Pathname, I noticed the following comparison:

  SAME_PATHS = if File::FNM_SYSCASE.nonzero?
    # Avoid #zero? here because #casecmp can return nil.
    proc {|a, b| a.casecmp(b) == 0}
  else
    proc {|a, b| a == b}
  end

Firstly, this seems wrong to me because case sensitivity is per-mount not a global state for the entire system.

Secondly, it concerns me because sometimes this becomes security bug, e.g. path may or may not be the same, and could slip through some sanity check (e.g. git could checkout files to .git directory with case insensitive file system).

Unless string match exactly, we should leave it to file system to determine if the path is equivalent or not (e.g. in the case of Pathname#relative_path_from). Trying to be too clever might cause future pain.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0