git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/5] Add is_absolute_path(), make_absolute_path() and normalize_path()

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 26, 2007, 06:53 UTC
Message-ID
<7v1wevac63.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0707260724010.14781@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> +/* strip out .. and . */
> +char *normalize_path(char *path)
> +{

This always makes one worry what should happen when foo/../bar is _not_ bar in reality (i.e. foo is symlink to a directory elsewhere).

It depends on what kind of "path" you feed to the function (and its caller, make_absolute_path()). If you always feed a path from the index (or a path obtained by recursively reading a tree), it is Ok. If it is arbitrary path obtained from the user or the filesystem, it is not.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 of 5 in “Add is_absolute_path(), make_absolute_path() and normalize_path()”
  1. 1/5 Add is_absolute_path(), make_absolute_path() and normalize_path()Johannes Schindelin, Jul 26, 2007
  2. Junio C HamanoJul 26, 2007
  3. Johannes SchindelinJul 26, 2007
  4. Junio C HamanoJul 26, 2007
  5. Johannes SchindelinJul 26, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.