/etc/profile

[quote="“eng-int,post:6,topic:131074”]

Unfortunately although aaa_base may provide /etc/profile it does not seem to actually write it.

(@nrickert – I did check for the presence of a .rpmnew or .rpmsav before copying from profile.)

This is what I just did:


ns3:/etc # lh -d prof*
-rw-r--r--   1 root root    9.0K Jul  7  2017 profile
drwxr-xr-x   2 root root    1.2K Mar 31 15:09 profile.d

ns3:/etc # cp -a profile profile.good
ns3:/etc # echo "## ray" >>  profile
ns3:/etc # grep "^##" profile
## ray
ns3:/etc # 

ns3:/etc # zypper install --force aaa_base
Loading repository data...
Reading installed packages...
Forcing installation of 'aaa_base-13.2+git20140911.61c1681-27.2.x86_64' from repository '42.3-Repo-oss'.
Resolving package dependencies...

The following package is going to be reinstalled:
  aaa_base

1 package to reinstall.
Overall download size: 132.5 KiB. Already cached: 0 B. No additional space will be
used or freed after the operation.
Continue? [y/n/...? shows all options] (y): 
Retrieving package aaa_base-13.2+git20140911.61c1681-27.2.x86_64
                                               (1/1), 132.5 KiB (262.2 KiB unpacked)
Retrieving: aaa_base-13.2+git20140911.61c1681-27.2.x86_64.rpm ..[done (164.8 KiB/s)]
Checking for file conflicts: .................................................[done]
(1/1) Installing: aaa_base-13.2+git20140911.61c1681-27.2.x86_64 ..............[done]
Additional rpm output:
Updating /etc/sysconfig/language...                                                 
Updating /etc/sysconfig/backup...                                                   
Updating /etc/sysconfig/proxy...                                                    
Updating /etc/sysconfig/windowmanager...                                            
Updating /etc/sysconfig/news...                                                     
Updating etc/passwd...unchanged                                                     
Updating etc/group...unchanged                                                      
Updating etc/shadow...unchanged                                                     


ns3:/etc # lh -d prof*
-rw-r--r-- 1 root root 9.0K Apr  3 18:26 profile
drwxr-xr-x 2 root root 1.2K Apr  3 18:32 profile.d
-rw-r--r-- 1 root root 9.0K Jul  7  2017 profile.good

ns3:/etc # grep "^##" profile
## ray
 
ns3:/etc # lh -d prof*
-rw-r--r-- 1 root root 9.0K Apr  3 18:26 profile
drwxr-xr-x 2 root root 1.2K Apr  3 18:32 profile.d
-rw-r--r-- 1 root root 9.0K Jul  7  2017 profile.good
ns3:/etc # 

Could someone please either confirm this or tell me where I have gone wrong.[/QUOTE]

I can verify.
So, after the testing I’ll describe my solution (skip to end of this post)

On one of my machines, it somehow had escaped my attention and was still 42.1.
So, taking advantage of the situation, I inspected /etc/profile and found that the trailing back-slashes were there (not missing),
Then to test the perserverance of edits to this file I added a comment to the end of this file and then
Upgraded the machine (from 42.1 to 42.3).
The test comment inserted into /etc/profile survived the upgrade.

I then tested for replacing /etc/profile with a forced re-install.
First, to determine and verify the package which contains the file I ran

zypper se -x --provides /etc/profile

Verifying the package is aaa_base, I then ran

zypper in -f aaa_base

Inspecting the file /etc/profile again, I still found the inserted test comment.

So, apparently someone has gone out of its way to make sure that the /etc/profile is not over-written.
This may be useful in some cases (I remember a Forum thread which discussed where the official documentation for some app instructed direct edits to /etc/profile) but as we can see in this thread that the behavior is unexpected.

My solution:

# rm /etc/profile
# zypper in -f aaa_base

Verified this installs a default /etc/profile.

HTH,
TSU