From: ludo@gnu.org (Ludovic Courtès)
To: Pierre Neidhardt <mail@ambrevar.xyz>
Cc: meiyo.peng@gmail.com, 30265@debbugs.gnu.org
Subject: bug#30265: Fish shell has wrong path variables
Date: Wed, 19 Sep 2018 22:39:19 +0200 [thread overview]
Message-ID: <87o9ctdxxk.fsf@gnu.org> (raw)
In-Reply-To: <87pnx9yhsx.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Wed, 19 Sep 2018 11:09:50 +0200")
Hi Pierre,
Pierre Neidhardt <mail@ambrevar.xyz> skribis:
> I think Ricardo got a hunch of what's happening, except that it's not
> about cache files in the user home's directory. Instead, Fish seems to
> record the path to the graft source. A grep in the fish folder does not
> seem to reveal anything, nor does `strings
> /gnu/store/...-fish.../bin/fish`.
>
> Could this be a grafting issue? Like what was recently mentioned about
> Racket?
It may well be a reference that doesn’t get properly grafted. We can
see it when running the grafted fish under ‘strace’.
The culprit is this bit from fish.cpp:
// Fall back to what got compiled in.
debug(2, L"Using compiled in paths:");
paths.data = L"" DATADIR "/fish";
paths.sysconf = L"" SYSCONFDIR "/fish";
paths.doc = L"" DOCDIR;
paths.bin = L"" BINDIR;
The “L” here means these are “wide string” literals, and indeed, the
“Using…” string above looks like this in the ELF file:
001140d0: 5500 0000 7300 0000 6900 0000 6e00 0000 U...s...i...n...
001140e0: 6700 0000 2000 0000 6300 0000 6f00 0000 g... ...c...o...
001140f0: 6d00 0000 7000 0000 6900 0000 6c00 0000 m...p...i...l...
00114100: 6500 0000 6400 0000 2000 0000 6900 0000 e...d... ...i...
00114110: 6e00 0000 2000 0000 7000 0000 6100 0000 n... ...p...a...
00114120: 7400 0000 6800 0000 7300 0000 3a00 0000 t...h...s...:...
The DATADIR literal is similarly “hidden”, and thus the grafting code
doesn’t see it.
Possible fixes include:
1. Finding a way to make the run-time detection in
‘determine_config_directory_paths’ to always work without going to
the fallback case where it relies on string literals. This could
be done by attempting to read /proc/self/exe (on GNU/Linux) instead
of relying on argv0.
2. Using “regular” strings, or at least arranging to store DATADIR &
co. in regular “const char” arrays. Maybe something like:
static const char datadir[] = DATADIR;
…
paths.data = L"" + datadir + L"/fish";
It probably takes some more casts from char[] to std::string to
wcstring, but you get the idea. ;-)
Thoughts?
Ludo’.
next prev parent reply other threads:[~2018-09-19 20:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-27 9:11 bug#30265: Fish shell has wrong path variables Meiyo Peng
2018-01-27 10:36 ` ng0
2018-01-27 16:25 ` Ludovic Courtès
2018-01-27 18:19 ` ng0
2018-01-27 12:19 ` Ricardo Wurmus
2018-01-27 13:45 ` Meiyo Peng
2018-01-27 14:13 ` Meiyo Peng
2018-09-19 9:09 ` Pierre Neidhardt
2018-09-19 20:39 ` Ludovic Courtès [this message]
2018-09-20 16:09 ` Pierre Neidhardt
2018-09-20 17:00 ` Ricardo Wurmus
2018-09-20 17:12 ` Pierre Neidhardt
2018-09-21 12:03 ` Ludovic Courtès
2018-09-21 12:05 ` Ludovic Courtès
2018-09-21 14:42 ` Pierre Neidhardt
2018-09-21 14:46 ` Ricardo Wurmus
2018-09-21 15:11 ` Pierre Neidhardt
2019-02-02 7:20 ` bug#30265: Fish embeds store file names in UCS-4/UTF-32 literal strings Meiyo Peng
2019-02-04 22:16 ` Ludovic Courtès
2020-03-30 6:29 ` John Soo
2022-10-07 19:42 ` Maxim Cournoyer
2022-10-07 19:43 ` Maxim Cournoyer
2022-10-07 19:44 ` John Soo
2022-10-07 20:57 ` Mark H Weaver
2022-10-10 3:38 ` Maxim Cournoyer
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=87o9ctdxxk.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=30265@debbugs.gnu.org \
--cc=mail@ambrevar.xyz \
--cc=meiyo.peng@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.