Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bash provides the PROMPT_COMMAND environment variable containing a command that is called when a prompt is displayed. Prior to this update, the PROMPT_COMMAND variable set by a custom profile.d script was overwritten with the default value from the /etc/bashrc script file. With this update, the /etc/bashrc script file has been updated so that it now respects a user-defined PROMPT_COMMAND variable, and does not overwrite it.
DescriptionJ.H.M. Dassen (Ray)
2011-03-28 14:34:05 UTC
2. What is the nature and description of the request?
Make a change to the default /etc/bashrc file so that if PROMPT_COMMAND has not
already been set, then to set it.
[ -z "${PROMPT_COMMAND}" ] && PROMPT_COMMAND=
'echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}";
echo -ne "\007"'
3. Why does the customer need this? (List the business requirements here).
Customer wants the bash .history contents to be a more reliable audit of user
activities. Multiple articles found via google recommend setting env variable
PROMPT_COMMAND to contain 'history -a' so that multiple simultaneous shells
will share (and write immediately) the most recent commands executed to the
history file; refer to (among others):
http://linuxcommando.blogspot.com/2007/11/keeping-command-history-across-multiple.html
The problem with these are:
1. The file /etc/sysconfig/bash-prompt-xterm is run by bash at each prompt as a
new executable (in a new shell) so doesn't work for setting the current shell's
history (or any other environment variables).
2. The files in /etc/profile.d/*.sh are read by /etc/profile before the
/etc/bashrc file is read by the default ~/.bashrc (taken from
/usr/skel/.bashrc). All changes to PROMPT_COMMAND are over-written by
/etc/bashrc.
4. How would the customer like to achieve this? (List the functional
requirements here)
An update to bash so that /etc/bashrc only modifies the PROMPT_COMMAND if not
already set in the previous /etc/profile.d/*.sh or
/etc/sysconfig/bash_prompt_xterm files. Make available in a minor update
release.
5. For each functional requirement listed in question 4, specify how Red Hat
and the customer can test to confirm the requirement is successfully
implemented.
Customer is able to test the latest Z-stream release for RHEL5 and RHEL6
package that has the /etc/bashrc changes and confirms that their history
setting is saved properly.
6. Is there already an existing RFE upstream or in Red Hat bugzilla?
no
7. How quickly does this need resolved? (desired target release)
RHEL5.8, RHEL6.2.
8. Does this request meet the RHEL Inclusion criteria (please review)
yes.
9. List the affected packages.
setup
10. Would the customer be able to assist in testing this functionality if
implemented?
Yes
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Bash provides the PROMPT_COMMAND environment variable containing a command that is called when a prompt is displayed. Prior to this update, the PROMPT_COMMAND variable set by a custom profile.d script was overwritten with the default value from the /etc/bashrc script file. With this update, the /etc/bashrc script file has been updated so that it now respects a user-defined PROMPT_COMMAND variable, and does not overwrite it.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHBA-2011-1171.html
2. What is the nature and description of the request? Make a change to the default /etc/bashrc file so that if PROMPT_COMMAND has not already been set, then to set it. [ -z "${PROMPT_COMMAND}" ] && PROMPT_COMMAND= 'echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"' 3. Why does the customer need this? (List the business requirements here). Customer wants the bash .history contents to be a more reliable audit of user activities. Multiple articles found via google recommend setting env variable PROMPT_COMMAND to contain 'history -a' so that multiple simultaneous shells will share (and write immediately) the most recent commands executed to the history file; refer to (among others): http://linuxcommando.blogspot.com/2007/11/keeping-command-history-across-multiple.html The problem with these are: 1. The file /etc/sysconfig/bash-prompt-xterm is run by bash at each prompt as a new executable (in a new shell) so doesn't work for setting the current shell's history (or any other environment variables). 2. The files in /etc/profile.d/*.sh are read by /etc/profile before the /etc/bashrc file is read by the default ~/.bashrc (taken from /usr/skel/.bashrc). All changes to PROMPT_COMMAND are over-written by /etc/bashrc. 4. How would the customer like to achieve this? (List the functional requirements here) An update to bash so that /etc/bashrc only modifies the PROMPT_COMMAND if not already set in the previous /etc/profile.d/*.sh or /etc/sysconfig/bash_prompt_xterm files. Make available in a minor update release. 5. For each functional requirement listed in question 4, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented. Customer is able to test the latest Z-stream release for RHEL5 and RHEL6 package that has the /etc/bashrc changes and confirms that their history setting is saved properly. 6. Is there already an existing RFE upstream or in Red Hat bugzilla? no 7. How quickly does this need resolved? (desired target release) RHEL5.8, RHEL6.2. 8. Does this request meet the RHEL Inclusion criteria (please review) yes. 9. List the affected packages. setup 10. Would the customer be able to assist in testing this functionality if implemented? Yes