Red Hat Bugzilla – Bug 204562
sort behaves differently: cron vs. bash
Last modified: 2007-11-30 17:11:41 EST
Description of problem:
/bin/sort uses the LC_ALL environment variable to determine how to sort. There
seems to be a discrepency between how this variable is set in a user shell and
cron's environment. This causes scripts to behave differently when run in a
user shell vs. cron.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Place the following script in /etc/cron.hourly:
sort << EOF > /tmp/1
2. Execute the script manually from a user shell and inspect /tmp/1.
3. Wait for cron to run the script and inspect /tmp/1.
The results should be the same whether the script is run by cron or from a user
shell. Although one could manually set LC_ALL in the script, this requirement
is not intuitive. From experience, coming to the proper conclusions while
debugging an issue caused by this discrepency is quite difficult!
I am not sure if this should be fixed in cron or elsewhere.
cron set locale to system defaults or to that specified by any LC_* variable.
Bash tracks the value of LC_ALL; used to override values for other locale
categories. So it could work the same in my case, but it didn't. I'll look at
I close it as not a bug.
Shell hasn't reason for using LC_* variables for sorting if you don't use
locales. It isn't definitely problem of cron.