public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Pedro Alves <pedro@palves.net>
Cc: simon.marchi@polymtl.ca, gdb-patches@sourceware.org,
	simon.marchi@efficios.com
Subject: Re: [PATCH v2] gdbsupport: add path_join function
Date: Wed, 20 Apr 2022 15:35:46 +0300	[thread overview]
Message-ID: <834k2oszj1.fsf@gnu.org> (raw)
In-Reply-To: <f56093ba-9c2a-40e6-a8ba-73c856f885e4@palves.net> (message from Pedro Alves on Wed, 20 Apr 2022 12:52:04 +0100)

> Date: Wed, 20 Apr 2022 12:52:04 +0100
> From: Pedro Alves <pedro@palves.net>
> Cc: Simon Marchi <simon.marchi@efficios.com>
> 
> I understand we don't implement the root name checks described in 1) at:
> 
>    https://en.cppreference.com/w/cpp/filesystem/path/append
> 
> however, at least recognizing "drive:/" and "drive:\" as absolute paths
> I think works as is, and I'd think is important that it works for GDB.  So I think
> we should have these tests under _WIN32:
> 
>    test_one ("C:\\bar", "C:\\foo", "C:\\bar");  // '\' sep.
>    test_one ("C:/bar", "C:\\foo", "C:/bar");    // '/' sep.
>    test_one ("D:\\bar", "C:\\foo", "D:\\bar");  // 'D:' wins.

That sounds outside of the scope of path_join, which is just a smart
concatenation function.  What you describe sounds more like
canonicalize_filename or any other function which resolves a file name
to produce an absolute one.  There's a place for those as well, but
one doesn't always want an absolute file name.  Also, resolving file
names could include symlink resolution and other stuff, and that is
really out of scope here.

How many instances do we have in our sources where path_join is used
to produce an absolute file name and arguments other than the first
one could be absolute?

> " (...) joining with an absolute path on the right hand side, like this:
>  
>    path_join ("/foo", "/bar");
>  
>  results in just the right hand side being kept.  In this example, the
>  result is "/bar".
> "

Or maybe I've lost the track of the discussion, since the above
doesn't sound consistent with what I though this function should do.
Did we switch the concept at some point?

  reply	other threads:[~2022-04-20 12:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20  0:20 Simon Marchi
2022-04-20  6:08 ` Eli Zaretskii
2022-04-20 11:52 ` Pedro Alves
2022-04-20 12:35   ` Eli Zaretskii [this message]
2022-04-20 12:38     ` Pedro Alves
2022-04-20 12:45       ` Eli Zaretskii
2022-04-20 13:12         ` Pedro Alves
2022-04-20 14:45         ` Simon Marchi
2022-04-20 15:57           ` Eli Zaretskii
2022-04-20 16:11             ` Simon Marchi
2022-04-20 16:47               ` Eli Zaretskii
2022-04-20 17:31               ` Pedro Alves
2022-04-20 17:22           ` Pedro Alves
2022-04-20 17:35             ` Simon Marchi
2022-04-20 17:44               ` Pedro Alves
2022-04-20 14:55   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834k2oszj1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    --cc=simon.marchi@efficios.com \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).