New issue
Advanced search Search tips

Issue 785333 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

base::GetUniquePathNumber design improvement necessary

Project Member Reported by eladalon@chromium.org, Nov 15 2017

Issue description

Currently, base::GetUniquePathNumber() takes a nullable argument called "suffix", but nobody is using it. Furthermore, if one were to use it, one would run into confusing behavior. GetUniquePathNumber() is supposed to find a number to append to the filename in order to get an unused filename. However, it assumes that the user would always, given filename "x", would use number n to construct a new filename of the form "x (n)". This is not mentioned in the function's documentation; one must read the implementation to discern this detail.

Suppose "foo/bar" exists in the system. One calls GetUniquePathNumber("foo/bar", "_") and gets 1. One would then create the file "foo/bar_1". However, next time GetUniquePathNumber("foo/bar", "_") is called, 1 will be returned again, because GetUniquePathNumber() was actually checking for the existence of "foor/bar (1)" and "foo/bar (1)_", which is contrary to one would expect.
 
Status: Assigned (was: Verified)

Sign in to add a comment