Bug 204562 - sort behaves differently: cron vs. bash
Summary: sort behaves differently: cron vs. bash
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: vixie-cron (Show other bugs)
(Show other bugs)
Version: rawhide
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Brock Organ
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-08-30 00:18 UTC by W. Michael Petullo
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-31 07:16:06 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description W. Michael Petullo 2006-08-30 00:18:41 UTC
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):
vixie-cron-4.1-55.FC5

How reproducible:
Every time

Steps to Reproduce:
1. Place the following script in /etc/cron.hourly:

#!/bin/sh

sort << EOF > /tmp/1
a
ab
a-
a-b
a-a

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.
  
Actual results:
cron:
a
a-
a-a
a-b *
ab  *

user shell:
a
a-
a-a
ab  *
a-b *

Expected results:
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!

Additional info:
I am not sure if this should be fixed in cron or elsewhere.

Comment 1 Marcela Mašláňová 2006-08-30 07:13:32 UTC
Hello,
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 
it.

Comment 2 Marcela Mašláňová 2006-08-31 07:16:06 UTC
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.


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