zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Jun T <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: Cygwin/MSYS2: Trouble converting relative paths from / using :a or :A
Date: Wed, 1 Dec 2021 04:58:45 +0000	[thread overview]
Message-ID: <20211201045845.GA26421@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <B3B0570D-5123-4664-967B-85F556467FC1@kba.biglobe.ne.jp>

Jun T wrote on Wed, Nov 17, 2021 at 18:39:12 +0900:
> 
> > 2021/11/15 17:44、I wrote:
> 
> > # When is it possible that the return value of zgetcwd() ends with '/' but is not
> > # equal to just "/"?
> 
> Now I think that the return value of zgetcwd() ('here') can end with '/'
> only if strlen(here)==1, so we need not metafy 'here'.
> Am I correct?
> 

I don't know.

> > +	char *here = zgetcwd();
> > +	if (here[strlen(here)-1] != '/')
> > +	    *junkptr = zhtricat(metafy(here, -1, META_HEAPDUP), "/", *junkptr);
> > +	else
> > +	    *junkptr = dyncat(here, *junkptr);
> 
> The same code appears at lines 932 of hist.c, and line 4501 of subst.c.

This isn't a new issue in your patch, but I'd like to ask it anyway:

Can zgetcwd() return an empty string?  If so, the expression in the
condition will trigger undefined behaviour.

Cheers,

Daniel


  reply	other threads:[~2021-12-01  4:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 19:19 agkozak
2021-11-15  8:44 ` Jun T
2021-11-17  9:39   ` Jun T
2021-12-01  4:58     ` Daniel Shahaf [this message]
2021-12-05 14:10       ` Jun. T

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=20211201045845.GA26421@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).