Bug 22216
Summary: | Commands executed using user's own shell (but manpage disagrees) | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Ed Avis <ed> |
Component: | at | Assignee: | Jens Petersen <petersen> |
Status: | CLOSED RAWHIDE | QA Contact: | Mike McLean <mikem> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.2 | CC: | dr |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2003-06-17 07:19:06 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 82857, 91233 |
Sorry, that example is broken. You need an extra 'echo' in there... I reproduced this bug myself by typing stuff directly into at's stdin. Working example: % echo $SHELL /bin/tcsh % echo 'echo "Hello, this is $SHELL"' | at now warning: commands will be executed using /bin/sh job 1 at 2000-12-13 12:14 % mail [snip] Subject: Output from your job 1 Hello, this is /bin/tcsh Rather than change the behavior, I think it's best to simply change the documentation to match the existing behavior. This has been done in at-3.1.8-13. Did you also remove the 'warning: commands will be executed using /bin/sh' message? The fact that at prints this message suggests that the original author's intention was for /bin/sh to be used. But as long as the manual page, the warning message and the implementation all agree, it doesn't much matter which shell is used. ICBW but it looks to me that this change was erroneous. Changing shell doesn't automatically change the value of SHELL.... % printenv SHELL /bin/zsh % bash $ printenv SHELL /bin/zsh When originally submitting the bug I picked 'echo $SHELL' as an example of a command to show the current shell; perhaps the example was wrong because $SHELL is not a reliable indicator, but nonetheless the bug report described the behaviour when it was submitted. I'm sure that 'at' jobs were being executed using root's shell, not /bin/sh. This was on 6.2 mind you, perhaps it has changed since then (in which case the documentation might need to be changed back again!). Ok, well I reverted the warning patch in at-8.1.3-41, but if this has ever worked I would really like to know in which version. |
The manual page at(1) says: >at and batch read commands from standard input or a specified file >which are to be executed at a later time, using /bin/sh. But this isn't what happens. If the user's shell is /bin/tcsh, for example, then commands are executed using that shell instead. For example, change your shell to tcsh and run: % echo 'hello, this is $SHELL' | at now The output from the job will say: Hello, this is /bin/tcsh Hence the manual page is wrong. I'm not sure whether the implementation or the manpage needs to change - I would favour always using /bin/sh.