Re: [PATCH v4 1/2] abspath: add a function to resolve paths with missing components
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Dec 8, 2020, 02:51 UTC
- Message-ID
- <X87qNTiQDlnzm6e2@camp.crustytoothpaste.net>
- In-Reply-To
- <c1d1fe44-6a7d-3578-cd89-9aea59c4637a@web.de>
On 2020-12-07 at 17:19:32, René Scharfe wrote:
> I find the concept of a "real" path with imaginary components strangely > amusing. But perhaps a name like strbuf_resolve_path() would fit better?
I think I'm going to take the strbuf_realpath_forgiving solution from Eric Sunshine because I think having similar names for similar functions helps discoverability.
Show 10 quoted lines
> So the original code errors out if there is a real error > (errno != ENOENT). It also errors out if any component except the last > one is missing (errno == ENOENT && remaining.len); that's what the > comment is about. This patch adds the ability to ignore ENOENT for all > components. > > Perhaps convert many_missing and die_on_error into a single flags > parameter and implement the flags DIE_ON_ERR and REQUIRE_BASENAME or > similar? Callers would be easier to read because such an interface is > self-documenting -- provided we find good flag names.
As discussed elsewhere in the thread, this will be moving to an internal function, but I can make that function take two flag parameters.
-- brian m. carlson (he/him or they/them) Houston, Texas, US