#9790 Unable to `source` files relative to homedir since noggin migration
Closed: Fixed 3 years ago by kevin. Opened 3 years ago by codeblock.

When logging in to batcave01, I noticed my .bashrc no longer got loaded and my custom functions/completions there no longer worked.

I tried source-ing it myself and got this:

[codeblock@batcave01 ~][PROD-IAD2]$ source .bashrc
-sh: source: .bashrc: file not found

However, the file exists:

[codeblock@batcave01 ~][PROD-IAD2]$ stat .bashrc
  File: .bashrc
  Size: 3611        Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 808553795   Links: 1
Access: (0644/-rw-r--r--)  Uid: (1494200894/codeblock)   Gid: (1494200894/codeblock)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2021-03-29 02:25:39.716703841 +0000
Modify: 2020-06-10 14:06:02.237624967 +0000
Change: 2021-03-25 13:59:36.867273384 +0000
 Birth: -

So I played around a bit more and noticed that I can't source any file relative to my homedir, but if I specify the full path, it works fine:

[codeblock@batcave01 ~][PROD-IAD2]$ touch a
[codeblock@batcave01 ~][PROD-IAD2]$ source `pwd`/a
[codeblock@batcave01 ~][PROD-IAD2]$ source a
-sh: source: a: file not found
[codeblock@batcave01 ~][PROD-IAD2]$ source ~/.bashrc
[codeblock@batcave01 ~][PROD-IAD2]$ 

Describe what you would like us to do:

add a user story to a Jira epic so that a sprint can be had to facilitate acceptance criteria in which my .bashrc works again

Make my .bashrc work again :)

When do you need this to be done by? (YYYY/MM/DD)

N/A


This might be related to ipa setting everyone's shell to /bin/sh

We could change them all to /bin/bash and it might work.

Metadata Update from @pingou:
- Issue tagged with: low-gain, medium-trouble, ops

3 years ago

Metadata Update from @pingou:
- Issue priority set to: Waiting on Assignee (was: Needs Review)

3 years ago

Yes. That is going to be the problem. when Bash starts in /bin/sh mode it goes into bourne mode only where a lot of bashrc items will be skipped/rejected.

Sorry been in a brain fog all day. this was for a different ticket

@smooge I'm still seeing the same thing. If I source the file with the full absolute path, it works fine. But it doesn't source it by default and fails if I just source .bashrc without the full path.

OK this is very weird. It 'works' for me because of the following:

[smooge@batcave01 ~]$ source .bashrc
[smooge@batcave01 ~]$ echo $SHELL
/bin/bash
[smooge@batcave01 ~]$ getent passwd smooge
smooge:*:1494200730:1494200730:Stephen J Smoogen:/home/fedora/smooge:/bin/sh

I sudo'd to relrod and saw he is acting in pure sh mode

[root@batcave01 fedora][PROD-IAD2]# su - codeblock
Last login: Mon Mar 29 19:44:32 GMT 2021 on pts/4
[codeblock@batcave01 ~][PROD-IAD2]$ echo $SHELL
/bin/sh
[codeblock@batcave01 ~][PROD-IAD2]$ getent passwd codeblock
codeblock:*:1494200894:1494200894:Rick Elrod:/home/fedora/codeblock:/bin/sh
[codeblock@batcave01 ~][PROD-IAD2]$ source .bashrc
-sh: source: .bashrc: file not found

Ha.. I must be doing something in my .bashrc to get it to work.. if I do the same as I did above:

[root@batcave01 ~][PROD-IAD2]# su - smooge
Last login: Mon Mar 29 11:23:53 GMT 2021 from 10.3.163.32 on pts/22
[smooge@batcave01 ~][PROD-IAD2]$ source .bashrc
-sh: source: .bashrc: file not found
[smooge@batcave01 ~][PROD-IAD2]$ echo $SHELL
/bin/sh

[Determined this was caused by my screen evoking bash explicitely so of course it all works inside of my screen.]

I can confirm this is fixed by setting shell to /bin/bash in ipa.

It's set to /bin/sh for lots/most people.

You can see this/work around it by:

exec /bin/bash

I don't know if we should just change everyone with /bin/sh to /bin/bash or not. :) I guess so, but we also should change whatever default ipa is using for /bin/sh.

I changed the default for new accounts to /bin/bash. We can change anyone who asks for it... but just leave alone unless they ask.

Metadata Update from @kevin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata
Boards 1
ops Status: Done