Bug 1189036 - RFE: ccache should get applied via profile in other shells than bash
Summary: RFE: ccache should get applied via profile in other shells than bash
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: fish
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Andy Lutomirski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1312594
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-04 10:01 UTC by Raphael Groner
Modified: 2022-08-03 18:07 UTC (History)
3 users (show)

Fixed In Version: fish-2.3.1-1.fc24 fish-2.3.1-1.fc23 fish-2.3.1-1.el7
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-12 15:02:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
ccache.fish (984 bytes, text/plain)
2015-02-22 17:50 UTC, Raphael Groner
no flags Details
Honor /etc/profile.d (286 bytes, text/plain)
2015-02-22 18:43 UTC, Raphael Groner
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1195102 0 unspecified CLOSED fish doesn't set the SHELL environment variable 2021-02-22 00:41:40 UTC

Internal Links: 1195102

Description Raphael Groner 2015-02-04 10:01:14 UTC
Description of problem:
[00:26:56] <rdieter> RaphGro: for example, for me:
[00:27:03] <rdieter> which g++ =>  /usr/lib64/ccache/g++
[00:27:48] <rdieter> if you haven't restarted your session (or shell) since installing it, try: source /etc/profile.d/ccache.sh, and retry `which g++`
[00:27:56] * Caterpillar has quit (Quit: You were not made to live as brutes, but to follow virtue and knowledge.)
[00:28:59] * fewcha_ has quit (Remote host closed the connection)
[00:29:00] <RaphGro> rdieter, now I know to blame fish to not apply it :(
[00:29:23] * fewcha_ (~sbairagya.221.18) has joined
[00:30:08] <RaphGro> yes, fish is not able to execute the script
[00:32:49] <rdieter> what script?
[00:33:38] <rdieter> have you restarted your session since installing ccache?  (if not, that explains why the /etc/profile.d/ snippet isn't in your environment yet).  Or am I misunderstanding something?
[00:35:51] <RaphGro> yes
[00:35:57] <RaphGro> $ fish bash /etc/profile.d/ccache.sh
[00:36:01] <RaphGro> then it works
[00:36:09] <rdieter> what's your default shell?
[00:36:13] <RaphGro> fish
[00:36:13] <rdieter> fish or bash ?
[00:36:31] <rdieter> that's wierd, fish isn't bourne-shell compatible wrt reading /etc/profile ?
[00:36:41] <RaphGro> seems so
[00:36:47] <rdieter> that's too bad
[00:37:04] <rdieter> for me
[00:37:21] <rdieter> fish --login  => which g++ => /usr/lib64/ccache/g++
[00:37:35] <RaphGro> but you call fish manually?
[00:37:40] <RaphGro> from a bash
[00:37:45] <rdieter> yeah
[00:37:59] <RaphGro> well, it is no issue for me to call bash rpmbuild
[00:38:07] <rdieter> nevermind, it inherited $PATH
[00:38:21] <rdieter> that makes fish far less useful, imho
[00:39:03] <rdieter> I'm surprised you haven't seen more breakage in your environment
[00:39:27] <rdieter> there are quite a few things that depend on stuff in /etc/profile.d/ to get source'd into your user environment to work properly

Version-Release number of selected component (if applicable):
ccache-3.1.10-1.fc21.x86_64
fish-2.1.1-2.fc21.x86_64
gcc-c++-4.9.2-1.fc21.x86_64

How reproducible:
yes

Steps to Reproduce:
1. install above mentioned packages
2. set fish as default user shell
3. try to build something that uses g++

Actual results:
ccache is not used in $PATH

Expected results:
ccache is used in $PATH
$ which g++ => /usr/lib64/ccache/g++

Additional info:
Fish breaks from bash expected functionality, therefore it is not 100% bashlike compatible. Raising severity.

Comment 1 Andy Lutomirski 2015-02-20 16:52:17 UTC
Sorry for sitting on this for so long.

It's not entirely clear to me what to do about this.  Some fish startup script could try to parse the contents of /etc/profile.d/*.sh, but that could be a bit hairy.  Ideas?  I could file a bug upstream, but I'm not sure what they would do about it.

Comment 2 Rex Dieter 2015-02-20 16:58:32 UTC
Personally, here's the question for upstream to answer:

if fish is going to claim to be bourne-shell compatible, then shouldn't it parse /etc/profile ?

If yes, fix it.

Else, it's a feature, NOTABUG

Comment 3 Andy Lutomirski 2015-02-20 17:10:48 UTC
The trouble is that fish would need to execute /etc/profile, not just parse it.  For example:

> . /etc/profile.d/ccache.sh

results in tons of errors.

I suppose that fish could run bash (or dash or busybox sh or some internal minimal POSIX-compliant shell) to run /etc/profile and then export the resulting environment variables, but that's not very elegant.

If we had a nice declarative language for /etc/profile.d scripts, that would be great, but we don't seem to have such a thing.

Comment 4 Rex Dieter 2015-02-20 17:40:45 UTC
OK, I think the answer here then is that fish is not bourne shell compatible (so NOTABUG).  By extension, is not suitable for user default shells (in fedora at least).

Comment 5 Andy Lutomirski 2015-02-20 18:14:40 UTC
This is at least a bit disappointing, since csh-compatible shells are okay in Fedora.

Would an acceptable solution be to have a shell wrapper along these lines:

#!/bin/bash

if [[ "${0:0:1}" == "-" ]]; then
  bash --login -c "exec /usr/bin/fish"
else
  exec /usr/bin/fish

Comment 6 Rex Dieter 2015-02-20 18:28:35 UTC
Maybe, as long as it works :)

Comment 7 Raphael Groner 2015-02-21 21:13:16 UTC
(In reply to Andy Lutomirski from comment #3)
> The trouble is that fish would need to execute /etc/profile, not just parse
> it.  For example:
> 
> > . /etc/profile.d/ccache.sh
> 
> results in tons of errors.

Since the script file is part of the ccache package, I'll reassign to ccache and wait what the maintainer there says: That script does not seem to be designed to work in other shells than bash or somehow bash-like. Maybe add some bashism and enforce to run in a bash environment? I do not even know if ccache is generally designed to work in any other shell than bash.

> I suppose that fish could run bash (or dash or busybox sh or some internal
> minimal POSIX-compliant shell) to run /etc/profile and then export the
> resulting environment variables, but that's not very elegant.

Possible work-around and definitely upstream decision to find a proper solution.

> If we had a nice declarative language for /etc/profile.d scripts, that would
> be great, but we don't seem to have such a thing.

This is too generally and out-of-scope for this bug.

Comment 8 Rex Dieter 2015-02-22 01:11:01 UTC
I think there's little point in re-assigning to ccache.  The eternal expectation is that stuff that matches
/etc/profile.d/*.sh
is for shells compatible with bourne shell
/etc/profile.d/*.csh
for shells compatible with c-shell

I seems clear at this point that fish is compatible with neither.

Comment 9 Raphael Groner 2015-02-22 17:50:43 UTC
Created attachment 994275 [details]
ccache.fish

Here is a script that works like /etc/profile.d/ccache.sh

But still, it is necessary to do manually: 

$ source ccache.fish

I do not find any possibility to run the script automatically after a new user login to fish.

It seems that fish is ignoring /etc/profile.d completely and there's nothing to find about any similiar behaviour in fish documentation.

Comment 10 Raphael Groner 2015-02-22 18:43:12 UTC
Created attachment 994294 [details]
Honor /etc/profile.d

Comment 11 Raphael Groner 2015-02-22 18:50:01 UTC
Andy,

please include the attached patch into fish package. If so, ccache could install it's own ccache.fish into /etc/profile.d, this works for me.

Comment 12 Andy Lutomirski 2015-02-23 15:41:33 UTC
Before I make a downstream change like this, I think I should get feedback from upstream:

https://github.com/fish-shell/fish-shell/issues/1956

Comment 13 Raphael Groner 2015-03-31 16:18:09 UTC
Upstream provides a patch for profile. Can you include that patch?

Comment 14 Rex Dieter 2015-03-31 17:54:52 UTC
From my reading of
https://github.com/fish-shell/fish-shell/issues/1956
the implementation details are not yet decided.

Comment 15 Fedora End Of Life 2015-11-04 15:38:03 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 16 Raphael Groner 2016-02-11 12:12:10 UTC
Curiously enough, ccache worked in all of my recent rpmbuilds without any harms done from fish. Maybe rpmbuild now enforces bash for the execution of spec scriptlets? If yes, this bug is fixed at least for rpmbuild and in downstream Fedora.

Comment 17 Ville Skyttä 2016-02-11 12:42:16 UTC
(In reply to Raphael Groner from comment #16)
> Maybe rpmbuild now enforces bash for the execution of spec scriptlets?

I think it has pretty much always done that unless specified otherwise in specfiles, but on the other hand I fail to see what this has to do with rpm/spec scriptlets in the first place. AFAIU this is a shell/profile(.d)/environment thing, not rpm/specfile one.

Comment 18 Raphael Groner 2016-02-11 15:27:16 UTC
(In reply to Ville Skyttä from comment #17)
> (In reply to Raphael Groner from comment #16)
> > Maybe rpmbuild now enforces bash for the execution of spec scriptlets?
> 
> I think it has pretty much always done that unless specified otherwise in
> specfiles, but on the other hand I fail to see what this has to do with
> rpm/spec scriptlets in the first place. AFAIU this is a
> shell/profile(.d)/environment thing, not rpm/specfile one.

For the record, I call rpmbuild in a fish environment. Then rpmbuild executes some spec file to build a package with ccache in background enabled with bash profile settings. But you're right, it's more a general thing with fish configuration options, independently from rpmbuild only.

Comment 19 Andy Lutomirski 2016-02-12 16:43:58 UTC
I think this issue only exists if fish is a login shell -- otherwise fish inherits the ccache entry in PATH from the real login shell.

Once all of the dust is settled in fish upstream, I'll encourage them to spin a release with the new config snippet layout and we can fix this for real.

Comment 20 Raphael Groner 2016-02-26 11:58:14 UTC
(In reply to Andy Lutomirski from comment #12)
> Before I make a downstream change like this, I think I should get feedback
> from upstream:
> 
> https://github.com/fish-shell/fish-shell/issues/1956

https://github.com/fish-shell/fish-shell/commit/c1b384e5d3f2f46e7d7a1b41e31c7aadc1d9ce28

Comment 21 Raphael Groner 2016-02-27 17:30:27 UTC
Andy, can you apply the upstream patch from comment #20?

Comment 22 Andy Lutomirski 2016-02-27 17:34:05 UTC
I tried.  It either needs the "string" builtin to be backported or someone needs to write and test a variant that works on Fedora's version of fish.

Presumably changing:

set -l basename (string replace -r '^.*/' '' -- $file)

to:

set -l basename (basename $file)

would work.

Comment 23 Andy Lutomirski 2016-02-27 17:54:28 UTC
OK, I did a backport and poked at it a bit.  It seems to work, and it's building for all supported releases right now.

We still need to figure out what package should own vendor_conf.d.  See bug 1312594.

Comment 24 Fedora Update System 2016-02-27 17:56:34 UTC
fish-2.2.0-11.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-4d7b9d3d94

Comment 25 Fedora Update System 2016-02-27 18:07:16 UTC
fish-2.2.0-11.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-cdbbc3e2c3

Comment 26 Fedora Update System 2016-02-28 13:50:43 UTC
fish-2.2.0-11.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-cdbbc3e2c3

Comment 27 Fedora Update System 2016-02-28 13:53:37 UTC
fish-2.2.0-11.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-4d7b9d3d94

Comment 28 Fedora Update System 2016-03-06 23:18:19 UTC
fish-2.2.0-11.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 29 Fedora Update System 2016-03-07 03:50:15 UTC
fish-2.2.0-11.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 30 Fedora Update System 2016-07-07 14:12:16 UTC
fish-2.3.1-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-f400b76b0a

Comment 31 Fedora Update System 2016-07-07 14:13:01 UTC
fish-2.3.1-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f524170748

Comment 32 Fedora Update System 2016-07-07 14:13:34 UTC
fish-2.3.1-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-11c320ee6c

Comment 33 Fedora Update System 2016-07-10 03:18:19 UTC
fish-2.3.1-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-f400b76b0a

Comment 34 Fedora Update System 2016-07-10 03:53:10 UTC
fish-2.3.1-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f524170748

Comment 35 Fedora Update System 2016-07-10 15:58:50 UTC
fish-2.3.1-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-11c320ee6c

Comment 36 Fedora Update System 2016-07-12 15:02:32 UTC
fish-2.3.1-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 37 Fedora Update System 2016-07-19 22:23:33 UTC
fish-2.3.1-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 38 Fedora Update System 2016-07-27 19:17:36 UTC
fish-2.3.1-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.