Last modified: 2014-06-01 11:38:05 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T67980, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 65980 - crontab -e adds bashrc output to crontab file
crontab -e adds bashrc output to crontab file
Status: RESOLVED INVALID
Product: Wikimedia Labs
Classification: Unclassified
tools (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Marc A. Pelletier
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-31 18:58 UTC by Merlijn van Deen (test)
Modified: 2014-06-01 11:38 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Merlijn van Deen (test) 2014-05-31 18:58:20 UTC
How to reproduce:
------------------
- add "echo something" to .bashrc.
- Then run crontab -e.

Expected behavior:
------------------
An editor with the crontab

Actual behavior:
----------------
An editor with the crontab, but prepended by 'something'.

Workaround:
-----------
Make sure .bashrc output goes to stderr by wrapping the echo's with (  ) >&2
Comment 1 Marc A. Pelletier 2014-05-31 23:28:43 UTC
This workaround /does/ work, but I should point out that it is generally not recommended to have *any* output whatever in one's .bashrc as this is implicitly sourced in numerous places (including subshells, remote invocations, and even often through a simple invocation of the system() library call) and may confused numerous tools or systems that spawn shells on the user's behalf - including gridengine.

On the other hand, it is perfectly allowable to have commands that result in output in one's .profile which is sourced only when an actual login session is spawned.

Pro tip: I generally recommend to source .bashrc from one's .profile to avoid shells ending up with different environment depending on how they are started; this is accomplished by adding

. ~/.bashrc

at the end of the .profile.
Comment 2 Merlijn van Deen (test) 2014-06-01 11:38:05 UTC
Moving .bashrc to .profile solved the issue; using .bashrc was necessary on the toolserver due to a slightly different 'become' implementation.

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


Navigation
Links