Open ghost opened 1 year ago
It doesn't seem to happen in future derivations
@rycee I remember seeing the /homeless-shelter/
path mentioned in test output, but I imagine this isn't related to test code? Is there some "guard" I need to introduce in the fish formatting code?
While building a Nix derivation inside a sandbox the HOME directory will be set to a read-only directory /homeless-shelter
. So something is trying to write to the home directory during a Nix build, which is not allowed. If it is absolutely necessary to have a writable home then you can set HOME=$(mktemp -d)
.
Digging into this more now. I have tracked down the code path in fish_indent that causes this: fish_indent.cpp => env.cpp => path.cpp.
Running nix-shell --pure tests -A run.fish-format-scripts
seems to be a good test case for this, as it produces the errors on stderr when it runs fresh. To get a new rerun, I've been adding echo <random char>
at the beginning of the body of the fishIndent
script body to get it to rebuild.
My first attempt to fix was hoping that invoking fish_indent
via fish
as
fish -c "fish_indent" < $textPath > $out
would perform some necessary setup, but it seemingly produced even more errors due to fish
trying to access things in my system's /etc
Fish includes a --no-config
option, so I also tried
fish --no-config -c "fish_indent" < $textPath > $out
This cleared up the errors from fish trying to read /etc
, but didn't resolve the initial errors. My guess is that the flag only applies to the fish
binary's config lookups, and doesn't propagate to fish_indent
.
Following @rycee's advice, I replaced that with
env HOME=$(mktemp -d) fish_indent < $textPath > $out
Which does run with no errors. As far as I can tell, fish_indent
itself provides no option to prevent it from checking for files in $HOME
, so this seems like a passable stopgap solution to me. I'm happy to open a PR with this change.
edit: I asked in the fish-shell gitter, and it seems like this is our best bet for now:
fish_indent reads user configuration (like universal variables in ~/.config/fish) to respect feature flags that change syntax and hence formatting (see status features). Your workaround seems good. Maybe we should add the --no-config here as well, or even suppress the error if it's just about the ampersand syntax change
I wonder if we can get a minimal reproduction for this on a commit prior to #3513 being merged in order to confirm that the bug is absent on master before closing this.
well now i can confirm that it doesnt print out the thing in the op
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
@matthewess @rycee why the user was using programs.fish.functions.body
? If the user would like to change its fish_prompt
function to change FISH PROMPT, the correct syntax should not be programs.fish.functions.fish_prompt.body
and inside it the fish code?
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Are you following the right branch?
Is there an existing issue for this?
Issue description
After I create the fish_prompt function as follows:
I get the following output when switching to a new h-m derivation
I don't notice anything weird with my system afterwards, but it still seems like a weird output.
Maintainer CC
@matthewess
System information