zsh-users
 help / color / mirror / code / Atom feed
From: Marc Chantreux <mc@unistra.fr>
To: Zsh Users <zsh-users@zsh.org>
Subject: A way to find a bug (or explain a missuse of) realpath expansion?
Date: Tue, 30 Apr 2024 15:58:57 +0200	[thread overview]
Message-ID: <ZjD5IStAhHXUNCLT@prometheus> (raw)

hello,

The /usr shade of path will disapear from debian distribution so
right now we have:

	realpath /usr/bin /usr/bin/ /bin /bin/| sort -u
	# /usr/bin

Let's forget extra / for the moment: I can get the same result with:

	foo=( {/usr,}/bin )
	foo=( ${foo%/} )
	foo=( $foo(:A) )
	print -l ${(u)foo}
	# /usr/bin

but I don't know how to oneline it:

	foo=( {/usr,}/bin )
	print -l ${(u):-${foo%/}(:A)}
	# /usr/bin
	# /usr/bin

neither I can deal with backslashed twins.

	foo=( {/usr,}/bin{,/} ) ; print -l ">>>> setting foo" $foo
	foo=( ${foo%/} )        ; print -l ">>>> remove tailing /" $foo
	foo=( $foo(:A) )        ; print -l ">>>> realpath" $foo
	foo=( ${(u)foo} )       ; print -l ">>>> uniq" $foo

	>>>> setting foo
	/usr/bin
	/usr/bin/
	/bin
	/bin/
	>>>> remove tailing /
	/usr/bin
	/usr/bin
	/bin
	/bin
	>>>> realpath
	/usr/bin
	/usr/bin
	/bin
	/usr/bin
	>>>> uniq
	/usr/bin
	/bin

I also realize I post those kind of questions for 20 years now just
because the zsh community is friendly enough to reply again and again:
I still don't know how to give a closer look to the way zsh work to fix
it by myself. To me the next step seems to be:

* compile my own version of zsh with symbols (from apt source and
  dpkg-buildpackage?)
* run a gdb session and start to explore the code

Is it? is there still something easier to try at this point? I want to
learn fishery.

regards,
-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79



             reply	other threads:[~2024-04-30 13:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 13:58 Marc Chantreux [this message]
2024-05-01  3:43 ` Bart Schaefer
2024-05-02  8:06   ` Marc Chantreux
2024-05-02 16:03     ` Bart Schaefer

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=ZjD5IStAhHXUNCLT@prometheus \
    --to=mc@unistra.fr \
    --cc=zsh-users@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).