Thread (9 messages) 9 messages, 3 authors, 2020-12-08

Re: [PATCH v4 1/2] abspath: add a function to resolve paths with missing components

From: brian m. carlson <hidden>
Date: 2020-12-08 02:52:37

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.
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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help